Undoes the modification of the isEdit state of operation using. The default value of the feature is set after the operation is started
Edit for a second line creation. This is not edit operation, but the property widget value should not be applyed to the line.
#include <QWidget>
ModuleBase_ModelWidget::ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData)
- : QObject(theParent)
+ : QObject(theParent), myHasDefaultValue(false)
{
myAttributeID = theData ? theData->widgetId() : "";
}
{
return myAttributeID;
}
+
+void ModuleBase_ModelWidget::setHasDefaultValue(const bool& theHasDefaultValue)
+{
+ myHasDefaultValue = theHasDefaultValue;
+}
/// \return a control list
virtual QList<QWidget*> getControls() const = 0;
+ /// Returns whether the control has a default value
+ /// \return a boolean value
+ bool hasDefaultValue() const { return myHasDefaultValue; }
+
signals:
/// The signal about widget values changed
void valuesChanged();
/// \returns the string value
std::string attributeID() const;
+ /// Sets the has default value state to the widget
+ /// \param theHasDefaultValue the boolean value
+ void setHasDefaultValue(const bool& theHasDefaultValue);
+
private:
+ bool myHasDefaultValue; /// the boolean state whether the control has a default value
std::string myAttributeID; /// the attribute name of the model feature
};
void ModuleBase_Operation::setEditingFeature(FeaturePtr theFeature)
{
- myFeature = theFeature;
+ setFeature(theFeature);
myIsEditing = true;
}
/// \returns the created feature
virtual FeaturePtr createFeature(const bool theFlushMessage = true);
+private:
/// Sets the operation feature
void setFeature(FeaturePtr theFeature);
aProp = theData->getProperty(DOUBLE_WDG_DFLT);
double aDefVal = QString::fromStdString(aProp).toDouble(&isOk);
+ setHasDefaultValue(isOk);
if (isOk) {
mySpinBox->setValue(aDefVal);
}
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted)
{
- setFeature(theFeature);
+ setEditingFeature(theFeature);
myFeaturePrs->init(theFeature);
/*
void PartSet_OperationEditConstraint::startOperation()
{
- // do nothing in order to do not create a new feature
+ PartSet_OperationSketchBase::startOperation();
emit multiSelectionEnabled(false);
//if (myFeatures.size() > 1)
const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& theHighlighted)
{
- setFeature(theFeature);
+ setEditingFeature(theFeature);
if (!theHighlighted.empty()) {
// if there is highlighted object, we check whether it is in the list of selected objects
void PartSet_OperationEditFeature::startOperation()
{
- // do nothing in order to do not create a new feature
+ PartSet_OperationSketchBase::startOperation();
emit multiSelectionEnabled(false);
if (myFeatures.size() > 1)
const std::list<XGUI_ViewerPrs>& /*theSelected*/,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
- setFeature(theFeature);
+ if (theFeature)
+ setEditingFeature(theFeature);
}
FeaturePtr PartSet_OperationSketch::sketch() const
void PartSet_OperationSketch::startOperation()
{
- if (!feature()) {
- setFeature(createFeature());
+ PartSet_OperationSketchBase::startOperation();
+ if (!isEditOperation())
emit fitAllView();
- }
}
bool PartSet_OperationSketch::hasSketchPlane() const
aWidget = *anIt;
QObject::connect(aWidget, SIGNAL(valuesChanged()), aOperation, SLOT(storeCustomValue()));
// Init default values
- if (!aOperation->isEditOperation()) {
+ if (!aOperation->isEditOperation() && aWidget->hasDefaultValue()) {
aWidget->storeValue(aOperation->feature());
}
}