From 2d8b80bb9c623c246c3815c3fd32cbd6392dc27b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 12 Sep 2019 11:03:07 +0200 Subject: QList: make cast from ptrdiff_t to int explicit Amends ffc2d5722317fcab86865b11491d7bf7fef3e16d. Fixes: QTBUG-78235 Change-Id: Ie91d8d71c92bb62e3268847407b7b252c382d700 Reviewed-by: Marc Mutz --- src/corelib/tools/qlist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 74b57f7ad4..a98a9147d6 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -1031,7 +1031,7 @@ int lastIndexOf(const QList &list, const U &u, int from) Node *n = reinterpret_cast(list.p.at(from + 1)); while (n-- != b) { if (n->t() == u) - return typename QList::difference_type(n - b); + return int(n - b); } } return -1; -- cgit v1.2.3 From d448f2ecb8bca7de1e69f9f6f10d0ffb8c3d1beb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 23 Sep 2019 16:46:07 +0200 Subject: Correct handling of -qfloat16(0) It is finite and normal; it classifies as a zero; and it should not be > qfloat16(0). Added tests to match. Change-Id: I7874fb54f622b4cdf28b0894050ad3e75cf5d77c Reviewed-by: Thiago Macieira --- src/corelib/global/qfloat16.cpp | 2 +- src/corelib/global/qfloat16.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 2ba4c79374..6c21b7de5a 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -155,7 +155,7 @@ QT_BEGIN_NAMESPACE int qfloat16::fpClassify() const noexcept { return isInf() ? FP_INFINITE : isNaN() ? FP_NAN - : !b16 ? FP_ZERO : isNormal() ? FP_NORMAL : FP_SUBNORMAL; + : !(b16 & 0x7fff) ? FP_ZERO : isNormal() ? FP_NORMAL : FP_SUBNORMAL; } /*! \fn int qRound(qfloat16 value) diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 4d1aa91349..9a4f1800a4 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -94,7 +94,7 @@ public: static constexpr qfloat16 _limit_quiet_NaN() noexcept { return qfloat16(Wrap(0x7e00)); } // Signalling NaN is 0x7f00 inline constexpr bool isNormal() const noexcept - { return b16 == 0 || ((b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00); } + { return (b16 & 0x7fff) == 0 || ((b16 & 0x7c00) && (b16 & 0x7c00) != 0x7c00); } private: quint16 b16; constexpr inline explicit qfloat16(Wrap nibble) noexcept : b16(nibble.b16) {} @@ -296,7 +296,7 @@ class numeric_limits : public numeric_limits> 15 (sign) + uint S: 1; // b16 >> 15 (sign); can be set for zero uint E: 5; // (b16 >> 10) & 0x1f (offset exponent) uint M: 10; // b16 & 0x3ff (adjusted mantissa) -- cgit v1.2.3 From 932805807123833bb8f5ae9abda7e946f48d9f0c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Oct 2019 07:56:16 -0700 Subject: Fix crash when running QtCore: Stack is misaligned on x86-64 When our ELF entry point function is started by the kernel, the stack is aligned at 16 bytes. However, the stack is expected to be off by 8, due to a preceding CALL instruction which didn't exist. This cauases a crash further down as the compiler may generate aligned stack access. Change-Id: I1496b069cc534f1a838dfffd15c9dc4ef9e3869e Reviewed-by: Edward Welbourne --- src/corelib/global/qlibraryinfo.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 5634d6e6c3..f2ada4ab30 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -709,10 +709,14 @@ QT_END_NAMESPACE #include "private/qcoreapplication_p.h" +QT_WARNING_DISABLE_GCC("-Wattributes") +QT_WARNING_DISABLE_CLANG("-Wattributes") +QT_WARNING_DISABLE_INTEL(2621) + extern const char qt_core_interpreter[] __attribute__((section(".interp"))) = ELF_INTERPRETER; -extern "C" void qt_core_boilerplate(); +extern "C" void qt_core_boilerplate() __attribute__((force_align_arg_pointer)); void qt_core_boilerplate() { printf("This is the QtCore library version " QT_BUILD_STR "\n" -- cgit v1.2.3 From 3afe4a402c18a0956cab31169d843018d1b7a6d3 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 3 Oct 2019 17:08:13 +0200 Subject: Convert a few sizeof(array)/sizeof(element0) fors to range fors Increases readability Change-Id: I81ea915517fd2cd6bc2780f37ba8d8097c63f44b Reviewed-by: Thiago Macieira Reviewed-by: Volker Hilsheimer --- src/corelib/io/qsettings.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 4a119a1e2f..fc7122d904 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -746,7 +746,6 @@ bool QSettingsPrivate::iniUnescapedStringList(const QByteArray &str, int from, i { '\'', '\'' }, { '\\', '\\' } }; - static const int numEscapeCodes = sizeof(escapeCodes) / sizeof(escapeCodes[0]); bool isStringList = false; bool inQuotedString = false; @@ -770,9 +769,9 @@ StNormal: goto end; ch = str.at(i++); - for (int j = 0; j < numEscapeCodes; ++j) { - if (ch == escapeCodes[j][0]) { - stringResult += QLatin1Char(escapeCodes[j][1]); + for (const auto &escapeCode : escapeCodes) { + if (ch == escapeCode[0]) { + stringResult += QLatin1Char(escapeCode[1]); goto StNormal; } } -- cgit v1.2.3 From 9a9bdebb92eda34939c8a7442f06d24ded82b799 Mon Sep 17 00:00:00 2001 From: Kavindra Palaraja Date: Tue, 1 Oct 2019 08:18:54 +0200 Subject: docs: Mark QPair and QLatin1Char as reentrant Change-Id: I7d37eb13809a6fa4d1c2c74fd8aea35bdf235996 Fixes: QTBUG-78552 Reviewed-by: Andy Shaw --- src/corelib/text/qchar.cpp | 1 + src/corelib/tools/qpair.qdoc | 1 + 2 files changed, 2 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp index d959c55bb7..9b03a93278 100644 --- a/src/corelib/text/qchar.cpp +++ b/src/corelib/text/qchar.cpp @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE /*! \class QLatin1Char \inmodule QtCore + \reentrant \brief The QLatin1Char class provides an 8-bit ASCII/Latin-1 character. \ingroup string-processing diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index 59e6931995..65576ef2e6 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -28,6 +28,7 @@ /*! \class QPair \inmodule QtCore + \reentrant \brief The QPair class is a template class that stores a pair of items. \ingroup tools -- cgit v1.2.3 From 91a869671eaf16bb8502141f1eb00a38312aa3d5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 27 Sep 2019 03:14:45 +0200 Subject: CMake: generate moc files for headers using Q_NAMESPACE_EXPORT too Commit f66c1db16c050c introduced Q_NAMESPACE_EXPORT and cmake automoc needs to be told to trigger moc creation for headers using that. The default value for this variable, from cmake's Modules/CMakeGenericSystem.cmake is set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE") But it makes more sense to set this here than in upstream cmake, anyway, given that changes to this list happen here in qtbase. Change-Id: I07c85fd0bb5e03e98df7687a8663e28620e1fdb6 Reviewed-by: Simon Hausmann --- src/corelib/Qt5CoreConfigExtras.cmake.in | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index e0652fdcf9..659faac6a5 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -46,6 +46,8 @@ if (NOT TARGET Qt5::rcc) ) endif() +set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT") + set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake) set(Qt5Core_MOC_EXECUTABLE Qt5::moc) set(Qt5Core_RCC_EXECUTABLE Qt5::rcc) -- cgit v1.2.3 From d3be61d965ea13d972e7b64c7fe6a2ef0cc8eeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 27 Sep 2019 12:28:49 +0200 Subject: Fix unused function warning for prefixFromQtCoreLibraryHelper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iedbe0e9363b6bd97071b38aa1d4546777b34139d Reviewed-by: Simon Hausmann Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qlibraryinfo.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 52ad471e71..6476b7404a 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -495,6 +495,8 @@ static QString prefixFromAppDirHelper() #endif #if !defined(QT_BUILD_QMAKE) && QT_CONFIG(relocatable) +#if !defined(QT_STATIC) && !(defined(Q_OS_DARWIN) && QT_CONFIG(framework)) \ + && (QT_CONFIG(dlopen) || defined(Q_OS_WIN)) static QString prefixFromQtCoreLibraryHelper(const QString &qtCoreLibraryPath) { const QString qtCoreLibrary = QDir::fromNativeSeparators(qtCoreLibraryPath); @@ -503,6 +505,7 @@ static QString prefixFromQtCoreLibraryHelper(const QString &qtCoreLibraryPath) + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH); return QDir::cleanPath(prefixDir); } +#endif #if defined(Q_OS_WIN) #if defined(Q_OS_WINRT) -- cgit v1.2.3 From d1a9815a438c87893a4d19f5e46f14315f74ad7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 2 Oct 2019 15:36:43 +0200 Subject: macOS: Add missing export of QDebug stream operator for QMacAutoReleasePool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id3e140bd91dcbf2683a41cd9ac36ff79b8f365b4 Reviewed-by: Thiago Macieira Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 3266dc10a8..270b8fcf0f 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -168,7 +168,7 @@ Q_CORE_EXPORT bool qt_mac_applicationIsInDarkMode(); #endif #ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool); +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool); #endif Q_CORE_EXPORT bool qt_apple_isApplicationExtension(); -- cgit v1.2.3 From 191eb076a9b3f54b50d8c6d50039c59c03ae0483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 2 Oct 2019 15:37:59 +0200 Subject: Add explicit QDebug stream operator for QCFString Disambiguates between the QString and CFStringRef overloads. Change-Id: I55a7121cd7449b4adc081f6bb7e29736e7af4442 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcore_mac_objc.mm | 6 ++++++ src/corelib/kernel/qcore_mac_p.h | 1 + 2 files changed, 7 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 9e9e71c397..b1f3b74cd4 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -211,6 +211,12 @@ QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool) debug << "QMacAutoReleasePool(" << (const void *)pool << ')'; return debug; } + +QDebug operator<<(QDebug debug, const QCFString &string) +{ + debug << static_cast(string); + return debug; +} #endif // !QT_NO_DEBUG_STREAM #ifdef Q_OS_MACOS diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 270b8fcf0f..d03e2f3738 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -169,6 +169,7 @@ Q_CORE_EXPORT bool qt_mac_applicationIsInDarkMode(); #ifndef QT_NO_DEBUG_STREAM Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool); +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QCFString &string); #endif Q_CORE_EXPORT bool qt_apple_isApplicationExtension(); -- cgit v1.2.3 From f21ecb5657ee679f4c988de1bcd8d66b32952dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 2 Oct 2019 15:39:17 +0200 Subject: Simplify creating QCFTypes from CFTypeRefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of forcing the user to cast: QCFType foo = (CFFooRef)CFFunctionReturningCFTypeRef()); We can do it for them, since we already know the expected type: auto foo = QCFType(CFFunctionReturningCFTypeRef)); Change-Id: I994d5d6530f220288b4bfd6ab16eae9f159ce3ef Reviewed-by: Thiago Macieira Reviewed-by: Tor Arne Vestbø --- src/corelib/kernel/qcore_mac_p.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index d03e2f3738..535d3579b2 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -137,8 +137,10 @@ private: template class QCFType : public QAppleRefCounted { + using Base = QAppleRefCounted; public: - using QAppleRefCounted::QAppleRefCounted; + using Base::Base; + explicit QCFType(CFTypeRef r) : Base(static_cast(r)) {} template X as() const { return reinterpret_cast(this->value); } static QCFType constructFromGet(const T &t) { @@ -151,6 +153,7 @@ public: class Q_CORE_EXPORT QCFString : public QCFType { public: + using QCFType::QCFType; inline QCFString(const QString &str) : QCFType(0), string(str) {} inline QCFString(const CFStringRef cfstr = 0) : QCFType(cfstr) {} inline QCFString(const QCFType &other) : QCFType(other) {} -- cgit v1.2.3 From 0118e2e9151ae3e1e1cd72f24e8c129eaa69dc4f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 29 Apr 2019 12:33:55 +0200 Subject: Include likely-adjusted uiLanguages for the system locale QLocale::uiLanguages() on the system locale uses whatever the system locale's query(QSystemLocale::UILanguages,...) returns. On Android, this is just a list of locales. However, for non-system locales, we also include some results of removing likely sub-tags from the locale name, where equivalent. Thus zh-CN would also get zh and zh-Hans-CN added to it; however, if the system locale is zh-Hans-CN, the shorter forms are omitted. So post-process the system locale list in the same way, albeit tweaked to avoid duplicates and rearranged so that we can insert likely-adjusted entries between what they adjust and what followed it. Added QLocalePrivate::rawName() in the process, since it looks likely to be useful in other contexts (and I needed its value): it just joins such tags as are non-Any. This, however, uses QByteArrayList, so added that (it's small) to the bootstrap library and qmake. This follows up on commit 8796e3016fae1672e727e2fa4e48f671a0c667ba. [ChangeLog][QtCore][QLocale] The system locale's UI languages list now includes, as for that of an ordinary locale, the results of adding likely sub-tags from each locale name, and of removing some, where this doesn't change which locale is specified. This gives searches for translation files a better chance of finding a suitable file. Fixes: QTBUG-75413 Change-Id: Iaafd79aac6a0fdd5f44aed16e445e84a2267c9da Reviewed-by: Paul Wicking Reviewed-by: Qt CI Bot Reviewed-by: Thiago Macieira --- src/corelib/text/qlocale.cpp | 82 +++++++++++++++++++++++++++++++++++--------- src/corelib/text/qlocale_p.h | 1 + 2 files changed, 67 insertions(+), 16 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 48d57e5e6e..75a5bc802e 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -345,6 +345,23 @@ QByteArray QLocalePrivate::bcp47Name(char separator) const return localeId.withLikelySubtagsRemoved().name(separator); } +/*! + \internal + */ +QByteArray QLocalePrivate::rawName(char separator) const +{ + QByteArrayList parts; + if (m_data->m_language_id != QLocale::AnyLanguage) + parts.append(languageCode().latin1()); + if (m_data->m_script_id != QLocale::AnyScript) + parts.append(scriptCode().latin1()); + if (m_data->m_country_id != QLocale::AnyCountry) + parts.append(countryCode().latin1()); + + return parts.join(separator); +} + + static const QLocaleData *findLocaleDataById(const QLocaleId &lid) { QLocaleId localeId = lid.withLikelySubtagsAdded(); @@ -4367,30 +4384,63 @@ QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats */ QStringList QLocale::uiLanguages() const { + QStringList uiLanguages; + QVector locales; #ifndef QT_NO_SYSTEMLOCALE if (d->m_data == systemData()) { QVariant res = systemLocale()->query(QSystemLocale::UILanguages, QVariant()); if (!res.isNull()) { - QStringList result = res.toStringList(); - if (!result.isEmpty()) - return result; + uiLanguages = res.toStringList(); + // ... but we need to include likely-adjusted forms of each of those, too: + for (const auto entry : qAsConst(uiLanguages)) + locales.append(QLocale(entry)); } - } + } else #endif - QLocaleId id = QLocaleId::fromIds(d->m_data->m_language_id, d->m_data->m_script_id, - d->m_data->m_country_id); - const QLocaleId max = id.withLikelySubtagsAdded(); - const QLocaleId min = max.withLikelySubtagsRemoved(); + { + locales.append(*this); + } + for (int i = locales.size(); i-- > 0; ) { + const QLocale &locale = locales.at(i); + int j; + QByteArray prior; + if (i < uiLanguages.size()) { + // Adding likely-adjusted forms to system locale's list. + // Name the locale is derived from: + const QString &name = uiLanguages.at(i); + prior = name.toLatin1(); + // Don't try to likely-adjust if construction's likely-adjustments + // were so drastic the result doesn't match the prior name: + if (locale.name() != name && locale.d->rawName() != prior) + continue; + // Insert just after prior: + j = i + 1; + } else { + // Plain locale, not system locale; just append. + j = uiLanguages.size(); + } + const auto data = locale.d->m_data; + + QLocaleId id + = QLocaleId::fromIds(data->m_language_id, data->m_script_id, data->m_country_id); + const QLocaleId max = id.withLikelySubtagsAdded(); + const QLocaleId min = max.withLikelySubtagsRemoved(); + id.script_id = 0; // For re-use as script-less variant. + + // Include version with all likely sub-tags (last) if distinct from the rest: + if (max != min && max != id && max.name() != prior) + uiLanguages.insert(j, QString::fromLatin1(max.name())); + + // Include scriptless version if likely-equivalent and distinct: + if (data->m_script_id && id != min && id.name() != prior + && id.withLikelySubtagsAdded() == max) { + uiLanguages.insert(j, QString::fromLatin1(id.name())); + } - QStringList uiLanguages; - uiLanguages.append(QString::fromLatin1(min.name())); - if (id.script_id) { - id.script_id = 0; - if (id != min && id.withLikelySubtagsAdded() == max) - uiLanguages.append(QString::fromLatin1(id.name())); + // Include minimal version (first) unless it's what our locale is derived from: + if (min.name() != prior) + uiLanguages.insert(j, QString::fromLatin1(min.name())); } - if (max != min && max != id) - uiLanguages.append(QString::fromLatin1(max.name())); return uiLanguages; } diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index 5ebed9b385..edee3a89c7 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -359,6 +359,7 @@ public: quint16 countryId() const { return m_data->m_country_id; } QByteArray bcp47Name(char separator = '-') const; + QByteArray rawName(char separator = '-') const; inline QLatin1String languageCode() const { return languageToCode(QLocale::Language(m_data->m_language_id)); } inline QLatin1String scriptCode() const { return scriptToCode(QLocale::Script(m_data->m_script_id)); } -- cgit v1.2.3 From a2e718a71abad719ea196e9dc4d90d9267102f54 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 27 Sep 2019 09:55:23 +0200 Subject: QSysInfo::prettyProductName(): Fix up dc042c6deea7e90b4a9dfcffdc33cbe61df421bd - Fix indentation - Fix empty name returned for WinRT. - Remove duplicated string "Version" for Windows 10 Change-Id: Ia093006a6f8d8c88257d6b4e31afa37510dc6037 Reviewed-by: Volker Hilsheimer --- src/corelib/global/qglobal.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 123aeb1f7c..17aab17fe4 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2940,11 +2940,10 @@ QString QSysInfo::prettyProductName() if (!name) return result + versionString; result += QLatin1String(name); -# if !defined(Q_OS_WIN) - return result + QLatin1String(" (") + versionString + QLatin1Char(')'); -# else +# if !defined(Q_OS_WIN) || defined(Q_OS_WINRT) + return result + QLatin1String(" (") + versionString + QLatin1Char(')'); +# else // (resembling winver.exe): Windows 10 "Windows 10 Version 1809" - result += QLatin1String(" Version "); if (majorVersion >= 10) { const auto releaseId = windows10ReleaseId(); if (!releaseId.isEmpty()) @@ -2952,7 +2951,7 @@ QString QSysInfo::prettyProductName() return result; } // Windows 7: "Windows 7 Version 6.1 (Build 7601: Service Pack 1)" - result += versionString + QLatin1String(" ("); + result += QLatin1String(" Version ") + versionString + QLatin1String(" ("); const auto build = windows7Build(); if (!build.isEmpty()) result += QLatin1String("Build ") + build; @@ -2960,7 +2959,7 @@ QString QSysInfo::prettyProductName() if (!servicePack.isEmpty()) result += QLatin1String(": ") + servicePack; return result + QLatin1Char(')'); -# endif // Windows +# endif // Windows #elif defined(Q_OS_HAIKU) return QLatin1String("Haiku ") + productVersion(); #elif defined(Q_OS_UNIX) -- cgit v1.2.3