diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-02-16 17:39:08 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:53:59 -0300 |
commit | 861e26665da05bc6fbc28ed3503fdcc4b8bd9fb6 (patch) | |
tree | 12772bddcd07313f639936e743c3510590702944 /PySide/QtCore/typesystem_core.xml | |
parent | 8550948818153625a4f23def6eb2ab1b7e63d30b (diff) |
Fix bug 681 - "Unicode support for trUtf8 method"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'PySide/QtCore/typesystem_core.xml')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 35 |
1 files 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 @@ <replace-default-expression with="-1"/> </modify-argument> <inject-code class="target" position="beginning"> - 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; + } + </inject-code> + </add-function> - Py_DECREF(klass); - Py_DECREF(cname); + <add-function signature="trUtf8(PyUnicode, const char *, int)" return-type="QString"> + <modify-argument index="2"> + <replace-default-expression with="0"/> + </modify-argument> + <modify-argument index="3"> + <replace-default-expression with="-1"/> + </modify-argument> + <inject-code class="target" position="beginning"> + 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); </inject-code> </add-function> + <modify-function signature="receivers(const char*) const"> <inject-code class="target" position="beginning"> // Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife |