[TD] handle deletions of hatches

- also uniform line endings in ViewProviderLeader.cpp
This commit is contained in:
donovaly
2020-03-07 18:33:16 +01:00
committed by WandererFan
parent 3307e4bf7a
commit c390d64df0
5 changed files with 22 additions and 9 deletions

View File

@@ -181,7 +181,6 @@ void ViewProviderGeomHatch::updateGraphic(void)
}
}
void ViewProviderGeomHatch::getParameters(void)
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
@@ -198,6 +197,14 @@ void ViewProviderGeomHatch::getParameters(void)
WeightPattern.setValue(weight);
}
bool ViewProviderGeomHatch::canDelete(App::DocumentObject *obj) const
{
// deletion of hatches don't destroy anything
// thus we can pass this action
Q_UNUSED(obj)
return true;
}
TechDraw::DrawGeomHatch* ViewProviderGeomHatch::getViewObject() const
{
return dynamic_cast<TechDraw::DrawGeomHatch*>(pcObject);

View File

@@ -28,7 +28,6 @@
#include <App/DocumentObject.h>
#include <App/FeaturePython.h>
#include <App/PropertyStandard.h>
#include <Gui/ViewProviderFeature.h>
@@ -52,19 +51,18 @@ public:
App::PropertyFloat WeightPattern;
App::PropertyColor ColorPattern;
virtual void attach(App::DocumentObject *) override;
virtual void updateData(const App::Property*) override;
virtual void onChanged(const App::Property *prop) override;
virtual bool setEdit(int ModNum) override;
virtual void unsetEdit(int ModNum) override;
virtual bool doubleClicked(void) override;
virtual bool useNewSelectionModel(void) const override {return false;}
virtual void setDisplayMode(const char* ModeName) override;
virtual std::vector<std::string> getDisplayModes(void) const override;
void updateGraphic(void);
void getParameters(void);
virtual bool canDelete(App::DocumentObject* obj) const;
TechDraw::DrawGeomHatch* getViewObject() const;
@@ -73,5 +71,4 @@ public:
} // namespace TechDrawGui
#endif // DRAWINGGUI_VIEWPROVIDERHATCH_H

View File

@@ -113,6 +113,7 @@ void ViewProviderHatch::onChanged(const App::Property* prop)
}
}
}
void ViewProviderHatch::updateData(const App::Property* prop)
{
Gui::ViewProviderDocumentObject::updateData(prop);
@@ -123,6 +124,14 @@ TechDraw::DrawHatch* ViewProviderHatch::getViewObject() const
return dynamic_cast<TechDraw::DrawHatch*>(pcObject);
}
bool ViewProviderHatch::canDelete(App::DocumentObject *obj) const
{
// deletion of hatches don't destroy anything
// thus we can pass this action
Q_UNUSED(obj)
return true;
}
Gui::MDIView *ViewProviderHatch::getMDIView() const
{
auto obj = getViewObject();
@@ -131,4 +140,3 @@ Gui::MDIView *ViewProviderHatch::getMDIView() const
if(!vp) return 0;
return vp->getMDIView();
}

View File

@@ -54,6 +54,7 @@ public:
virtual std::vector<std::string> getDisplayModes(void) const override;
virtual void onChanged(const App::Property* prop) override;
virtual void updateData(const App::Property*) override;
virtual bool canDelete(App::DocumentObject* obj) const;
TechDraw::DrawHatch* getViewObject() const;

View File

@@ -236,8 +236,8 @@ bool ViewProviderLeader::onDelete(const std::vector<std::string> &)
{
// a leader line cannot be deleted if it has a child weld symbol
// get childs
auto childs = claimChildren();
// get childs
auto childs = claimChildren();
if (!childs.empty()) {
QString bodyMessage;
@@ -258,7 +258,7 @@ bool ViewProviderLeader::canDelete(App::DocumentObject *obj) const
{
// deletions of Leader line objects don't destroy anything
// thus we can pass this action
// that the parent view cannot be deleted is handled
// that the parent view cannot be deleted is handled
// in its onDelete() function
Q_UNUSED(obj)
return true;