From 7ea333c8e98892f3231c16fb191d1d425dfcc8eb Mon Sep 17 00:00:00 2001 From: sbh Date: Thu, 25 Sep 2014 18:32:39 +0400 Subject: [PATCH] Issue #144 Proper update of property pannel title --- src/XGUI/XGUI_OperationMgr.cpp | 9 ++++++++- src/XGUI/XGUI_OperationMgr.h | 3 +++ src/XGUI/XGUI_Workshop.cpp | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index b47463fc6..80b540a24 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -26,9 +26,16 @@ ModuleBase_Operation* XGUI_OperationMgr::currentOperation() const return myOperations.count() > 0 ? myOperations.last() : 0; } +bool XGUI_OperationMgr::isCurrentOperation(ModuleBase_Operation* theOperation) +{ + if(!hasOperation()) + return false; + return currentOperation() == theOperation; +} + bool XGUI_OperationMgr::hasOperation() const { - return (myOperations.count() > 0) && (myOperations.last() != NULL); + return !myOperations.isEmpty() && (myOperations.last() != NULL); } int XGUI_OperationMgr::operationsCount() const diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index b028731a4..6307ce44d 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -37,6 +37,9 @@ Q_OBJECT /// Returns the current operation or NULL /// \return the current operation ModuleBase_Operation* currentOperation() const; + /// Check if the given operation is active operation. + /// Also, returns false is ther is no active operation. + bool isCurrentOperation(ModuleBase_Operation* theOperation); /// Returns true is operation manager has at least one non-null operation. bool hasOperation() const; /// Returns number of operations in the stack diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index a44680d89..899c23227 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -505,7 +505,11 @@ void XGUI_Workshop::onOperationStarted() myPropertyPanel->setModelWidgets(aWidgets); myPropertyPanel->onActivateNextWidget(NULL); - myPropertyPanel->setWindowTitle(aOperation->getDescription()->description()); + // Widget activation (from the previous method) may commit the current operation + // if pre-selection is enougth for it. So we shouldn't update prop panel's title + if(myOperationMgr->isCurrentOperation(aOperation)) { + myPropertyPanel->setWindowTitle(aOperation->getDescription()->description()); + } } updateCommandStatus(); } -- 2.39.2