aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoxiang Sun <daetalusun@gmail.com>2018-06-29 10:48:55 +0800
committerChristian Tismer <tismer@stackless.com>2018-06-29 23:57:56 +0000
commit73fd61d556735c9781847620c511bb43ccae9a95 (patch)
tree7c7f4e8fa1bc56373a80cc5d625ac3966eeb2b4c
parent4ac84b908f96b203debf6645639804c547b28232 (diff)
Implement proper convert from QString to PyUnicodeObject
Task-number: PYSIDE-336 Change-Id: Ie7d955b3b4d35e24a9eac5e7958ce2077370a34b Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml7
1 files changed, 2 insertions, 5 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 488ee068b..d0806a19f 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -283,11 +283,8 @@
<include file-name="QString" location="global"/>
<conversion-rule>
<native-to-target>
- const int N = %in.length();
- wchar_t *str = new wchar_t[N];
- %in.toWCharArray(str);
- PyObject *%out = PyUnicode_FromWideChar(str, N);
- delete[] str;
+ QByteArray ba = %in.toUtf8();
+ PyObject *%out = PyUnicode_FromStringAndSize(ba.constData(), ba.size());
return %out;
</native-to-target>
<target-to-native>