From 84bb5038b9d179fc8c22ced4339a137df5212b0e Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 15 Sep 2014 12:00:09 +0400 Subject: [PATCH] Activate part on mouse double click. --- src/XGUI/XGUI_DocumentDataModel.cpp | 2 +- src/XGUI/XGUI_ObjectsBrowser.cpp | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index feb3c0b5e..d74163c71 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -477,7 +477,7 @@ bool XGUI_DocumentDataModel::activatedIndex(const QModelIndex& theIndex) myActivePart->setItemsColor(ACTIVE_COLOR); myModel->setItemsColor(PASSIVE_COLOR); } else - myModel->setItemsColor(ACTIVE_COLOR); + myModel->setItemsColor(ACTIVE_COLOR); return true; } } diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 9cd3bc933..9325c8afb 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -57,16 +57,10 @@ void XGUI_DataTree::mouseDoubleClickEvent(QMouseEvent* theEvent) if (theEvent->button() == Qt::LeftButton) { QModelIndex aIndex = currentIndex(); XGUI_DocumentDataModel* aModel = dataModel(); - - if ((aModel->activePartIndex() != aIndex) && aModel->activePartIndex().isValid()) { - setExpanded(aModel->activePartIndex(), false); - } - bool isChanged = aModel->activatedIndex(aIndex); - QTreeView::mouseDoubleClickEvent(theEvent); - if (isChanged) { - if (aModel->activePartIndex().isValid()) - setExpanded(aIndex, true); - emit activePartChanged(aModel->activePart()); + ObjectPtr aObject = aModel->object(aIndex); + ResultPartPtr aPart = boost::dynamic_pointer_cast(aObject); + if (aPart) { + aPart->activate(); } } else QTreeView::mouseDoubleClickEvent(theEvent); -- 2.39.2