Gui: bind spin boxes of Placement dialog when opening it via menu
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -156,8 +156,13 @@ void Placement::setupSignalMapper()
|
||||
signalMapper->setMapping(it, id++);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,15,0)
|
||||
connect(signalMapper, qOverload<int>(&QSignalMapper::mapped),
|
||||
this, &Placement::onPlacementChanged);
|
||||
#else
|
||||
connect(signalMapper, &QSignalMapper::mappedInt,
|
||||
this, &Placement::onPlacementChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Placement::setupDocument()
|
||||
@@ -229,7 +234,8 @@ void Placement::revertTransformation()
|
||||
{
|
||||
for (const auto & it : documents) {
|
||||
Gui::Document* document = Application::Instance->getDocument(it.c_str());
|
||||
if (!document) continue;
|
||||
if (!document)
|
||||
continue;
|
||||
|
||||
if (!changeProperty) {
|
||||
std::vector<App::DocumentObject*> obj = document->getDocument()->
|
||||
@@ -245,7 +251,9 @@ void Placement::revertTransformation()
|
||||
auto property = static_cast<App::PropertyPlacement*>(jt->second);
|
||||
Base::Placement cur = property->getValue();
|
||||
Gui::ViewProvider* vp = document->getViewProvider(it);
|
||||
if (vp) vp->setTransformation(cur.toMatrix());
|
||||
if (vp) {
|
||||
vp->setTransformation(cur.toMatrix());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,7 +290,9 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental)
|
||||
|
||||
if (!changeProperty) {
|
||||
Gui::ViewProvider* vp = document->getViewProvider(it);
|
||||
if (vp) vp->setTransformation(cur.toMatrix());
|
||||
if (vp) {
|
||||
vp->setTransformation(cur.toMatrix());
|
||||
}
|
||||
}
|
||||
else {
|
||||
property->setValue(cur);
|
||||
|
||||
Reference in New Issue
Block a user