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:
Kacper Donat
2024-10-27 20:26:31 +01:00
parent deb15a57e4
commit 651cefde4d
131 changed files with 535 additions and 628 deletions

View File

@@ -59,7 +59,7 @@ TaskDlgFeatureParameters *ViewProviderHelix::getEditDialog()
QIcon ViewProviderHelix::getIcon() const {
QString str = QString::fromLatin1("PartDesign_");
auto* prim = static_cast<PartDesign::Helix*>(getObject());
auto* prim = getObject<PartDesign::Helix>();
if(prim->getAddSubType() == PartDesign::FeatureAddSub::Additive)
str += QString::fromLatin1("Additive");
else
@@ -72,7 +72,7 @@ QIcon ViewProviderHelix::getIcon() const {
bool ViewProviderHelix::setEdit(int ModNum)
{
if (ModNum == ViewProvider::Default ) {
auto* prim = static_cast<PartDesign::Helix*>(getObject());
auto* prim = getObject<PartDesign::Helix>();
setPreviewDisplayMode(TaskHelixParameters::showPreview(prim));
}
return ViewProviderAddSub::setEdit(ModNum);
@@ -88,7 +88,7 @@ void ViewProviderHelix::unsetEdit(int ModNum)
std::vector<App::DocumentObject*> ViewProviderHelix::claimChildren() const {
std::vector<App::DocumentObject*> temp;
App::DocumentObject* sketch = static_cast<PartDesign::ProfileBased*>(getObject())->Profile.getValue();
App::DocumentObject* sketch = getObject<PartDesign::ProfileBased>()->Profile.getValue();
if (sketch && sketch->isDerivedFrom(Part::Part2DObject::getClassTypeId()))
temp.push_back(sketch);
@@ -96,7 +96,7 @@ std::vector<App::DocumentObject*> ViewProviderHelix::claimChildren() const {
}
bool ViewProviderHelix::onDelete(const std::vector<std::string> &s) {
PartDesign::ProfileBased* feature = static_cast<PartDesign::ProfileBased*>(getObject());
PartDesign::ProfileBased* feature = getObject<PartDesign::ProfileBased>();
// get the Sketch
Sketcher::SketchObject *pcSketch = nullptr;