From 05d29aa4e352656c4d44bb2d734385faee30fe9d Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Tue, 9 Mar 2021 09:11:09 -0500 Subject: [PATCH] UI: Set default string size arg for QT_UTF8 / QString::fromUtf8 Our QT_UTF8(str) macro uses QString::fromUtf8(str) with no size argument. In Qt5, QString::fromUtf8 uses a default value of -1 for the size arg. If size is -1, it is taken to be strlen(str). In Qt6, QString::fromUtf8 doesn't use a default value for the size arg, but has the same behavior if you manually specify -1 for the size. Let's manually specify -1 to maintain the same behavior between Qt5 and Qt6. https://doc.qt.io/qt-5/qstring.html#fromUtf8 https://doc.qt.io/qt-6/qstring.html#fromUtf8 --- UI/qt-wrappers.hpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/UI/qt-wrappers.hpp b/UI/qt-wrappers.hpp index 89948df06..2ca6ff318 100644 --- a/UI/qt-wrappers.hpp +++ b/UI/qt-wrappers.hpp @@ -28,12 +28,7 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #define QT_UTF8(str) QString::fromUtf8(str, -1) -#else -#define QT_UTF8(str) QString::fromUtf8(str) -#endif - #define QT_TO_UTF8(str) str.toUtf8().constData() class QDataStream;