diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-10-03 18:49:42 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:56:08 -0300 |
commit | 1e29ab65924166688e352eaaa099ad571a980c4f (patch) | |
tree | 2a7ae3cb38b33a3211c9cec0da70016dd5d44c1d /PySide/QtGui | |
parent | a2cb6fe0254a122f0ad9d2ee991d9a249903ee12 (diff) |
Initia QtCore port to python3.
Diffstat (limited to 'PySide/QtGui')
-rw-r--r-- | PySide/QtGui/glue/qlayout_help_functions.h | 2 | ||||
-rw-r--r-- | PySide/QtGui/glue/qwidget_glue.h | 2 | ||||
-rw-r--r-- | PySide/QtGui/typesystem_gui_common.xml | 34 |
3 files changed, 19 insertions, 19 deletions
diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h index e408dce06..41b315376 100644 --- a/PySide/QtGui/glue/qlayout_help_functions.h +++ b/PySide/QtGui/glue/qlayout_help_functions.h @@ -7,7 +7,7 @@ void removeLayoutOwnership(QLayout* layout, QWidget* widget); inline QByteArray retrieveObjectName(PyObject* obj) { Shiboken::AutoDecRef objName(PyObject_Str(obj)); - return PyString_AsString(objName); + return Shiboken::String::toCString(objName); } inline void addLayoutOwnership(QLayout* layout, QWidget* widget) diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h index 129a54a51..931a5288e 100644 --- a/PySide/QtGui/glue/qwidget_glue.h +++ b/PySide/QtGui/glue/qwidget_glue.h @@ -1,7 +1,7 @@ static QString retrieveObjectName(PyObject *obj) { Shiboken::AutoDecRef objName(PyObject_Str(obj)); - return QString(PyString_AsString(objName)); + return QString(Shiboken::String::toCString(objName)); } diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index 06a2d9980..5067812ae 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -22,9 +22,9 @@ <load-typesystem name="typesystem_core.xml" generate="no"/> <template name="QFontCharFix"> - int size = PyString_GET_SIZE(%PYARG_1); + int size = Shiboken::String::len(%PYARG_1); if (size == 1) { - char *str = PyString_AS_STRING(%PYARG_1); + const char *str = Shiboken::String::toCString(%PYARG_1); QChar ch(str[0]); %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ch); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); @@ -777,7 +777,7 @@ Shiboken::AutoDecRef strList(PySequence_Fast(%PYARG_1, "Invalid sequence.")); int lineCount = PySequence_Fast_GET_SIZE(strList.object()); for (int line = 0; line < lineCount; ++line) { - if (!PyString_Check(PySequence_Fast_GET_ITEM(strList.object(), line))) { + if (!Shiboken::String::check(PySequence_Fast_GET_ITEM(strList.object(), line))) { PyErr_SetString(PyExc_TypeError, "The argument must be a sequence of strings."); break; } @@ -785,7 +785,7 @@ const char** xpm = (const char**) malloc (lineCount * sizeof(const char**)); for (int line = 0; line < lineCount; ++line) - xpm[line] = PyString_AS_STRING(PySequence_Fast_GET_ITEM(strList.object(), line)); + xpm[line] = Shiboken::String::toCString(PySequence_Fast_GET_ITEM(strList.object(), line)); %BEGIN_ALLOW_THREADS %0 = new %TYPE(xpm); @@ -820,15 +820,15 @@ <modify-function signature="loadFromData(const uchar*,uint,const char*,QFlags<Qt::ImageConversionFlag>)"> <modify-argument index="1"> - <replace-type modified-type="const char*"/> + <replace-type modified-type="PyBytes"/> <conversion-rule class="native"> - const uchar* %out = reinterpret_cast<const uchar*>(PyString_AS_STRING(%PYARG_1)); + const uchar* %out = reinterpret_cast<const uchar*>(PyBytes_AS_STRING(%PYARG_1)); </conversion-rule> </modify-argument> <modify-argument index="2"> <remove-argument/> <conversion-rule class="native"> - uint %out = static_cast<uint>(PyString_GET_SIZE(%PYARG_1)); + uint %out = static_cast<uint>(PyBytes_Size(%PYARG_1)); </conversion-rule> </modify-argument> </modify-function> @@ -1115,7 +1115,7 @@ qreal r, g, b, a; %CPPSELF.getRgbF(&r, &g, &b, &a); QString repr = QString().sprintf("PySide.QtGui.QColor.fromRgbF(%.6f, %.6f, %.6f, %.6f)", r, g, b, a); - %PYARG_0 = PyString_FromString(qPrintable(repr)); + %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr)); break; } case QColor::Hsv: @@ -1123,7 +1123,7 @@ qreal h, s, v, a; %CPPSELF.getHsvF(&h, &s, &v, &a); QString repr = QString().sprintf("PySide.QtGui.QColor.fromHsvF(%.6f, %.6f, %.6f, %.6f)", h, s, v, a); - %PYARG_0 = PyString_FromString(qPrintable(repr)); + %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr)); break; } case QColor::Cmyk: @@ -1131,7 +1131,7 @@ qreal c, m, y, k, a; %CPPSELF.getCmykF(&c, &m, &y, &k, &a); QString repr = QString().sprintf("PySide.QtGui.QColor.fromCmykF(%.6f, %.6f, %.6f, %.6f, %.6f)", c, m, y, k, a); - %PYARG_0 = PyString_FromString(qPrintable(repr)); + %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr)); break; } #if QT_VERSION >= 0x040600 @@ -1140,13 +1140,13 @@ qreal h, s, l, a; %CPPSELF.getHslF(&h, &s, &l, &a); QString repr = QString().sprintf("PySide.QtGui.QColor.fromHslF(%.6f, %.6f, %.6f, %.6f)", h, s, l, a); - %PYARG_0 = PyString_FromString(qPrintable(repr)); + %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr)); break; } #endif default: { - %PYARG_0 = PyString_FromString("PySide.QtGui.QColor()"); + %PYARG_0 = Shiboken::String::fromCString("PySide.QtGui.QColor()"); } } </template> @@ -1462,7 +1462,7 @@ <modify-function signature="boundingRect(QChar)const" rename="boundingRectChar"> <modify-argument index="1"> - <replace-type modified-type="PyString"/> + <replace-type modified-type="PyBytes"/> </modify-argument> <inject-code class="target" position="beginning"> <insert-template name="QFontCharFix"/> @@ -1471,7 +1471,7 @@ <modify-function signature="width(QChar)const" rename="widthChar"> <modify-argument index="1"> - <replace-type modified-type="PyString"/> + <replace-type modified-type="PyBytes"/> </modify-argument> <inject-code class="target" position="beginning"> <insert-template name="QFontCharFix"/> @@ -1538,7 +1538,7 @@ <modify-function signature="boundingRect(QChar)const" rename="boundingRectChar"> <modify-argument index="1"> - <replace-type modified-type="PyString"/> + <replace-type modified-type="PyBytes"/> </modify-argument> <inject-code class="target" position="beginning"> <insert-template name="QFontCharFix"/> @@ -1547,7 +1547,7 @@ <modify-function signature="width(QChar)const" rename="widthChar"> <modify-argument index="1"> - <replace-type modified-type="PyString"/> + <replace-type modified-type="PyBytes"/> </modify-argument> <inject-code class="target" position="beginning"> <insert-template name="QFontCharFix"/> @@ -3641,7 +3641,7 @@ foreach (QGraphicsItem* item, items) { SbkObject* obj = bm.retrieveWrapper(item); if (obj) { - if (obj->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway. + if (reinterpret_cast<PyObject*>(obj)->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway. Shiboken::Object::invalidate(obj); Shiboken::Object::removeParent(obj); } |