From 68b9a069e588359867bc012f9576a13108ebfcdb Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 15 Feb 2016 16:06:11 +0300 Subject: [PATCH] Boolean correction: clean the validation cash by other widget value change if it can not set value. --- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 7 +++++ src/ModuleBase/ModuleBase_WidgetValidated.h | 3 +++ src/XGUI/XGUI_Workshop.cpp | 27 ++++++++++++++++++- src/XGUI/XGUI_Workshop.h | 4 +++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index 0dab2cee1..89315cd4b 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -60,6 +60,13 @@ ObjectPtr ModuleBase_WidgetValidated::findPresentedObject(const AISObjectPtr& th return myPresentedObject; } +//******************************************************************** +void ModuleBase_WidgetValidated::clearValidatedCash() +{ + myValidPrs.clear(); + myInvalidPrs.clear(); +} + //******************************************************************** void ModuleBase_WidgetValidated::storeAttributeValue() { diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index 60ed4edc9..ecd107e99 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -67,6 +67,9 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg //! Returns data object by AIS ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const; + //! Clear all validated cash in the widget + void clearValidatedCash(); + protected: /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index eebe7c38b..feb5405db 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -66,6 +66,8 @@ #include #include #include +#include +#include #include #include @@ -621,11 +623,13 @@ void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect) const QList& aWidgets = aPropertyPanel->modelWidgets(); foreach (ModuleBase_ModelWidget* aWidget, aWidgets) { myModule->connectToPropertyPanel(aWidget, isToConnect); - if (isToConnect) { + if (isToConnect) { connect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int))); + connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged())); } else { disconnect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int))); + disconnect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged())); } } } @@ -898,6 +902,27 @@ void XGUI_Workshop::onWidgetStateChanged(int thePreviousState) myModule->widgetStateChanged(thePreviousState); } +//****************************************************** +void XGUI_Workshop::onValuesChanged() +{ + ModuleBase_ModelWidget* aSenderWidget = (ModuleBase_ModelWidget*)(sender()); + if (!aSenderWidget || aSenderWidget->canSetValue()) + return; + + ModuleBase_ModelWidget* anActiveWidget = 0; + ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); + if (anOperation) { + ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + if (aPanel) + anActiveWidget = aPanel->activeWidget(); + } + if (anActiveWidget) { + ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast + (anActiveWidget); + aWidgetValidated->clearValidatedCash(); + } +} + ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule) { QString libName = QString::fromStdString(library(theModule.toStdString())); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 66c08f085..00245d70e 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -307,6 +307,10 @@ signals: /// \param thePreviousState the previous state of the widget void onWidgetStateChanged(int thePreviousState); + /// Calls activate of the current widget again. It is possible that selection filters are + /// differs in the new state of paged container + void onValuesChanged(); + /// Show property panel void showPropertyPanel(); -- 2.39.2