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> | 2011-02-16 19:40:46 -0200 |
commit | 4305a54b423d8a0915e6566b83188fd867fe47eb (patch) | |
tree | 4a6d8916ab1a823b173a00d0c52a4c499aedb32c | |
parent | e0cf4b000d1363b9cbeab707364e8e1933f4ee92 (diff) | |
download | pyside-4305a54b423d8a0915e6566b83188fd867fe47eb.tar.gz pyside-4305a54b423d8a0915e6566b83188fd867fe47eb.tar.xz pyside-4305a54b423d8a0915e6566b83188fd867fe47eb.zip |
Fix bug 681 - "Unicode support for trUtf8 method"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
-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 24b1838..d3d0b53 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1337,21 +1337,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 |