5
5
static char** QApplicationArgValues;
6
6
static const char QAPP_MACRO[] = "qApp";
8
void DeleteQApplicationAtExit()
10
PySide::SignalManager::instance().clear();
11
QCoreApplication* cpp = QApplication::instance();
13
Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance();
15
// Delete all widgets, this is slow but is necessary to avoid problems with python object
16
foreach(QWidget* w, QApplication::allWidgets()) {
17
PyObject* wrapper = bmngr.retrieveWrapper(w);
19
if (SbkBaseWrapper_hasOwnership(wrapper))
20
delete w; // destroy C++ object and invalidate wrapper object
22
bmngr.destroyWrapper(wrapper); // only invalidate wrapper object
30
int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
32
if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >()))
8
int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*)
10
if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication>()))
35
13
if (QApplication::instance()) {
46
if (!PySequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QApplicationArgCount, &QApplicationArgValues, "PySideApp")) {
24
if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QApplicationArgCount, &QApplicationArgValues, "PySideApp")) {
47
25
PyErr_BadArgument();
29
SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
51
30
QApplicationWrapper* cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues);
52
Shiboken::setCppPointer(reinterpret_cast<SbkBaseWrapper*>(self),
53
Shiboken::SbkType<QApplication>(),
55
SbkBaseWrapper_setValidCppObject(self, 1);
56
SbkBaseWrapper *sbkSelf = reinterpret_cast<SbkBaseWrapper*>(self);
57
sbkSelf->containsCppWrapper = 1;
58
sbkSelf->hasOwnership = 0;
31
Shiboken::Object::setCppPointer(sbkSelf,
32
Shiboken::SbkType<QApplication>(),
34
Shiboken::Object::setValidCpp(sbkSelf, true);
35
Shiboken::Object::setHasCppWrapper(sbkSelf, true);
36
Shiboken::Object::releaseOwnership(sbkSelf);
59
37
Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);
60
PySide::signalUpdateSource(self);
38
PySide::Signal::updateSourceObject(self);
61
39
cptr->metaObject();
63
41
// Verify if qApp is in main module