Gui: Use getObject<T>() helpers in classes
This commit is generated using regex based find and replace: ``` s/[\w:]+_cast\s*<([^>]+)\*>\s*\(\s*getObject\(\s*\)\)/getObject<$1>/ s/[\w:]+_cast\s*<([^>]+)\*>\s*\(\s*([^)]*)\s*->\s*getObject\(\s*\)\)/$2->getObject<$1>()/ ``` To regenerate if needed.
This commit is contained in:
@@ -86,7 +86,7 @@ void TaskShapeBinder::updateUI()
|
||||
App::GeoFeature* obj = nullptr;
|
||||
std::vector<std::string> subs;
|
||||
|
||||
PartDesign::ShapeBinder::getFilteredReferences(&static_cast<PartDesign::ShapeBinder*>(vp->getObject())->Support, obj, subs);
|
||||
PartDesign::ShapeBinder::getFilteredReferences(&vp->getObject<PartDesign::ShapeBinder>()->Support, obj, subs);
|
||||
|
||||
if (obj) {
|
||||
ui->baseEdit->setText(QString::fromStdString(obj->Label.getStrValue()));
|
||||
@@ -146,7 +146,7 @@ void TaskShapeBinder::setupContextMenu()
|
||||
void TaskShapeBinder::supportChanged(const QString& text)
|
||||
{
|
||||
if (!vp.expired() && text.isEmpty()) {
|
||||
PartDesign::ShapeBinder* binder = static_cast<PartDesign::ShapeBinder*>(vp->getObject());
|
||||
PartDesign::ShapeBinder* binder = vp->getObject<PartDesign::ShapeBinder>();
|
||||
binder->Support.setValue(nullptr, nullptr);
|
||||
vp->highlightReferences(false);
|
||||
vp->getObject()->getDocument()->recomputeFeature(vp->getObject());
|
||||
@@ -201,7 +201,7 @@ void TaskShapeBinder::deleteItem()
|
||||
App::GeoFeature* obj = nullptr;
|
||||
std::vector<std::string> subs;
|
||||
|
||||
PartDesign::ShapeBinder* binder = static_cast<PartDesign::ShapeBinder*>(vp->getObject());
|
||||
PartDesign::ShapeBinder* binder = vp->getObject<PartDesign::ShapeBinder>();
|
||||
PartDesign::ShapeBinder::getFilteredReferences(&binder->Support, obj, subs);
|
||||
|
||||
std::string subname = data.constData();
|
||||
@@ -298,7 +298,7 @@ bool TaskShapeBinder::referenceSelected(const SelectionChanges& msg) const
|
||||
App::GeoFeature* obj = nullptr;
|
||||
std::vector<std::string> refs;
|
||||
|
||||
PartDesign::ShapeBinder::getFilteredReferences(&static_cast<PartDesign::ShapeBinder*>(vp->getObject())->Support, obj, refs);
|
||||
PartDesign::ShapeBinder::getFilteredReferences(&vp->getObject<PartDesign::ShapeBinder>()->Support, obj, refs);
|
||||
|
||||
// get selected object
|
||||
auto docObj = vp->getObject()->getDocument()->getObject(msg.pObjectName);
|
||||
@@ -341,7 +341,7 @@ bool TaskShapeBinder::referenceSelected(const SelectionChanges& msg) const
|
||||
obj = selectedObj;
|
||||
}
|
||||
|
||||
static_cast<PartDesign::ShapeBinder*>(vp->getObject())->Support.setValue(obj, refs);
|
||||
vp->getObject<PartDesign::ShapeBinder>()->Support.setValue(obj, refs);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -368,7 +368,7 @@ void TaskShapeBinder::accept()
|
||||
return;
|
||||
|
||||
std::string label = ui->baseEdit->text().toStdString();
|
||||
PartDesign::ShapeBinder* binder = static_cast<PartDesign::ShapeBinder*>(vp->getObject());
|
||||
PartDesign::ShapeBinder* binder = vp->getObject<PartDesign::ShapeBinder>();
|
||||
if (!binder->Support.getValue() && !label.empty()) {
|
||||
auto mode = selectionMode;
|
||||
selectionMode = refObjAdd;
|
||||
|
||||
Reference in New Issue
Block a user