Gui: Add generic getViewProvider<T>

This commit is contained in:
Kacper Donat
2025-08-25 00:51:42 +02:00
parent 2aac5f6b33
commit 2bcfe3f2b1

View File

@@ -203,6 +203,12 @@ public:
void hideViewProvider(const App::DocumentObject*);
/// Get the view provider of the given object
Gui::ViewProvider* getViewProvider(const App::DocumentObject*) const;
/// Get the type safe view provider of the given object
template <typename T>
T* getViewProvider(const App::DocumentObject* obj) const
{
return freecad_cast<T*>(getViewProvider(obj));
}
//@}
/// true when the application shutting down