]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #565: Restore double click event for object browser header
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 28 May 2015 14:41:33 +0000 (17:41 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 28 May 2015 14:41:33 +0000 (17:41 +0300)
src/PartSet/PartSet_Module.cpp

index 90fded22d857738709120457e8eef8ccb84573f8..8476879f15390da243419a3a981793e23ffc68d8 100644 (file)
@@ -666,6 +666,8 @@ void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser)
     aOB->treeView()->setExpandsOnDoubleClick(false);
     connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)), 
       SLOT(onTreeViewDoubleClick(const QModelIndex&)));
+    connect(aOB, SIGNAL(headerMouseDblClicked(const QModelIndex&)), 
+      SLOT(onTreeViewDoubleClick(const QModelIndex&)));
     connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)), 
       myDataModel, SLOT(onMouseDoubleClick(const QModelIndex&)));
   }
@@ -765,6 +767,11 @@ void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMess
 
 void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
 {
+  SessionPtr aMgr = ModelAPI_Session::get();
+  if (!theIndex.isValid()) {
+    aMgr->setActiveDocument(aMgr->moduleDocument());
+    return;
+  }
   if (theIndex.column() != 0) // Use only first column
     return;
   ObjectPtr aObj = myDataModel->object(theIndex);
@@ -776,7 +783,6 @@ void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
     }
   }
   if (aPart.get()) { // if this is a part
-    SessionPtr aMgr = ModelAPI_Session::get();
     if (aPart->partDoc() == aMgr->activeDocument()) {
       aMgr->setActiveDocument(aMgr->moduleDocument());
     } else {