From 641932ae44c7da06fe38a7689cfa7369452d47e9 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 11 Jun 2014 19:00:01 +0400 Subject: [PATCH] There was discovered a logic, that the feature is created in the operation, after the operation can perform some actions for feature and after, outside, the property panel widgets are created and the feature is initialized by the control default values. The problem with the Sketch creation line operation, which need to fill the property start point by the last point of another feature. The functionality the operation done in the startOperation() virtual method. After, the property panel throw down the values set. The decision is to redesign the operation-widget_factory-property panel functionality in order to set the default values to the feature at the moment of a new feature creation. --- src/ModuleBase/ModuleBase_IOperation.h | 3 --- src/ModuleBase/ModuleBase_Operation.cpp | 16 ---------------- src/ModuleBase/ModuleBase_Operation.h | 3 --- src/ModuleBase/ModuleBase_WidgetFactory.cpp | 17 ++--------------- src/ModuleBase/ModuleBase_WidgetFactory.h | 1 - 5 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IOperation.h b/src/ModuleBase/ModuleBase_IOperation.h index 4af5c227f..a936a6f10 100644 --- a/src/ModuleBase/ModuleBase_IOperation.h +++ b/src/ModuleBase/ModuleBase_IOperation.h @@ -106,9 +106,6 @@ public slots: void setRunning(bool theState); // Data model methods. - /// Stores a real value in model. - /// \param theValue - to store - virtual void storeReal(double theValue) = 0; /// Stores a custom value in model. virtual void storeCustomValue() = 0; diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 52b23a92c..3a5364fe8 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -47,22 +47,6 @@ bool ModuleBase_Operation::isNestedOperationsEnabled() const return true; } -void ModuleBase_Operation::storeReal(double theValue) -{ - if(!myFeature){ - #ifdef _DEBUG - qDebug() << "ModuleBase_Operation::storeReal: " << - "trying to store value without opening a transaction."; - #endif - return; - } - QString anId = sender()->objectName(); - boost::shared_ptr aData = myFeature->data(); - boost::shared_ptr aReal = aData->real(anId.toStdString()); - aReal->setValue(theValue); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED)); -} - void ModuleBase_Operation::storeCustomValue() { if(!myFeature){ diff --git a/src/ModuleBase/ModuleBase_Operation.h b/src/ModuleBase/ModuleBase_Operation.h index a526655a2..6e5830bd7 100644 --- a/src/ModuleBase/ModuleBase_Operation.h +++ b/src/ModuleBase/ModuleBase_Operation.h @@ -63,9 +63,6 @@ public: virtual bool isNestedOperationsEnabled() const; // Data model methods. - /// Stores a real value in model. - /// \param theValue - to store - void storeReal(double theValue); /// Stores a custom value in model. void storeCustomValue(); diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.cpp b/src/ModuleBase/ModuleBase_WidgetFactory.cpp index 239b3eda3..03a715f23 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFactory.cpp @@ -161,25 +161,12 @@ QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent) QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent) { ModuleBase_WidgetPoint2D* aWidget = new ModuleBase_WidgetPoint2D(theParent, myWidgetApi); - connectWidget(aWidget, WDG_POINT_SELECTOR); + QObject::connect(aWidget, SIGNAL(valuesChanged()), myOperation, SLOT(storeCustomValue())); + myModelWidgets.append(aWidget); return aWidget->getControl(); } -bool ModuleBase_WidgetFactory::connectWidget(QObject* theWidget, const QString& theType) -{ - bool result = false; - if (theType == WDG_DOUBLEVALUE) { - result = QObject::connect(theWidget, SIGNAL(valueChanged(double)), - myOperation, SLOT(storeReal(double))); - } - if (theType == WDG_POINT_SELECTOR) { - result = QObject::connect(theWidget, SIGNAL(valuesChanged()), - myOperation, SLOT(storeCustomValue())); - } - return result; -} - QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const { return QString::fromStdString(theStdString); diff --git a/src/ModuleBase/ModuleBase_WidgetFactory.h b/src/ModuleBase/ModuleBase_WidgetFactory.h index e20fd2d9c..13f16601b 100644 --- a/src/ModuleBase/ModuleBase_WidgetFactory.h +++ b/src/ModuleBase/ModuleBase_WidgetFactory.h @@ -43,7 +43,6 @@ protected: QWidget* selectorControl(QWidget* theParent); QWidget* booleanControl(QWidget* theParent); - bool connectWidget(QObject*, const QString&); QString qs(const std::string& theStdString) const; private: -- 2.39.2