Skip to content

Commit

Permalink
Gui: if an expression is set for Euler angles in the placement dialog…
Browse files Browse the repository at this point in the history
… then evaluate the expression instead of determining the angles from the rotation

See forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=72522
  • Loading branch information
wwmayer committed Oct 26, 2022
1 parent bcc9c66 commit 4d8e615
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Gui/Placement.cpp
Expand Up @@ -658,6 +658,10 @@ void Placement::bindObject()
ui->yawAngle ->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Rotation.Yaw")));
ui->pitchAngle->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Rotation.Pitch")));
ui->rollAngle ->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Rotation.Roll")));

ui->yawAngle->evaluateExpression();
ui->pitchAngle->evaluateExpression();
ui->rollAngle->evaluateExpression();
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/Gui/QuantitySpinBox.cpp
Expand Up @@ -417,6 +417,13 @@ QString Gui::QuantitySpinBox::expressionText() const
return QString();
}

void QuantitySpinBox::evaluateExpression()
{
if (isBound() && getExpression()) {
showValidExpression(Number::SetIfNumber);
}
}

void Gui::QuantitySpinBox::setNumberExpression(App::NumberExpression* expr)
{
lineEdit()->setText(getUserString(expr->getQuantity()));
Expand Down
1 change: 1 addition & 0 deletions src/Gui/QuantitySpinBox.h
Expand Up @@ -108,6 +108,7 @@ class GuiExport QuantitySpinBox : public QAbstractSpinBox, public ExpressionSpin

/// Gets the expression as a string
QString expressionText() const;
void evaluateExpression();

/// Set the number portion selected
void selectNumber();
Expand Down

0 comments on commit 4d8e615

Please sign in to comment.