]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Create DataModel in object browser constructor
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 24 Aug 2015 07:59:26 +0000 (10:59 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 24 Aug 2015 07:59:41 +0000 (10:59 +0300)
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_Workshop.cpp

index 58e5fb3deb0ac43294b6e69fb9a9d5303bd4ecd2..4846e2237b2d4d5b6aa31f011880f9dc28bcda5a 100644 (file)
@@ -221,6 +221,14 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
   aLabelWgt->setFrameShape(myTreeView->frameShape());
   aLabelWgt->setFrameShadow(myTreeView->frameShadow());
 
+#ifndef ModuleDataModel
+  myDocModel = new XGUI_DataModel(this);
+  myTreeView->setModel(myDocModel);
+  QItemSelectionModel* aSelMod = myTreeView->selectionModel();
+  connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+          this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
+#endif
+
   connect(myActiveDocLbl, SIGNAL(customContextMenuRequested(const QPoint&)), this,
           SLOT(onLabelContextMenuRequested(const QPoint&)));
   connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
@@ -376,18 +384,17 @@ void XGUI_ObjectsBrowser::clearContent()
   myTreeView->clear(); 
 }
 
+#ifdef ModuleDataModel
 void XGUI_ObjectsBrowser::setDataModel(ModuleBase_IDocumentDataModel* theModel)
 {
-#ifdef ModuleDataModel
   myDocModel = theModel;
-#else
-  myDocModel = new XGUI_DataModel(this);
-#endif
+  //myDocModel = new XGUI_DataModel(this);
   myTreeView->setModel(myDocModel);
   QItemSelectionModel* aSelMod = myTreeView->selectionModel();
   connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
           this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
 }
+#endif
 
 void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& theSelected,
                                        const QItemSelection& theDeselected)
index 2c36641bc1247bdc1d67100fe2a4ee42926a77d5..d92788abecde6f02730041ba7202c3690b3c1b5b 100644 (file)
@@ -114,7 +114,9 @@ Q_OBJECT
   void clearContent();
 
   /// Set Data Model for the Object Browser
+#ifdef ModuleDataModel
   void setDataModel(ModuleBase_IDocumentDataModel* theModel);
+#endif
 
 public slots:
   //! Called on Edit command request
index bdfd1b2d50c3a8e7c032d24d2c36d38ccac7b3ca..933c8f39551fce996f26b941efaa0959c0efd570 100644 (file)
@@ -900,7 +900,9 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
   aObjDock->setStyleSheet(
       "::title { position: relative; padding-left: 5px; text-align: left center }");
   myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
+#ifdef ModuleDataModel
   myObjectBrowser->setDataModel(myModule->dataModel());
+#endif
   myModule->customizeObjectBrowser(myObjectBrowser);
   aObjDock->setWidget(myObjectBrowser);