From 861e26665da05bc6fbc28ed3503fdcc4b8bd9fb6 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 16 Feb 2011 17:39:08 -0200 Subject: Fix bug 681 - "Unicode support for trUtf8 method" Reviewer: Luciano Wolf Lauro Moura --- PySide/QtCore/typesystem_core.xml | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 4a7aa2e81..90b6336fa 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1329,21 +1329,40 @@ - QString result; if (QCoreApplication::instance()) { - PyObject *klass = PyObject_GetAttrString(%PYSELF, "__class__"); - PyObject *cname = PyObject_GetAttrString(klass, "__name__"); - result = QString(QCoreApplication::instance()->translate(PyString_AsString(cname), %1, %2, QCoreApplication::UnicodeUTF8, %3)); + Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__")); + Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__")); + QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), %1, %2, QCoreApplication::UnicodeUTF8, %3); + %PYARG_0 = %CONVERTTOPYTHON[QString](result); + } else { + Py_INCREF(%PYARG_1); + %PYARG_0 = %PYARG_1; + } + + - Py_DECREF(klass); - Py_DECREF(cname); + + + + + + + + + if (QCoreApplication::instance()) { + Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__")); + Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__")); + Shiboken::AutoDecRef str(PyUnicode_AsUTF8String(%1)); + QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), PyString_AS_STRING(str.object()), %2, QCoreApplication::UnicodeUTF8, %3); + %PYARG_0 = %CONVERTTOPYTHON[QString](result); } else { - result = QString(QString::fromLatin1(%1)); + Py_INCREF(%PYARG_1); + %PYARG_0 = %PYARG_1; } - %PYARG_0 = %CONVERTTOPYTHON[QString](result); + // Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife -- cgit v1.2.3