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&)));
}
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);
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
if (!aPart.get()) { // Probably this is Feature
}
}
if (aPart.get()) { // if this is a part
- SessionPtr aMgr = ModelAPI_Session::get();
+
if (aPart->partDoc() == aMgr->activeDocument()) {
aMgr->setActiveDocument(aMgr->moduleDocument());
} else {
//! Emited on context menu request
void contextMenuRequested(QContextMenuEvent* theEvent);
+ //! Segnal is emitted when user cliks by mouse in header label of object browser
+ void headerMouseDblClicked(const QModelIndex&);
+
protected:
/// Redefinition of virtual method
virtual bool eventFilter(QObject* obj, QEvent* theEvent);