]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Parameters management implementation
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 15 Apr 2016 14:03:59 +0000 (17:03 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 19 Apr 2016 07:51:53 +0000 (10:51 +0300)
14 files changed:
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_Dialog.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_Dialog.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_IModule.cpp
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/ModuleBase/ModuleBase_PageWidget.cpp
src/ModuleBase/ModuleBase_PageWidget.h
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.h
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h

index 40de9e2b9dac77f22d69bfcf668e6c0c86f50b94..2553a9506b5497b2894d2a15cab89c5a61b92333 100644 (file)
@@ -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 (file)
index 0000000..db3799b
--- /dev/null
@@ -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 <ModelAPI_Session.h>
+
+#include <QMainWindow>
+#include <QLayout>
+#include <QDialogButtonBox>
+#include <QPushButton>
+
+
+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<ModelAPI_Document> 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 (file)
index 0000000..fa54ca2
--- /dev/null
@@ -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 <ModelAPI_Feature.h>
+
+#include <QDialog>
+#include <string>
+
+
+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<ModuleBase_ModelWidget*> myWidgets;
+};
+
+#endif
index adf2562bde77e49e3908d431eb746ed5fd613a33..fa0395ad9462eafc374d70d71a4ef75486ff5df9 100644 (file)
@@ -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 <Events_Loop.h>
 
 #include <Config_ModuleReader.h>
 
 #include <QAction>
+#include <QMainWindow>
+#include <QDialog>
+#include <QLayout>
+#include <QDialogButtonBox>
+#include <QPushButton>
 
 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<Config_FeatureMessage> aInfo = myWorkshop->featureInfo(aCmdId);
+    if (aInfo.get() && aInfo->isModal()) {
+      launchModal(aCmdId);
+    } else {
+      launchOperation(aCmdId);
+      emit operationLaunched();
+    }
   }
 }
 
index 8ac4817bce5d8260faa29be77c1f9310c5c09953..0ba438d20eed5be7f33df8beae405ff98f38ce39 100755 (executable)
@@ -84,6 +84,10 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theCmdId the operation name\r
   virtual void launchOperation(const QString& theCmdId);\r
 \r
+  /// Executes feature as a modal dialog box\r
+  /// \param theCmdId the operation name\r
+  virtual void launchModal(const QString& theCmdId);\r
+\r
   /// Realizes some functionality by an operation start\r
   /// \param theOperation a started operation\r
   virtual void operationStarted(ModuleBase_Operation* theOperation) {}\r
index 45284de1bd2542f646356718eafa3272429e6448..3d95859305485833272bc7d848dcd47d23e02318 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <ModelAPI_Object.h>
 #include <GeomAPI_AISObject.h>
+#include <Config_FeatureMessage.h>
 
 #include <QObject>
 
@@ -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<Config_FeatureMessage> featureInfo(const QString& theId) const = 0;
+
+  virtual QMainWindow* desktop() const = 0;
+
+
 signals:
   /// Signal selection changed.
   void selectionChanged();
index 135fe23b78b0e9de603917de390e4df36cd0d202..c351d0af404ae7b599281d618bc3bfb7fc784402 100644 (file)
@@ -9,14 +9,14 @@
 #include <ModuleBase_ModelWidget.h>
 #include <ModuleBase_Tools.h>
 
-#include <QGridLayout>
+#include <QLayout>
 
 #include <iostream>
 
 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()
index 6ff94ca5ee35b7ef544fc5c5abfca7479ab4da72..ca7ba2c2c6e5ec3f99a98a4d6b9a632449781a72 100644 (file)
@@ -15,7 +15,7 @@
 #include <QList>
 
 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_ */
index c774f89521261c79ccc6e2bf171c31533074ec99..7e100f94efc99419002b3e01e7c87923c5d39c0a 100644 (file)
@@ -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,
index 96489ce8e52ba0129700a5b5c81b6bb54959b5fb..b8ae7b465c0c9ae16009842ec50153016a9344fc 100644 (file)
@@ -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
index 0328741feaeb7d28f015a09093956a8e7bc8ca8e..d7bf5e1112d57772b75e8dff7fdd01ddf0b2c0e4 100644 (file)
@@ -5,11 +5,86 @@
 // Author:      Vitaly SMETANNIKOV
 
 #include "ParametersPlugin_WidgetParamsMgr.h"
+#include "ParametersPlugin_Parameter.h"
+
+#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_AttributeDouble.h>
 
 #include <QLayout>
 #include <QTreeWidget>
 #include <QPushButton>
 #include <QToolButton>
+#include <QStyledItemDelegate>
+#include <QPainter>
+
+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<<tr("Parameters");
+  myParameters = new QTreeWidgetItem(aNames);
+  myTable->addTopLevelItem(myParameters);
+
+  aNames.clear();
+  aNames<<tr("Features");
+  myFeatures = new QTreeWidgetItem(aNames);
+  myTable->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<ModelAPI_ResultParameter>(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<ObjectPtr> aList = aParams->list();
+      //std::string aName;
+      //std::list<ObjectPtr>::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<std::shared_ptr<ModelAPI_Attribute>>& aRefs = aParam->data()->refsToMe();
+      std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aIt;
+      for(aIt = aRefs.cbegin(); aIt != aRefs.cend(); aIt++) {
+        FeaturePtr aReferenced = std::dynamic_pointer_cast<ModelAPI_Feature>((*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<ModelAPI_ResultParameter>(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
index 22fe78d74a63925651655dc1dc427dd6aaffcb17..aba839b9ff68d673d3c350ba878899b7d1a7c39e 100644 (file)
@@ -8,8 +8,12 @@
 #define ParametersPlugin_WidgetParamsMgr_H_
 
 #include <ModuleBase_ModelWidget.h>
+#include <QModelIndex>
+#include <QAbstractItemDelegate>
 
 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<FeaturePtr> myFeatureList;
 };
 
 
index 345b7a5bebbe73da781e50bfd56e4a2e2ddf4f50..e47f7ef9853dedea1063b9be40c5ddd3faa92e79 100644 (file)
 #include "XGUI_OperationMgr.h"
 #include "XGUI_Displayer.h"
 #include "XGUI_PropertyPanel.h"
+#include "XGUI_ActionsMgr.h"
 
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_ViewerPrs.h>
 
 #include <AIS_Shape.hxx>
 
+#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<Config_FeatureMessage> XGUI_ModuleConnector::featureInfo(const QString& theId) const
+{
+#ifdef HAVE_SALOME
+  return myWorkshop->salomeConnector()->featureInfo(theId);
+#else 
+  AppElements_Command* aAction = 
+    dynamic_cast<AppElements_Command*>(myWorkshop->actionsMgr()->action(theId));
+  if (aAction)
+    return aAction->featureMessage();
+  return std::shared_ptr<Config_FeatureMessage>();
+#endif
+}
index 58afc0aa29502ffa87b2ca021efb67fa33273b11..6fc335412048cec2f0445f3057b1f509607bc8d9 100644 (file)
@@ -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<Config_FeatureMessage> featureInfo(const QString& theId) const;
+
+  /// Return application main window
+  virtual QMainWindow* desktop() const;
+
+
   //! Returns workshop
   XGUI_Workshop* workshop() const { return myWorkshop; }