From a8d0fddcc65db1fe234df36354b6735918075a70 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 11 Jun 2014 12:00:23 +0400 Subject: [PATCH] Init feature by model widget factory content The code is moved here to be applyed for all types of features. --- src/ModuleBase/ModuleBase_WidgetFactory.cpp | 6 ------ src/XGUI/XGUI_Workshop.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index e52d5b2d4..239b3eda3 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -155,9 +155,6 @@ QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent) myModelWidgets.append(aDblWgt); - // Init default values - if (!myOperation->isEditOperation()) - aDblWgt->storeValue(myOperation->feature()); return aDblWgt->getControl(); } @@ -207,8 +204,5 @@ QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent) myModelWidgets.append(aBoolWgt); - // Init default values - if (!myOperation->isEditOperation()) - aBoolWgt->storeValue(myOperation->feature()); return aBoolWgt->getControl(); } \ No newline at end of file diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index c4c6ac939..24fea8453 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -317,6 +317,16 @@ void XGUI_Workshop::onOperationStarted() QWidget* aContent = myPropertyPanel->contentWidget(); qDeleteAll(aContent->children()); aFactory.createWidget(aContent); + + // Init default values + if (!aOperation->isEditOperation()) { + QList aWidgets = aFactory.getModelWidgets(); + QList::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end(); + for (; anIt != aLast; anIt++) { + (*anIt)->storeValue(aOperation->feature()); + } + } + myPropertyPanel->setModelWidgets(aFactory.getModelWidgets()); myPropertyPanel->setWindowTitle(aOperation->getDescription()->description()); } -- 2.39.2