From cf8f82e87c5bec5bef69549ce628bfdb093b92a1 Mon Sep 17 00:00:00 2001 From: spo Date: Mon, 21 Dec 2015 15:00:57 +0300 Subject: [PATCH] Issue #1157: Using parameters in point coordinates --- src/Config/Config_Keywords.h | 1 + .../ModuleBase_WidgetDoubleValue.cpp | 3 +++ src/PartSet/PartSet_WidgetPoint2d.cpp | 4 ++++ src/SketchPlugin/plugin-Sketch.xml | 18 +++++++++--------- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 7bbeef48e..609d7907a 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -80,6 +80,7 @@ const static char* DOUBLE_WDG_MIN = "min"; const static char* DOUBLE_WDG_MAX = "max"; const static char* DOUBLE_WDG_STEP = "step"; const static char* DOUBLE_WDG_DEFAULT_COMPUTED = "computed"; +const static char* DOUBLE_WDG_ACCEPT_EXPRESSIONS = "accept_expressions"; // WDG_TOOLBOX/WDG_SWITCH properties const static char* CONTAINER_PAGE_NAME = "title"; const static char* CONTAINER_PAGE_ICON = "icon"; diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index bd42f7844..141abdd39 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -45,7 +45,10 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, if (!aLabelIcon.isEmpty()) myLabel->setPixmap(QPixmap(aLabelIcon)); + bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + mySpinBox = new ModuleBase_ParamSpinBox(this); + mySpinBox->setAcceptVariables(aAcceptVariables); QString anObjName = QString::fromStdString(attributeID()); mySpinBox->setObjectName(anObjName); diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 1e9f5f685..5af914ad3 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -71,6 +71,8 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myGroupBox = new QGroupBox(aPageName, theParent); myGroupBox->setFlat(false); + bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); + QGridLayout* aGroupLay = new QGridLayout(myGroupBox); ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setSpacing(2); @@ -81,6 +83,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, aGroupLay->addWidget(aLabel, 0, 0); myXSpin = new ModuleBase_ParamSpinBox(myGroupBox); + myXSpin->setAcceptVariables(aAcceptVariables); myXSpin->setMinimum(-DBL_MAX); myXSpin->setMaximum(DBL_MAX); myXSpin->setToolTip(tr("X")); @@ -94,6 +97,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, aGroupLay->addWidget(aLabel, 1, 0); myYSpin = new ModuleBase_ParamSpinBox(myGroupBox); + myYSpin->setAcceptVariables(aAcceptVariables); myYSpin->setMinimum(-DBL_MAX); myYSpin->setMaximum(DBL_MAX); myYSpin->setToolTip(tr("Y")); diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index b38f14995..eaf7601d3 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -18,26 +18,26 @@ - + - - + + - - + + - - - + + + @@ -47,7 +47,7 @@ label="Point" tooltip="Select point for fillet (should be shared by two entities only)" shape_types="vertex"> - + -- 2.39.2