diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-01-27 11:44:51 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-01-27 16:57:18 -0200 |
commit | a642451bfff138257e3c706f0c87590fd8269056 (patch) | |
tree | e10a29b00614c100b4d04ffa9e62aaa67539b938 /PySide/QtGui/glue/qapplication_init.cpp | |
parent | d35fd7fa2c689af2467b98cb45e0fa42efbd59b1 (diff) |
Added qApp macro.
Diffstat (limited to 'PySide/QtGui/glue/qapplication_init.cpp')
-rw-r--r-- | PySide/QtGui/glue/qapplication_init.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index e45c4375f..265db256b 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -1,3 +1,6 @@ +// Borrowed reference to QtGui module +extern PyObject* moduleQtGui; + int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) { int numArgs = PyTuple_GET_SIZE(args); @@ -16,5 +19,16 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) SbkBaseWrapper_setCptr(self, new QApplication(argc, argv)); SbkBaseWrapper_setValidCppObject(self, 1); Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self)); + + // Verify if qApp is in main module + const char QAPP_MACRO[] = "qApp"; + PyObject* localsDict = PyEval_GetLocals(); + if (localsDict) { + PyObject* qAppObj = PyDict_GetItemString(localsDict, QAPP_MACRO); + if (qAppObj) + PyDict_SetItemString(localsDict, QAPP_MACRO, self); + } + PyObject_SetAttrString(moduleQtGui, QAPP_MACRO, self); + return 1; } |