diff --git a/src/bindings/bindings.h b/src/bindings/bindings.h index bde099fb..d725185f 100644 --- a/src/bindings/bindings.h +++ b/src/bindings/bindings.h @@ -7,6 +7,7 @@ #include "../core/Cutter.h" #include "../common/Configuration.h" #include "../core/MainWindow.h" +#include "../CutterApplication.h" #include "../widgets/CutterDockWidget.h" #include "../plugins/CutterPlugin.h" diff --git a/src/bindings/bindings.xml b/src/bindings/bindings.xml index f4065235..be72ca61 100644 --- a/src/bindings/bindings.xml +++ b/src/bindings/bindings.xml @@ -13,6 +13,9 @@ <object-type name="MainWindow" > <enum-type name="MenuType" /> </object-type> + <object-type name="CutterApplication"> + <modify-function signature="CutterApplication(int &, char **)" remove="all"/> + </object-type> <object-type name="BasicBlockHighlighter" /> <object-type name="CutterDockWidget" /> diff --git a/src/python/cutter.py b/src/python/cutter.py index d8c73049..9a7820c0 100644 --- a/src/python/cutter.py +++ b/src/python/cutter.py @@ -6,6 +6,14 @@ try: def core(): return CutterCore.instance() + + def app(): + # see https://forums.autodesk.com/t5/3ds-max-programming/qapplication-instance-returns-qcoreapplication-instance/td-p/9035295 + import shiboken2 + from PySide2 import QtCore + coreapp = QtCore.QCoreApplication.instance() + ptr = shiboken2.getCppPointer(coreapp)[0] + return shiboken2.wrapInstance(ptr, CutterApplication) except ImportError: pass