Gui: [skip ci] add method to access the Inventor viewer as QGraphicsView

This commit is contained in:
wmayer
2020-10-01 13:54:12 +02:00
parent de1a46f68f
commit abcaef8601
2 changed files with 14 additions and 0 deletions

View File

@@ -51,6 +51,7 @@
#include "View3DInventorViewer.h"
#include "View3DViewerPy.h"
#include "ActiveObjectList.h"
#include "WidgetFactory.h"
#include <Base/Console.h>
@@ -203,6 +204,8 @@ void View3DInventorPy::init_type()
"pla: clipping plane placement");
add_varargs_method("hasClippingPlane",&View3DInventorPy::hasClippingPlane,
"hasClippingPlane(): check whether this clipping plane is active");
add_varargs_method("graphicsView",&View3DInventorPy::graphicsView,
"graphicsView(): Access this view as QGraphicsView");
}
View3DInventorPy::View3DInventorPy(View3DInventor *vi)
@@ -2597,3 +2600,13 @@ Py::Object View3DInventorPy::hasClippingPlane(const Py::Tuple& args)
throw Py::Exception();
return Py::Boolean(_view->getViewer()->hasClippingPlane());
}
Py::Object View3DInventorPy::graphicsView(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), ""))
throw Py::Exception();
PythonWrapper wrap;
wrap.loadWidgetsModule();
return wrap.fromQWidget(_view->getViewer(), "QGraphicsView");
}

View File

@@ -132,6 +132,7 @@ public:
Py::Object setName(const Py::Tuple&);
Py::Object toggleClippingPlane(const Py::Tuple& args, const Py::Dict &);
Py::Object hasClippingPlane(const Py::Tuple& args);
Py::Object graphicsView(const Py::Tuple& args);
View3DInventor* getView3DIventorPtr() {return _view;}