From: vsv Date: Fri, 15 Apr 2016 14:03:59 +0000 (+0300) Subject: Parameters management implementation X-Git-Tag: V_2.3.0~195 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2bfba27eff384b350637aa6b59a6f2bb97471d70;p=modules%2Fshaper.git Parameters management implementation --- diff --git a/src/ModuleBase/CMakeLists.txt b/src/ModuleBase/CMakeLists.txt index 40de9e2b9..2553a9506 100644 --- a/src/ModuleBase/CMakeLists.txt +++ b/src/ModuleBase/CMakeLists.txt @@ -62,6 +62,7 @@ SET(PROJECT_HEADERS ModuleBase_WidgetValidator.h ModuleBase_IconFactory.h ModuleBase_WidgetErrorLabel.h + ModuleBase_Dialog.h ) SET(PROJECT_SOURCES @@ -121,6 +122,7 @@ SET(PROJECT_SOURCES ModuleBase_IconFactory.cpp ModuleBase_WidgetErrorLabel.cpp ModuleBase_SelectionValidator.cpp + ModuleBase_Dialog.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/ModuleBase/ModuleBase_Dialog.cpp b/src/ModuleBase/ModuleBase_Dialog.cpp new file mode 100644 index 000000000..db3799b3b --- /dev/null +++ b/src/ModuleBase/ModuleBase_Dialog.cpp @@ -0,0 +1,79 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + + +#include "ModuleBase_Dialog.h" +#include "ModuleBase_WidgetFactory.h" +#include "ModuleBase_IWorkshop.h" +#include "ModuleBase_IPropertyPanel.h" +#include "ModuleBase_PageWidget.h" + +#include + +#include +#include +#include +#include + + +ModuleBase_Dialog::ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QString& theId, + const std::string& theDescription) : + QDialog(theParent->desktop()), + myId(theId), + myDescription(theDescription), + myWorkshop(theParent) +{ + ModuleBase_WidgetFactory aFactory(myDescription, myWorkshop); + + SessionPtr aMgr = ModelAPI_Session::get(); + std::shared_ptr aDoc = aMgr->activeDocument(); + + aMgr->startOperation(myId.toStdString()); + myFeature = aDoc->addFeature(myId.toStdString()); + if (!myFeature.get()) + return; + + QVBoxLayout* aLayout = new QVBoxLayout(this); + aLayout->setContentsMargins(0, 0, 0, 0); + aLayout->setSpacing(1); + //setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); + + ModuleBase_PageWidget* aPage = new ModuleBase_PageWidget(this); + aLayout->addWidget(aPage); + + aFactory.createWidget(aPage, false); + myWidgets = aFactory.getModelWidgets(); + foreach (ModuleBase_ModelWidget* aWidget, myWidgets) { + initializeWidget(aWidget); + } + + QFrame* aFrame = new QFrame(this); + aFrame->setFrameStyle(QFrame::WinPanel | QFrame::Raised); + aLayout->addWidget(aFrame); + + QVBoxLayout* aBtnLayout = new QVBoxLayout(aFrame); + ModuleBase_Tools::adjustMargins(aBtnLayout); + + QDialogButtonBox* aBtnBox = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, aFrame); + aBtnLayout->addWidget(aBtnBox); + + aBtnBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":pictures/button_ok.png")); + aBtnBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":pictures/button_cancel.png")); + + connect(aBtnBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(aBtnBox, SIGNAL(rejected()), this, SLOT(reject())); + + +} + +void ModuleBase_Dialog::initializeWidget(ModuleBase_ModelWidget* theWidget) +{ + theWidget->setFeature(myFeature); +} + +void ModuleBase_Dialog::showEvent(QShowEvent* theEvent) +{ + QDialog::showEvent(theEvent); + if (myWidgets.length() > 0) + myWidgets.first()->activate(); +} \ No newline at end of file diff --git a/src/ModuleBase/ModuleBase_Dialog.h b/src/ModuleBase/ModuleBase_Dialog.h new file mode 100644 index 000000000..fa54ca256 --- /dev/null +++ b/src/ModuleBase/ModuleBase_Dialog.h @@ -0,0 +1,41 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef ModuleBase_Dialog_H +#define ModuleBase_Dialog_H + +#include "ModuleBase.h" +#include + +#include +#include + + +class ModuleBase_IWorkshop; +class ModuleBase_ModelWidget; + +/** + * \ingroup GUI + * A dialog box which is used for modal dialog box feature interface + */ +class ModuleBase_Dialog : public QDialog +{ + Q_OBJECT +public: + ModuleBase_Dialog(ModuleBase_IWorkshop* theParent, const QString& theId, + const std::string& theDescription); + +protected: + virtual void showEvent(QShowEvent* theEvent); + + +private: + void initializeWidget(ModuleBase_ModelWidget* theWidget); + + QString myId; + std::string myDescription; + ModuleBase_IWorkshop* myWorkshop; + FeaturePtr myFeature; + QList myWidgets; +}; + +#endif diff --git a/src/ModuleBase/ModuleBase_IModule.cpp b/src/ModuleBase/ModuleBase_IModule.cpp index adf2562bd..fa0395ad9 100644 --- a/src/ModuleBase/ModuleBase_IModule.cpp +++ b/src/ModuleBase/ModuleBase_IModule.cpp @@ -9,6 +9,9 @@ #include "ModuleBase_OperationDescription.h" #include "ModuleBase_OperationFeature.h" #include "ModuleBase_ModelWidget.h" +#include "ModuleBase_WidgetFactory.h" +#include "ModuleBase_PageWidget.h" +#include "ModuleBase_Dialog.h" #include @@ -22,6 +25,11 @@ #include #include +#include +#include +#include +#include +#include ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent) : QObject(theParent), myWorkshop(theParent) @@ -41,6 +49,26 @@ ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent) // SLOT(onMouseDoubleClick(QMouseEvent*))); } +void ModuleBase_IModule::launchModal(const QString& theCmdId) +{ + if (!myWorkshop->canStartOperation(theCmdId)) + return; + + std::string aXmlCfg, aDescription; + getXMLRepresentation(theCmdId.toStdString(), aXmlCfg, aDescription); + + SessionPtr aMgr = ModelAPI_Session::get(); + aMgr->startOperation(theCmdId.toStdString()); + + ModuleBase_Dialog aDlg(myWorkshop, theCmdId, aXmlCfg); + if (aDlg.exec() == QDialog::Accepted) + aMgr->finishOperation(); + else + aMgr->abortOperation(); + myWorkshop->updateCommandStatus(); +} + + void ModuleBase_IModule::launchOperation(const QString& theCmdId) { if (!myWorkshop->canStartOperation(theCmdId)) @@ -176,8 +204,14 @@ void ModuleBase_IModule::onFeatureTriggered() } } else { - launchOperation(aCmd->data().toString()); - emit operationLaunched(); + QString aCmdId = aCmd->data().toString(); + std::shared_ptr aInfo = myWorkshop->featureInfo(aCmdId); + if (aInfo.get() && aInfo->isModal()) { + launchModal(aCmdId); + } else { + launchOperation(aCmdId); + emit operationLaunched(); + } } } diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index 8ac4817bc..0ba438d20 100755 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -84,6 +84,10 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// \param theCmdId the operation name virtual void launchOperation(const QString& theCmdId); + /// Executes feature as a modal dialog box + /// \param theCmdId the operation name + virtual void launchModal(const QString& theCmdId); + /// Realizes some functionality by an operation start /// \param theOperation a started operation virtual void operationStarted(ModuleBase_Operation* theOperation) {} diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h index 45284de1b..3d9585930 100644 --- a/src/ModuleBase/ModuleBase_IWorkshop.h +++ b/src/ModuleBase/ModuleBase_IWorkshop.h @@ -13,6 +13,7 @@ #include #include +#include #include @@ -23,6 +24,7 @@ class ModuleBase_IPropertyPanel; class ModuleBase_Operation; class ModuleBase_FilterFactory; class ModuleBase_ViewerPrs; +class QMainWindow; /** * \ingroup GUI @@ -104,6 +106,11 @@ Q_OBJECT /// Update of commands status virtual void updateCommandStatus() = 0; + virtual std::shared_ptr featureInfo(const QString& theId) const = 0; + + virtual QMainWindow* desktop() const = 0; + + signals: /// Signal selection changed. void selectionChanged(); diff --git a/src/ModuleBase/ModuleBase_PageWidget.cpp b/src/ModuleBase/ModuleBase_PageWidget.cpp index 135fe23b7..c351d0af4 100644 --- a/src/ModuleBase/ModuleBase_PageWidget.cpp +++ b/src/ModuleBase/ModuleBase_PageWidget.cpp @@ -9,14 +9,14 @@ #include #include -#include +#include #include ModuleBase_PageWidget::ModuleBase_PageWidget(QWidget* theParent) : QFrame(theParent) { - myMainLayout = new QGridLayout(this); + myMainLayout = new QVBoxLayout(this); ModuleBase_Tools::adjustMargins(myMainLayout); setLayout(myMainLayout); } @@ -27,15 +27,12 @@ ModuleBase_PageWidget::~ModuleBase_PageWidget() void ModuleBase_PageWidget::addPageStretch() { - myMainLayout->setRowStretch(myMainLayout->rowCount(), 1); + myMainLayout->addStretch(1); } void ModuleBase_PageWidget::placeModelWidget(ModuleBase_ModelWidget* theWidget) { - const int kCol = 0; - const int kRow = myMainLayout->count(); - myMainLayout->addWidget(theWidget, kRow, kCol); - myMainLayout->setRowStretch(kRow, 0); + myMainLayout->addWidget(theWidget, 0); } void ModuleBase_PageWidget::placeWidget(QWidget* theWidget) @@ -46,10 +43,7 @@ void ModuleBase_PageWidget::placeWidget(QWidget* theWidget) #endif return; } - const int kCol = 0; - const int kRow = myMainLayout->count(); - myMainLayout->addWidget(theWidget, kRow, kCol); - myMainLayout->setRowStretch(kRow, 0); + myMainLayout->addWidget(theWidget, 0); } QLayout* ModuleBase_PageWidget::pageLayout() diff --git a/src/ModuleBase/ModuleBase_PageWidget.h b/src/ModuleBase/ModuleBase_PageWidget.h index 6ff94ca5e..ca7ba2c2c 100644 --- a/src/ModuleBase/ModuleBase_PageWidget.h +++ b/src/ModuleBase/ModuleBase_PageWidget.h @@ -15,7 +15,7 @@ #include class ModuleBase_ModelWidget; -class QGridLayout; +class QVBoxLayout; /*! * \ingroup GUI @@ -41,7 +41,7 @@ class MODULEBASE_EXPORT ModuleBase_PageWidget : public QFrame, public ModuleBase virtual void addPageStretch(); private: - QGridLayout* myMainLayout; ///< page's layout + QVBoxLayout* myMainLayout; ///< page's layout }; #endif /* MODULEBASE_PAGEWIDGET_H_ */ diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index c774f8952..7e100f94e 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -71,7 +71,7 @@ ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory() delete myWidgetApi; } -void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage) +void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool alignToTop) { std::string aWType = myWidgetApi->widgetType(); if (aWType == NODE_FEATURE) { @@ -132,7 +132,8 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage) } } while (myWidgetApi->toNextWidget()); - thePage->alignToTop(); + if (alignToTop) + thePage->alignToTop(); } void ModuleBase_WidgetFactory::createPanel(ModuleBase_PageBase* thePage, diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h index 96489ce8e..b8ae7b465 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -39,7 +39,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetFactory /// Creates content widget for property panel /// \param thePage a parent page - void createWidget(ModuleBase_PageBase* thePage); + void createWidget(ModuleBase_PageBase* thePage, bool alignToTop = true); /// Creates property panel content for the feature /// \param thePage a parent page diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 0328741fe..d7bf5e111 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -5,11 +5,86 @@ // Author: Vitaly SMETANNIKOV #include "ParametersPlugin_WidgetParamsMgr.h" +#include "ParametersPlugin_Parameter.h" + +#include +#include +#include +#include #include #include #include #include +#include +#include + +enum ColumnType { + Col_Name, + Col_Equation, + Col_Result, + Col_Comment +}; + +class ParametersPlugin_ItemDelegate : public QStyledItemDelegate +{ +public: + ParametersPlugin_ItemDelegate(QObject* thaParent) : + QStyledItemDelegate(thaParent) {} + + virtual void paint(QPainter* painter, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const; + + //virtual QWidget* createEditor(QWidget* parent, + // const QStyleOptionViewItem& option, + // const QModelIndex& index) const; + + bool isEditable(const QModelIndex& theIndex) const; +}; + +bool ParametersPlugin_ItemDelegate::isEditable(const QModelIndex& theIndex) const +{ + QModelIndex aParent = theIndex.parent(); + if (aParent.isValid() && (aParent.row() == 0)) { + if (theIndex.column() == 2) + return false; + } else + return false; + return true; +} + +void ParametersPlugin_ItemDelegate::paint(QPainter* painter, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const +{ + QBrush aBrush = painter->brush(); + QPen aPen = painter->pen(); + if (!isEditable(index)) + painter->setBrush(Qt::lightGray); + + painter->setPen(Qt::darkGray); + painter->drawRect(option.rect); + + QStyledItemDelegate::paint(painter, option, index); + + painter->setPen(aPen); + painter->setBrush(aBrush); +} + + +//QWidget* ParametersPlugin_ItemDelegate::createEditor(QWidget* parent, +// const QStyleOptionViewItem& option, +// const QModelIndex& index) const +//{ +// QWidget* aWgt = QStyledItemDelegate::createEditor(parent, option, index); +// aWgt->setMinimumSize(option.rect.width() - option.decorationSize.width(), +// option.rect.height()); +// return aWgt; +//} + + +///////////////////////////////////////////////////////////////////////////////////////////////// ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData) : ModuleBase_ModelWidget(theParent, theData) @@ -21,8 +96,34 @@ ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theP QStringList aHeaders; aHeaders << tr("Name") << tr("Equation") << tr("Result") << tr("Comment"); myTable->setHeaderLabels(aHeaders); + myTable->setColumnWidth(Col_Name, 200); + myTable->setColumnWidth(Col_Equation, 100); + myTable->setColumnWidth(Col_Result, 80); + myTable->setColumnWidth(Col_Comment, 200); + myTable->setMinimumWidth(600); + myTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + connect(myTable, SIGNAL(doubleClicked(const QModelIndex&)), + SLOT(onDoubleClick(const QModelIndex&))); + //myTable->viewport()->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); + + myDelegate = new ParametersPlugin_ItemDelegate(myTable); + connect(myDelegate, SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)), + SLOT(onCloseEditor(QWidget*, QAbstractItemDelegate::EndEditHint))); + + myTable->setItemDelegate(myDelegate); aLayout->addWidget(myTable); + // Define root nodes + QStringList aNames; + aNames<addTopLevelItem(myParameters); + + aNames.clear(); + aNames<addTopLevelItem(myFeatures); + QHBoxLayout* aBtnLayout = new QHBoxLayout(this); QToolButton* aUpBtn = new QToolButton(this); @@ -60,3 +161,91 @@ bool ParametersPlugin_WidgetParamsMgr::restoreValueCustom() { return true; } + +void ParametersPlugin_WidgetParamsMgr::activateCustom() +{ + FeaturePtr aFeature = feature(); + DocumentPtr aDoc = aFeature->document(); + int aNbParam = aDoc->size(ModelAPI_ResultParameter::group()); + ObjectPtr aObj; + QTreeWidgetItem* aItem; + ResultParameterPtr aParam; + FeaturePtr aParamFeature; + for (int i = 0; i < aNbParam; i++) { + aObj = aDoc->object(ModelAPI_ResultParameter::group(), i); + aParam = std::dynamic_pointer_cast(aObj); + if (aParam.get()) { + aParamFeature = ModelAPI_Feature::feature(aParam); + + QStringList aValues; + aValues << aParamFeature->string(ParametersPlugin_Parameter::VARIABLE_ID())->value().c_str(); + aValues << aParamFeature->string(ParametersPlugin_Parameter::EXPRESSION_ID())->value().c_str(); + + AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE()); + aValues << QString::number(aValueAttribute->value()); + + //AttributeRefListPtr aParams = aParamFeature->reflist(ParametersPlugin_Parameter::ARGUMENTS_ID()); + //std::list aList = aParams->list(); + //std::string aName; + //std::list::iterator aIt; + //for(aIt = aList.begin(); aIt != aList.end(); aIt++) { + // aObj = (*aIt); + // aName = aObj->data()->name(); + //} + aItem = new QTreeWidgetItem(aValues); + aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); + myParameters->addChild(aItem); + + myFeatureList.append(aParamFeature); + + const std::set>& aRefs = aParam->data()->refsToMe(); + std::set >::const_iterator aIt; + for(aIt = aRefs.cbegin(); aIt != aRefs.cend(); aIt++) { + FeaturePtr aReferenced = std::dynamic_pointer_cast((*aIt)->owner()); + if (aReferenced.get()) { + QStringList aValNames; + aValNames << aReferenced->data()->name().c_str(); + + //AttributeDoublePtr aValue = aReferenced->data()->real(SketchPlugin_Constraint::VALUE()); + //aReferenced + aItem = new QTreeWidgetItem(aValNames); + myFeatures->addChild(aItem); + } + } + } + } + myFeatures->setExpanded(true); + myParameters->setExpanded(true); +} + + +void ParametersPlugin_WidgetParamsMgr::onDoubleClick(const QModelIndex& theIndex) +{ + if (myDelegate->isEditable(theIndex)) { + myTable->edit(theIndex); + myEditingIndex = theIndex; + } +} + +void ParametersPlugin_WidgetParamsMgr::onCloseEditor(QWidget* theEditor, + QAbstractItemDelegate::EndEditHint theHint) +{ + if (myEditingIndex.column() == Col_Equation) { + QTreeWidgetItem* aItem = myParameters->child(myEditingIndex.row()); + QString aText = aItem->text(myEditingIndex.column()); + if (!aText.isEmpty()) { + FeaturePtr aFeature = myFeatureList.at(myEditingIndex.row()); + AttributeStringPtr aStringAttr = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ID()); + aStringAttr->setValue(aText.toStdString()); + aFeature->execute(); + ResultParameterPtr aResult = + std::dynamic_pointer_cast(aFeature->firstResult()); + if (aResult.get()) { + AttributeDoublePtr aValueAttribute = + aResult->data()->real(ModelAPI_ResultParameter::VALUE()); + aItem->setText(Col_Result, QString::number(aValueAttribute->value())); + } + } + } + myEditingIndex = QModelIndex(); +} \ No newline at end of file diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h index 22fe78d74..aba839b9f 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h @@ -8,8 +8,12 @@ #define ParametersPlugin_WidgetParamsMgr_H_ #include +#include +#include class QTreeWidget; +class QTreeWidgetItem; +class ParametersPlugin_ItemDelegate; /*! * \ingroup GUI @@ -37,9 +41,22 @@ protected: /// Restore value from attribute data to the widget's control virtual bool restoreValueCustom(); + /// The method called when widget is activated + virtual void activateCustom(); + +private slots: + void onDoubleClick(const QModelIndex&); + void onCloseEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint); + private: QTreeWidget* myTable; + QTreeWidgetItem* myFeatures; + QTreeWidgetItem* myParameters; + ParametersPlugin_ItemDelegate* myDelegate; + QModelIndex myEditingIndex; + + QList myFeatureList; }; diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 345b7a5be..e47f7ef98 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -12,12 +12,16 @@ #include "XGUI_OperationMgr.h" #include "XGUI_Displayer.h" #include "XGUI_PropertyPanel.h" +#include "XGUI_ActionsMgr.h" #include #include #include +#ifndef HAVE_SALOME +#include "AppElements_Command.h" +#endif XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop) : ModuleBase_IWorkshop(theWorkshop), @@ -135,4 +139,23 @@ void XGUI_ModuleConnector::abortOperation(ModuleBase_Operation* theOperation) void XGUI_ModuleConnector::updateCommandStatus() { myWorkshop->updateCommandStatus(); -} \ No newline at end of file +} + +QMainWindow* XGUI_ModuleConnector::desktop() const +{ + return myWorkshop->desktop(); +} + + +std::shared_ptr XGUI_ModuleConnector::featureInfo(const QString& theId) const +{ +#ifdef HAVE_SALOME + return myWorkshop->salomeConnector()->featureInfo(theId); +#else + AppElements_Command* aAction = + dynamic_cast(myWorkshop->actionsMgr()->action(theId)); + if (aAction) + return aAction->featureMessage(); + return std::shared_ptr(); +#endif +} diff --git a/src/XGUI/XGUI_ModuleConnector.h b/src/XGUI/XGUI_ModuleConnector.h index 58afc0aa2..6fc335412 100644 --- a/src/XGUI/XGUI_ModuleConnector.h +++ b/src/XGUI/XGUI_ModuleConnector.h @@ -84,6 +84,14 @@ Q_OBJECT /// Update of commands status virtual void updateCommandStatus(); + /// Returns Information about feature defined in corresponded XML + /// \param theId - id of the feature + virtual std::shared_ptr featureInfo(const QString& theId) const; + + /// Return application main window + virtual QMainWindow* desktop() const; + + //! Returns workshop XGUI_Workshop* workshop() const { return myWorkshop; }