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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user