aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/glue
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-19 11:36:19 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-19 16:55:56 +0200
commit639456cabd032b60aa371000a8ca98ddb9d08504 (patch)
tree7ca5581017c06e677f2469fc105f5bc4cef66666 /sources/pyside2/PySide2/glue
parentc761068f334185bdd95401ee0392dff0d72d764b (diff)
PySide2: Prepare for Qt 6
- Change QBasicTimer to be an object type since its copy constructor and assignment were deleted in Qt 6. It probably was never intended to be a value type. - Remove the hash function of QItemSelectionRange which according to code comment is a dummy to get QItemSelectionRange::toSet() compiled with MSVC. There is no need for it to have it in Python - Adapt the underlying string types for QString conversion Task-number: PYSIDE-904 Change-Id: Idb60b95b6bc0ce3d1272862995f3247d2f191454 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/PySide2/glue')
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 834383679..83c8f8656 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -1681,11 +1681,19 @@ Py_END_ALLOW_THREADS
// @snippet conversion-pyunicode
#ifndef Py_LIMITED_API
Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in);
-# if defined(Py_UNICODE_WIDE)
+# if defined(Py_UNICODE_WIDE)
// cast as Py_UNICODE can be a different type
-%out = QString::fromUcs4((const uint *)unicode);
-# else
-%out = QString::fromUtf16((const ushort *)unicode, PepUnicode_GetLength(%in));
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+%out = QString::fromUcs4(reinterpret_cast<const char32_t *>(unicode));
+# else
+%out = QString::fromUcs4(reinterpret_cast<const uint *>(unicode));
+# endif // Qt 6
+# else // Py_UNICODE_WIDE
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+%out = QString::fromUtf16(reinterpret_cast<const char16_t *>(unicode), PepUnicode_GetLength(%in));
+# else
+%out = QString::fromUtf16(reinterpret_cast<const ushort *>(unicode), PepUnicode_GetLength(%in));
+# endif // Qt 6
# endif
#else
wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL);