Do not export symbols, because nobody can link against QtCore.

This commit is contained in:
Hugo Lima 2010-02-18 16:11:09 -02:00
commit a6a1481df3
2 changed files with 17 additions and 10 deletions

View file

@ -1,11 +1,11 @@
// Global variables used to store argc and argv values // Global variables used to store argc and argv values
SHIBOKEN_QTCORE_API int QCoreApplicationArgCount; static int QCoreApplicationArgCount;
SHIBOKEN_QTCORE_API char** QCoreApplicationArgValues; static char** QCoreApplicationArgValues;
/** /**
* Called at QtCore module exit * Called at QtCore module exit
*/ */
SHIBOKEN_QTCORE_API void DeleteQCoreApplicationAtExit() { void DeleteQCoreApplicationAtExit() {
if (QCoreApplication::instance()) { if (QCoreApplication::instance()) {
delete QCoreApplication::instance(); delete QCoreApplication::instance();
for (int i = 0; i < QCoreApplicationArgCount; ++i) for (int i = 0; i < QCoreApplicationArgCount; ++i)

View file

@ -1,9 +1,16 @@
// Borrowed reference to QtGui module // Borrowed reference to QtGui module
extern PyObject* moduleQtGui; extern PyObject* moduleQtGui;
// Global variables used to store argc and argv values, defined in QtCore binding
extern int QCoreApplicationArgCount; static int QApplicationArgCount;
extern char** QCoreApplicationArgValues; static char** QApplicationArgValues;
extern void DeleteQCoreApplicationAtExit();
void DeleteQApplicationAtExit() {
if (QApplication::instance()) {
delete QApplication::instance();
for (int i = 0; i < QApplicationArgCount; ++i)
delete[] QApplicationArgValues[i];
}
}
int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*) int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
{ {
@ -18,12 +25,12 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
return -1; return -1;
} }
if (!PySequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { if (!PySequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QApplicationArgCount, &QApplicationArgValues, "PySideApp")) {
PyErr_BadArgument(); PyErr_BadArgument();
return -1; return -1;
} }
SbkBaseWrapper_setCptr(self, new QApplication(QCoreApplicationArgCount, QCoreApplicationArgValues)); SbkBaseWrapper_setCptr(self, new QApplication(QApplicationArgCount, QApplicationArgValues));
SbkBaseWrapper_setValidCppObject(self, 1); SbkBaseWrapper_setValidCppObject(self, 1);
Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self)); Shiboken::BindingManager::instance().registerWrapper(reinterpret_cast<SbkBaseWrapper*>(self));
@ -38,7 +45,7 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
PyObject_SetAttrString(moduleQtGui, QAPP_MACRO, self); PyObject_SetAttrString(moduleQtGui, QAPP_MACRO, self);
Py_INCREF(self); Py_INCREF(self);
Py_AtExit(DeleteQCoreApplicationAtExit); Py_AtExit(DeleteQApplicationAtExit);
return 1; return 1;
} }