Also ModuleBase_ModelWidget::restoreValue() emits signals beforeValuesRestored() and afterValuesRestored().
return isDone;
}
+bool ModuleBase_ModelWidget::restoreValue()
+{
+ emit beforeValuesRestored();
+ bool isDone = restoreValueCustom();
+ emit afterValuesRestored();
+
+ return isDone;
+}
+
void ModuleBase_ModelWidget::updateObject(ObjectPtr theObj)
{
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
return false;
}
- /// Restore value from attribute data to the widget's control
- virtual bool restoreValue() = 0;
+ /// Restore value from attribute data to the widget's control. Emits signals before and after store
+ /// \return True in success
+ bool restoreValue();
/// Set focus to the first control of the current widget. The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// The signal about widget values are to be changed
void afterValuesChanged();
+ /// The signal about widget values are to be restored
+ void beforeValuesRestored();
+ /// The signal about widget values are to be restored
+ void afterValuesRestored();
+
/// The signal about key release on the control, that corresponds to the attribute
/// \param theEvent key release event
void keyReleased(QKeyEvent* theEvent);
/// \param theWidget the model base widget
void focusOutWidget(ModuleBase_ModelWidget* theWidget);
- protected:
+protected:
/// Sets default value of widget. Normally, widget should fetch this value
/// from the xml. However, some widgets derived widgets could define it
void setDefaultValue(const std::string& theValue);
/// \return True in success
virtual bool storeValueCustom() const = 0;
+ /// Restore value from attribute data to the widget's control
+ virtual bool restoreValueCustom() = 0;
+
/// The method called when widget is activated
virtual void activateCustom() {};
myIsFocusOnCurrentPage = true;
}
-bool ModuleBase_PagedContainer::restoreValue()
+bool ModuleBase_PagedContainer::restoreValueCustom()
{
// A rare case when plugin was not loaded.
if(!myFeature)
virtual bool focusTo();
virtual void setHighlighted(bool isHighlighted);
virtual void enableFocusProcessing();
- virtual bool restoreValue();
protected:
virtual int currentPageIndex() const = 0;
// ModuleBase_ModelWidget
virtual void activateCustom();
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
protected slots:
void onPageChanged();
return true;
}
-bool ModuleBase_WidgetBoolValue::restoreValue()
+bool ModuleBase_WidgetBoolValue::restoreValueCustom()
{
DataPtr aData = myFeature->data();
std::shared_ptr<ModelAPI_AttributeBoolean> aRef = aData->boolean(attributeID());
virtual ~ModuleBase_WidgetBoolValue();
- virtual bool restoreValue();
-
virtual QList<QWidget*> getControls() const;
virtual void setHighlighted(bool isHighlighted);
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
private:
/// The check box
QCheckBox* myCheckBox;
return true;
}
-bool ModuleBase_WidgetChoice::restoreValue()
+bool ModuleBase_WidgetChoice::restoreValueCustom()
{
DataPtr aData = myFeature->data();
std::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
virtual ~ModuleBase_WidgetChoice();
- virtual bool restoreValue();
-
virtual bool focusTo();
/// Returns list of widget controls
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
private slots:
/// Slot called on combo box index change
void onCurrentIndexChanged(int theIndex);
// if the double value can not be found by the default value, do nothing
if (isOk) {
ModuleBase_Tools::setSpinValue(mySpinBox, aDefValue);
- storeValueCustom();
+ storeValue();
aDone = true;
}
}
return true;
}
-bool ModuleBase_WidgetDoubleValue::restoreValue()
+bool ModuleBase_WidgetDoubleValue::restoreValueCustom()
{
DataPtr aData = myFeature->data();
AttributeDoublePtr aRef = aData->real(attributeID());
/// Fills the widget with default values
virtual bool reset();
- //! Read value of corresponded attribute from data model to the input control
- // \return True in success
- virtual bool restoreValue();
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
/// \return True in success
virtual bool storeValueCustom() const;
+ //! Read value of corresponded attribute from data model to the input control
+ // \return True in success
+ virtual bool restoreValueCustom();
+
protected:
/// Label of the widget
QLabel* myLabel;
return true;
}
-bool ModuleBase_WidgetExprEditor::restoreValue()
+bool ModuleBase_WidgetExprEditor::restoreValueCustom()
{
// A rare case when plugin was not loaded.
if(!myFeature)
const std::string& theParentId);
virtual ~ModuleBase_WidgetExprEditor();
- virtual bool restoreValue();
-
virtual QList<QWidget*> getControls() const;
public slots:
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
private:
/// A line edit control
QLabel* myResultLabel;
return true;
}
-bool ModuleBase_WidgetFileSelector::restoreValue()
+bool ModuleBase_WidgetFileSelector::restoreValueCustom()
{
// A rare case when plugin was not loaded.
if (!myFeature)
const std::string& theParentId);
virtual ~ModuleBase_WidgetFileSelector();
- virtual bool restoreValue();
-
virtual QList<QWidget*> getControls() const;
/// Returns true if a file on the current path in the line edit
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
protected:
/// Converts format to filter string
static QString formatToFilter(const QString & theFormat);
return true;
}
-bool ModuleBase_WidgetIntValue::restoreValue()
+bool ModuleBase_WidgetIntValue::restoreValueCustom()
{
DataPtr aData = myFeature->data();
AttributeIntegerPtr aRef = aData->integer(attributeID());
/// Fills the widget with default values
virtual bool reset();
- //! Read value of corresponded attribute from data model to the input control
- // \return True in success
- virtual bool restoreValue();
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
/// \return True in success
virtual bool storeValueCustom() const;
+ //! Read value of corresponded attribute from data model to the input control
+ // \return True in success
+ virtual bool restoreValueCustom();
+
protected:
/// Label of the widget
QLabel* myLabel;
/// It returns false because this is an info widget
virtual bool canSetValue() const { return false; };
- virtual bool restoreValue()
+ virtual bool restoreValueCustom()
{
return true;
}
return true;
}
-bool ModuleBase_WidgetLineEdit::restoreValue()
+bool ModuleBase_WidgetLineEdit::restoreValueCustom()
{
// A rare case when plugin was not loaded.
if(!myFeature)
const std::string& theParentId);
virtual ~ModuleBase_WidgetLineEdit();
- virtual bool restoreValue();
-
virtual QList<QWidget*> getControls() const;
public slots:
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
private:
/// A line edit control
QLineEdit* myLineEdit;
}
//********************************************************************
-bool ModuleBase_WidgetMultiSelector::restoreValue()
+bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
{
// A rare case when plugin was not loaded.
if(!myFeature)
const std::string& theParentId);
virtual ~ModuleBase_WidgetMultiSelector();
- virtual bool restoreValue();
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
}
//********************************************************************
-bool ModuleBase_WidgetShapeSelector::restoreValue()
+bool ModuleBase_WidgetShapeSelector::restoreValueCustom()
{
bool isBlocked = this->blockSignals(true);
updateSelectionName();
virtual ~ModuleBase_WidgetShapeSelector();
- virtual bool restoreValue();
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
{
}
-bool PartSet_WidgetFileSelector::restoreValue()
+bool PartSet_WidgetFileSelector::restoreValueCustom()
{
// A rare case when plugin was not loaded.
if (!myFeature)
AttributeStringPtr aStringAttr = aData->string("export_file_format");
mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
- return ModuleBase_WidgetFileSelector::restoreValue();
+ return ModuleBase_WidgetFileSelector::restoreValueCustom();
}
bool PartSet_WidgetFileSelector::storeValueCustom() const
virtual ~PartSet_WidgetFileSelector() {}
- /// Reimplemented from ModuleBase_WidgetFileSelector::restoreValue()
- virtual bool restoreValue();
-
protected:
/// Reimplemented from ModuleBase_WidgetFileSelector::storeValueCustom()
virtual bool storeValueCustom() const;
+ /// Reimplemented from ModuleBase_WidgetFileSelector::restoreValue()
+ virtual bool restoreValueCustom();
+
/// Returns a full format string for the short format
QString shortFormatToFullFormat( const QString & theShortFormat ) const;
return true;
}
-bool PartSet_WidgetPoint2D::restoreValue()
+bool PartSet_WidgetPoint2D::restoreValueCustom()
{
std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
const bool theToValidate);
- virtual bool restoreValue();
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
/// The methiod called when widget is activated
virtual void activateCustom();
return aControls;
}
-bool PartSet_WidgetSketchCreator::restoreValue()
+bool PartSet_WidgetSketchCreator::restoreValueCustom()
{
CompositeFeaturePtr aCompFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
virtual ~PartSet_WidgetSketchCreator();
- virtual bool restoreValue();
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
/// \return True in success
virtual bool storeValueCustom() const;
+ virtual bool restoreValueCustom();
+
/// The methiod called when widget is activated
virtual void activateCustom();
virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
const bool theToValidate);
- virtual bool restoreValue()
- {
- return true;
- }
-
/// Returns list of widget controls
/// \return a control list
virtual QList<QWidget*> getControls() const;
return true;
}
+ virtual bool restoreValueCustom()
+ {
+ return true;
+ }
+
/// The methiod called when widget is activated
virtual void activateCustom();