diff options
Diffstat (limited to 'PySide/QtGui/glue')
-rw-r--r-- | PySide/QtGui/glue/qlayout_help_functions.cpp (renamed from PySide/QtGui/glue/qlayout_help_functions.h) | 38 | ||||
-rw-r--r-- | PySide/QtGui/glue/qmenu_glue.cpp (renamed from PySide/QtGui/glue/qmenu_glue.h) | 3 | ||||
-rw-r--r-- | PySide/QtGui/glue/qmenubar_glue.cpp (renamed from PySide/QtGui/glue/qmenubar_glue.h) | 2 | ||||
-rw-r--r-- | PySide/QtGui/glue/qtgui_qapp.cpp | 2 | ||||
-rw-r--r-- | PySide/QtGui/glue/qwidget_glue.cpp (renamed from PySide/QtGui/glue/qwidget_glue.h) | 8 | ||||
-rw-r--r-- | PySide/QtGui/glue/wid_conversions.h | 39 |
6 files changed, 22 insertions, 70 deletions
diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.cpp index 00f0dbde7..b36606136 100644 --- a/PySide/QtGui/glue/qlayout_help_functions.h +++ b/PySide/QtGui/glue/qlayout_help_functions.cpp @@ -1,6 +1,3 @@ -#ifndef QLAYOUT_HELP_FUNCTIONS -#define QLAYOUT_HELP_FUNCTIONS - void addLayoutOwnership(QLayout* layout, QLayoutItem* item); void removeLayoutOwnership(QLayout* layout, QWidget* widget); @@ -16,21 +13,20 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget) QWidget *lw = layout->parentWidget(); QWidget *pw = widget->parentWidget(); - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget)); - //Transfer parent to layout widget + //Transfer parent to layout widget if (pw && lw && pw != lw) Shiboken::Object::setParent(0, pyChild); if (!lw && !pw) { //keep the reference while the layout is orphan - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout)); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); } else { if (!lw) lw = pw; - - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(lw)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](lw)); Shiboken::Object::setParent(pyParent, pyChild); } } @@ -41,8 +37,8 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other) 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::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other)); Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true); return; } @@ -51,14 +47,12 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other) QLayoutItem* item = other->itemAt(i); if (PyErr_Occurred() || !item) return; - addLayoutOwnership(layout, item); } - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other)); Shiboken::Object::setParent(pyParent, pyChild); - } inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item) @@ -75,8 +69,8 @@ inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item) addLayoutOwnership(layout, l); } - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout)); - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item)); Shiboken::Object::setParent(pyParent, pyChild); } @@ -86,13 +80,13 @@ static void removeWidgetFromLayout(QLayout* layout, QWidget* widget) if (!parent) { //remove reference on layout - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout)); - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget)); Shiboken::Object::removeReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild); } else { //give the ownership to parent - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent)); - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget)); Shiboken::Object::setParent(pyParent, pyChild); } } @@ -108,7 +102,7 @@ inline void removeLayoutOwnership(QLayout* layout, QLayoutItem* item) removeLayoutOwnership(layout, l); } - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayoutItem*>::toPython(item)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item)); Shiboken::Object::invalidate(pyChild); Shiboken::Object::setParent(0, pyChild); } @@ -126,5 +120,3 @@ inline void removeLayoutOwnership(QLayout* layout, QWidget* widget) removeLayoutOwnership(layout, item); } } - -#endif diff --git a/PySide/QtGui/glue/qmenu_glue.h b/PySide/QtGui/glue/qmenu_glue.cpp index 94eab15e0..0636dfab0 100644 --- a/PySide/QtGui/glue/qmenu_glue.h +++ b/PySide/QtGui/glue/qmenu_glue.cpp @@ -1,4 +1,3 @@ - inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QString& text, PyObject* callback, const QKeySequence& shortcut) { QAction* act = new QAction(text, self); @@ -11,7 +10,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt self->addAction(act); - PyObject* pyAct = Shiboken::Converter<QAction*>::toPython(act); + PyObject* pyAct = %CONVERTTOPYTHON[QAction*](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/qmenubar_glue.h b/PySide/QtGui/glue/qmenubar_glue.cpp index 9568fa87c..2326a76cc 100644 --- a/PySide/QtGui/glue/qmenubar_glue.h +++ b/PySide/QtGui/glue/qmenubar_glue.cpp @@ -5,7 +5,7 @@ addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback) self->addAction(act); - PyObject* pyAct = Shiboken::Converter<QAction*>::toPython(act); + PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act); PyObject* result = PyObject_CallMethod(pyAct, "connect", "OsO", pyAct, SIGNAL(triggered(bool)), callback); diff --git a/PySide/QtGui/glue/qtgui_qapp.cpp b/PySide/QtGui/glue/qtgui_qapp.cpp index 4c4508b70..5148b579b 100644 --- a/PySide/QtGui/glue/qtgui_qapp.cpp +++ b/PySide/QtGui/glue/qtgui_qapp.cpp @@ -1,6 +1,6 @@ // Init qApp macro to None. if (qApp) { - PyObject* pyApp = Shiboken::Converter<QApplication*>::toPython(qApp); + PyObject* pyApp = %CONVERTTOPYTHON[QApplication*](qApp); Py_INCREF(pyApp); PyModule_AddObject(module, "qApp", pyApp); } else { diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.cpp index 931a5288e..cfa3f6757 100644 --- a/PySide/QtGui/glue/qwidget_glue.h +++ b/PySide/QtGui/glue/qwidget_glue.cpp @@ -10,7 +10,7 @@ static QString retrieveObjectName(PyObject *obj) **/ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) { - Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent)); + Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent)); for (int i=0; i < layout->count(); i++) { QLayoutItem* item = layout->itemAt(i); @@ -21,7 +21,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) if (w) { QWidget* pw = w->parentWidget(); if (pw != parent) { - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(w)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](w)); Shiboken::Object::setParent(pyParent, pyChild); } } else { @@ -31,7 +31,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) } } - Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(layout)); + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](layout)); Shiboken::Object::setParent(pyParent, pyChild); //remove previous references Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None); @@ -46,7 +46,7 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout) if (oldParent && oldParent != self) { if (oldParent->isWidgetType()) { // remove old parent policy - Shiboken::AutoDecRef pyLayout(Shiboken::Converter<QLayout*>::toPython(layout)); + Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout*](layout)); Shiboken::Object::setParent(Py_None, pyLayout); } else { PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent", diff --git a/PySide/QtGui/glue/wid_conversions.h b/PySide/QtGui/glue/wid_conversions.h deleted file mode 100644 index 68d752884..000000000 --- a/PySide/QtGui/glue/wid_conversions.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef Q_WS_WIN - -namespace Shiboken { -template <> -struct Converter<WId> -{ - static bool checkType(PyObject* pyObj) - { - return false; - } - - static bool isConvertible(PyObject* pyobj) - { - return pyobj == Py_None || PyNumber_Check(pyobj); - } - - static inline PyObject* toPython(void* cppobj) - { - // not supported - Q_ASSERT(true); - return 0; - } - - static PyObject* toPython(WId cppobj) - { - return PyLong_FromVoidPtr((void*)cppobj); - } - - static WId toCpp(PyObject* pyobj) - { - if (pyobj == Py_None) - return 0; - return (WId)PyLong_AsVoidPtr(pyobj); - } -}; - -} - -#endif |