Added qApp macro.
This commit is contained in:
parent
d35fd7fa2c
commit
a642451bff
3 changed files with 23 additions and 0 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
// Borrowed reference to QtGui module
|
||||||
|
extern PyObject* moduleQtGui;
|
||||||
|
|
||||||
int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
|
int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
|
||||||
{
|
{
|
||||||
int numArgs = PyTuple_GET_SIZE(args);
|
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_setCptr(self, new QApplication(argc, argv));
|
||||||
SbkBaseWrapper_setValidCppObject(self, 1);
|
SbkBaseWrapper_setValidCppObject(self, 1);
|
||||||
Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self));
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
PySide/QtGui/glue/qtgui_qapp.cpp
Normal file
4
PySide/QtGui/glue/qtgui_qapp.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
// Init qApp macro to None.
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
PyModule_AddObject(module, "qApp", Py_None);
|
||||||
|
moduleQtGui = module;
|
||||||
|
|
@ -3583,6 +3583,11 @@
|
||||||
<modify-function signature="fontInfo()const" remove="all"/>
|
<modify-function signature="fontInfo()const" remove="all"/>
|
||||||
<modify-function signature="fontMetrics()const" remove="all"/>
|
<modify-function signature="fontMetrics()const" remove="all"/>
|
||||||
</object-type>
|
</object-type>
|
||||||
|
<!-- qApp macro -->
|
||||||
|
<inject-code class="native" position="beginning">
|
||||||
|
PyObject* moduleQtGui;
|
||||||
|
</inject-code>
|
||||||
|
<inject-code class="target" file="glue/qtgui_qapp.cpp" position="end" />
|
||||||
<object-type name="QApplication">
|
<object-type name="QApplication">
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="QBasicTimer" location="global"/>
|
<include file-name="QBasicTimer" location="global"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue