From 952f3b79ad95369c14c41d87107772258b59f2ed Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 17 Jan 2018 18:00:05 +0300 Subject: [PATCH] Issue #2406: Use accept data method from Commit function of an operation --- src/ModuleBase/ModuleBase_IPropertyPanel.h | 3 +++ src/ModuleBase/ModuleBase_OperationFeature.cpp | 1 + src/XGUI/XGUI_PropertyPanel.cpp | 7 ------- src/XGUI/XGUI_PropertyPanel.h | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index 446e0e59b..0ada2eedd 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -83,6 +83,9 @@ public: /// \return a widget or null ModuleBase_ModelWidget* findFirstAcceptingValueWidget(); + /// The method is called on accepting of operation + virtual void onAcceptData() = 0; + /// Returns the first widget, where canAcceptFocus returns true /// \return a widget or null static ModuleBase_ModelWidget* findFirstAcceptingValueWidget( diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 5a37bdd67..c54669495 100755 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -341,6 +341,7 @@ bool ModuleBase_OperationFeature::commit() if (anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) { anActiveWidget->storeValue(); } + aPanel->onAcceptData(); } if (canBeCommitted()) { emit beforeCommitted(); diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 562330de4..33288b465 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -565,13 +565,6 @@ void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr* theMgr) QAction* anAct = theMgr->operationStateAction(aActionIds.at(i)); aBtn->setDefaultAction(anAct); } - // This code is necessary for remembering of user choice in property panel - QToolButton* aBtn = findButton(PROP_PANEL_OK); - if (aBtn) - connect(aBtn->defaultAction(), SIGNAL(triggered(bool)), this, SLOT(onAcceptData())); - aBtn = findButton(PROP_PANEL_OK_PLUS); - if (aBtn) - connect(aBtn->defaultAction(), SIGNAL(triggered(bool)), this, SLOT(onAcceptData())); } void XGUI_PropertyPanel::onAcceptData() diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 4b9ac059a..9a665ba48 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -133,6 +133,9 @@ Q_OBJECT /// \param theIsNext true, if Tab(to the next widget) or false(moving to the previous) bool setFocusNextPrevChild(bool theIsNext); + /// The method is called on accepting of operation + virtual void onAcceptData(); + public slots: /// \brief Update all widgets in property panel with values from the given feature /// \param theFeature a Feature to update values in widgets @@ -160,9 +163,6 @@ public slots: /// \param theWidget the current widget void onActivateNextWidget(ModuleBase_ModelWidget* theWidget); - /// The method is called on accepting of operation - void onAcceptData(); - signals: /// The signal is emitted if the enter is clicked in the control of the widget /// \param theObject a sender of the event -- 2.39.2