Gui: bind spin boxes of Placement dialog when opening it via menu

This commit is contained in:
wmayer
2022-10-27 19:30:24 +02:00
parent 39b28c8a27
commit 5cc9bae455
2 changed files with 25 additions and 4 deletions

View File

@@ -1498,8 +1498,19 @@ void StdCmdPlacement::activated(int iMsg)
auto plm = new Gui::Dialog::TaskPlacement();
if (!sel.empty()) {
App::Property* prop = sel.front()->getPropertyByName("Placement");
if (prop && prop->getTypeId() == App::PropertyPlacement::getClassTypeId())
if (prop && prop->getTypeId() == App::PropertyPlacement::getClassTypeId()) {
plm->setPlacement(static_cast<App::PropertyPlacement*>(prop)->getValue());
std::vector<Gui::SelectionObject> selection;
selection.reserve(sel.size());
std::transform(sel.cbegin(), sel.cend(), std::back_inserter(selection), [](App::DocumentObject* obj) {
return Gui::SelectionObject(obj);
});
plm->setPropertyName(QLatin1String("Placement"));
plm->setSelection(selection);
plm->bindObject();
}
}
Gui::Control().showDialog(plm);
}