Skip to content

Commit

Permalink
PD: [skip ci] fixes #4573: missing bindings to expressions in primiti…
Browse files Browse the repository at this point in the history
…ves location dialog
  • Loading branch information
wwmayer committed Feb 20, 2021
1 parent dd4874d commit 7405dd0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Mod/Part/Gui/DlgPrimitives.cpp
Expand Up @@ -1832,6 +1832,14 @@ Location::Location(QWidget* parent, Part::Feature* feature)
// the angle is rad, transform it for display to degrees
ui->AngleQSB->setValue(Base::toDegrees<double>(rotationAngle));

ui->XPositionQSB->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Base.x")));

This comment has been minimized.

Copy link
@donovaly

donovaly Feb 20, 2021

Member

Many thanks for the quick fix, however, when creating a new primitive (menu Part->Create Primitives) the location dialog still shows no bindings. The bindings are only there for existing primitives. I tried to fix this but it seems that in contrary to PD the primitive is not yet created so nothing can be bound at creation times. I think we need to create the primitive, then we can also offer a preview like in PD and then we can offer bindings at creation time. -> FC 0.20 stuff

ui->YPositionQSB->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Base.y")));
ui->ZPositionQSB->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Base.z")));
ui->XDirectionEdit->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Rotation.Axis.x")));
ui->YDirectionEdit->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Rotation.Axis.y")));
ui->ZDirectionEdit->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Rotation.Axis.z")));
ui->AngleQSB->bind(App::ObjectIdentifier::parse(feature, std::string("Placement.Rotation.Angle")));

//connect signals
connect(ui->XPositionQSB, SIGNAL(valueChanged(double)), this, SLOT(onChangePosRot()));
connect(ui->YPositionQSB, SIGNAL(valueChanged(double)), this, SLOT(onChangePosRot()));
Expand Down

2 comments on commit 7405dd0

@wwmayer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bindings are only there for existing primitives

When opening the dialog no part feature exists whose properties could be bound.

I think we need to create the primitive, then we can also offer a preview like in PD and then we can offer bindings at creation time.

The Part dialog works slightly different to the PD counterpart. It allows you to quickly create several primitives in one go while that of PD doesn't.

@donovaly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Part dialog works slightly different to the PD counterpart. It allows you to quickly create several primitives in one go while that of PD doesn't.

I understand that but I don't understand why the primitive cannot yet be created to provide a preview. This would not affect the feature to create several primitives in a row. When the user presses cancel it will be deleted, so in fact I don't see that much difference to PD's primitive creation dialog.

Please sign in to comment.