aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui/glue
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 20:01:04 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 20:17:24 -0200
commit23c1b92073a25e23e2c3bdb2e1a758cfbb64fe79 (patch)
treeadaee02820f58a600e178c9fa0fb7fa1a2618271 /PySide/QtGui/glue
parent92dcb7ae3a92416b4129d549625eba0512e02426 (diff)
Changes needed to compile PySide with libshiboken v1.0
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'PySide/QtGui/glue')
-rw-r--r--PySide/QtGui/glue/qapplication_init.cpp20
-rw-r--r--PySide/QtGui/glue/qlayout_help_functions.h22
-rw-r--r--PySide/QtGui/glue/qmenu_glue.h7
-rw-r--r--PySide/QtGui/glue/qwidget_glue.h8
4 files changed, 27 insertions, 30 deletions
diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp
index fcacc02db..51ed3fff4 100644
--- a/PySide/QtGui/glue/qapplication_init.cpp
+++ b/PySide/QtGui/glue/qapplication_init.cpp
@@ -5,9 +5,9 @@ static int QApplicationArgCount;
static char** QApplicationArgValues;
static const char QAPP_MACRO[] = "qApp";
-int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
+int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*)
{
- if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >()))
+ if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication>()))
return -1;
if (QApplication::instance()) {
@@ -21,19 +21,19 @@ int SbkQApplication_Init(PyObject* self, PyObject* args, PyObject*)
return -1;
}
- if (!PySequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QApplicationArgCount, &QApplicationArgValues, "PySideApp")) {
+ if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QApplicationArgCount, &QApplicationArgValues, "PySideApp")) {
PyErr_BadArgument();
return -1;
}
+ SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
QApplicationWrapper* cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues);
- Shiboken::setCppPointer(reinterpret_cast<SbkBaseWrapper*>(self),
- Shiboken::SbkType<QApplication>(),
- cptr);
- SbkBaseWrapper_setValidCppObject(self, 1);
- SbkBaseWrapper *sbkSelf = reinterpret_cast<SbkBaseWrapper*>(self);
- sbkSelf->containsCppWrapper = 1;
- sbkSelf->hasOwnership = 0;
+ Shiboken::Wrapper::setCppPointer(sbkSelf,
+ Shiboken::SbkType<QApplication>(),
+ cptr);
+ Shiboken::Wrapper::setValidCpp(sbkSelf, true);
+ Shiboken::Wrapper::setHasCppWrapper(sbkSelf, true);
+ Shiboken::Wrapper::releaseOwnership(sbkSelf);
Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);
PySide::Signal::updateSourceObject(self);
cptr->metaObject();
diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h
index e62077a73..0a6dd0eb0 100644
--- a/PySide/QtGui/glue/qlayout_help_functions.h
+++ b/PySide/QtGui/glue/qlayout_help_functions.h
@@ -1,24 +1,24 @@
#ifndef QLAYOUT_HELP_FUNCTIONS
#define QLAYOUT_HELP_FUNCTIONS
-void addLayoutOwnership(QLayout *layout, QLayoutItem *item);
+void addLayoutOwnership(QLayout* layout, QLayoutItem* item);
-inline QByteArray retrieveObjectName(PyObject *obj)
+inline QByteArray retrieveObjectName(PyObject* obj)
{
Shiboken::AutoDecRef objName(PyObject_Str(obj));
return PyString_AsString(objName);
}
-inline void addLayoutOwnership(QLayout *layout, QWidget *widget)
+inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
{
//transfer ownership to parent widget
- QWidget *parent = layout->parentWidget();
+ QWidget* parent = layout->parentWidget();
if (!parent) {
//keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
- Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ Shiboken::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
} else {
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
@@ -26,15 +26,15 @@ inline void addLayoutOwnership(QLayout *layout, QWidget *widget)
}
}
-inline void addLayoutOwnership(QLayout *layout, QLayout *other)
+inline void addLayoutOwnership(QLayout* layout, QLayout* other)
{
//transfer all children widgetes from other to layout parent widget
- QWidget *parent = layout->parentWidget();
+ QWidget* parent = layout->parentWidget();
if (!parent) {
//keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other));
- Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ Shiboken::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
return;
}
@@ -48,13 +48,13 @@ inline void addLayoutOwnership(QLayout *layout, QLayout *other)
}
-inline void addLayoutOwnership(QLayout *layout, QLayoutItem *item)
+inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
{
- QWidget *w = item->widget();
+ QWidget* w = item->widget();
if (w)
addLayoutOwnership(layout, w);
else {
- QLayout *l = item->layout();
+ QLayout* l = item->layout();
if (l)
addLayoutOwnership(layout, l);
}
diff --git a/PySide/QtGui/glue/qmenu_glue.h b/PySide/QtGui/glue/qmenu_glue.h
index 1a6cb19f3..94eab15e0 100644
--- a/PySide/QtGui/glue/qmenu_glue.h
+++ b/PySide/QtGui/glue/qmenu_glue.h
@@ -1,8 +1,7 @@
-inline PyObject*
-addActionWithPyObject(QMenu *self, const QIcon& icon, const QString& text, PyObject *callback, const QKeySequence &shortcut)
+inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QString& text, PyObject* callback, const QKeySequence& shortcut)
{
- QAction *act = new QAction(text, self);
+ QAction* act = new QAction(text, self);
if (!icon.isNull())
act->setIcon(icon);
@@ -12,7 +11,7 @@ addActionWithPyObject(QMenu *self, const QIcon& icon, const QString& text, PyObj
self->addAction(act);
- PyObject *pyAct = Shiboken::Converter<QAction*>::toPython(act);
+ PyObject* pyAct = Shiboken::Converter<QAction*>::toPython(act);
Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, SIGNAL(triggered()), callback));
if (result.isNull()) {
Py_DECREF(pyAct);
diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h
index 6be651840..0339e8980 100644
--- a/PySide/QtGui/glue/qwidget_glue.h
+++ b/PySide/QtGui/glue/qwidget_glue.h
@@ -8,8 +8,7 @@ static QString retrieveObjectName(PyObject *obj)
/**
* Tranfer objects ownership from layout to widget
**/
-static inline void
-qwidgetReparentLayout(QWidget *parent, QLayout *layout)
+static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
{
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
@@ -36,11 +35,10 @@ qwidgetReparentLayout(QWidget *parent, QLayout *layout)
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::setParent(pyParent, pyChild);
//remove previous references
- Shiboken::keepReference(reinterpret_cast<Shiboken::SbkBaseWrapper*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
+ Shiboken::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
}
-static inline void
-qwidgetSetLayout(QWidget *self, QLayout *layout)
+static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
{
if (!layout || self->layout())
return;