Gui: [skip ci] bind spin boxes to object in Placement dialog
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1932,6 +1932,7 @@ void PlacementEditor::browse()
|
||||
}
|
||||
task->setPlacement(value().value<Base::Placement>());
|
||||
task->setPropertyName(propertyname);
|
||||
task->bindObject();
|
||||
Gui::Control().showDialog(task);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user