Add method to get Gui document from view provider
This commit is contained in:
parent
32aa72e94c
commit
82f7944966
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user