Gui: [skip ci] bind spin boxes to object in Placement dialog

This commit is contained in:
wmayer
2020-03-27 17:08:08 +01:00
parent f501198832
commit 5c4ddf42ee
3 changed files with 23 additions and 0 deletions

View File

@@ -635,6 +635,21 @@ void Placement::on_resetButton_clicked()
onPlacementChanged(0);
}
void Placement::bindObject()
{
if (!selectionObjects.empty()) {
App::DocumentObject* obj = selectionObjects.front().getObject();
ui->xPos->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Base.x")));
ui->yPos->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Base.y")));
ui->zPos->bind(App::ObjectIdentifier::parse(obj, propertyName + std::string(".Base.z")));
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")));
}
}
void Placement::directionActivated(int index)
{
if (ui->directionActivated(this, index)) {
@@ -840,6 +855,11 @@ TaskPlacement::~TaskPlacement()
// automatically deleted in the sub-class
}
void TaskPlacement::bindObject()
{
widget->bindObject();
}
void TaskPlacement::open()
{
widget->open();

View File

@@ -51,6 +51,7 @@ public:
void accept();
void reject();
void bindObject();
Base::Vector3d getDirection() const;
void setPlacement(const Base::Placement&);
Base::Placement getPlacement() const;
@@ -134,6 +135,7 @@ public:
public:
void setPropertyName(const QString&);
void setPlacement(const Base::Placement&);
void bindObject();
bool accept();
bool reject();
void clicked(int id);

View File

@@ -1932,6 +1932,7 @@ void PlacementEditor::browse()
}
task->setPlacement(value().value<Base::Placement>());
task->setPropertyName(propertyname);
task->bindObject();
Gui::Control().showDialog(task);
}