Add method to get Gui document from view provider

This commit is contained in:
wmayer
2016-08-21 18:24:56 +02:00
parent 1eaa2dcb2a
commit 56ff619cd8
2 changed files with 9 additions and 0 deletions

View File

@@ -181,6 +181,12 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj)
DisplayMode.setValue(defmode);
}
Gui::Document* ViewProviderDocumentObject::getDocument() const
{
App::Document* pAppDoc = pcObject->getDocument();
return Gui::Application::Instance->getDocument(pAppDoc);
}
Gui::MDIView* ViewProviderDocumentObject::getActiveView() const
{
App::Document* pAppDoc = pcObject->getDocument();

View File

@@ -44,6 +44,7 @@ namespace App
namespace Gui {
class MDIView;
class Document;
class GuiExport ViewProviderDocumentObject : public ViewProvider
{
@@ -81,6 +82,8 @@ public:
virtual void updateData(const App::Property*){}
/// Get the object of this ViewProvider object
App::DocumentObject *getObject(void) const {return pcObject;}
/// Get the GUI document to this ViewProvider object
Gui::Document* getDocument() const;
/// Get the python wrapper for that ViewProvider
PyObject* getPyObject();