Gui: Add getObject<T>() helpers to various classes
Obtaining specific kind of document object is very common task. This commit introduces handy helper which makes that a lot easier.
This commit is contained in:
@@ -92,6 +92,9 @@ public:
|
||||
void updateView();
|
||||
/// Get the object of this ViewProvider object
|
||||
App::DocumentObject *getObject() const {return pcObject;}
|
||||
/// Get the object of this ViewProvider object as specified type
|
||||
template <class T>
|
||||
T *getObject() const { return dynamic_cast<T*>(pcObject); }
|
||||
/// Asks the view provider if the given object can be deleted.
|
||||
bool canDelete(App::DocumentObject* obj) const override;
|
||||
/// Ask the view provider if it accepts object deletions while in edit
|
||||
|
||||
Reference in New Issue
Block a user