Added read-only 'expression' property to QunatitySpinBox and renamed 'boundTo' to 'binding'.
This commit is contained in:
@@ -328,8 +328,18 @@ void QuantitySpinBox::setBoundToByName(const QString &qstr)
|
||||
}
|
||||
}
|
||||
|
||||
void Gui::QuantitySpinBox::onChange() {
|
||||
|
||||
QString Gui::QuantitySpinBox::expressionText() const
|
||||
{
|
||||
Q_D(const QuantitySpinBox);
|
||||
if (isBound()) {
|
||||
return QString::fromStdString(getExpressionString());
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
void Gui::QuantitySpinBox::onChange()
|
||||
{
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
if (getExpression()) {
|
||||
|
||||
@@ -45,7 +45,8 @@ class GuiExport QuantitySpinBox : public QAbstractSpinBox, public ExpressionBind
|
||||
Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
|
||||
Q_PROPERTY(double rawValue READ rawValue WRITE setValue NOTIFY valueChanged)
|
||||
Q_PROPERTY(Base::Quantity value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
Q_PROPERTY(QString boundTo READ boundToName WRITE setBoundToByName)
|
||||
Q_PROPERTY(QString binding READ boundToName WRITE setBoundToByName)
|
||||
Q_PROPERTY(QString expression READ expressionText)
|
||||
|
||||
public:
|
||||
using ExpressionBinding::apply;
|
||||
@@ -95,6 +96,9 @@ public:
|
||||
/// Sets the path of the bound property
|
||||
void setBoundToByName(const QString &path);
|
||||
|
||||
/// Gets the expression as a string
|
||||
QString expressionText() const;
|
||||
|
||||
/// Set the number portion selected
|
||||
void selectNumber();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user