From 30f4ca4e4fbc1d8cf86808dbeb00ec3c046f6c1c Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 14 Feb 2019 04:06:27 +1000 Subject: [PATCH 01/24] wasm: fix building examples and applications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a bug where app build would fail with AssertionError: SIMD is used, but not supported in WASM mode yet This patch was wiped out by the recent freetype update and is exactly the same as 44b91a619d14932635e9a3fe155de4df9f98a25c Fixes: QTBUG-79938 Change-Id: Iaa8f23c83d0488ddd351454a674a6cad76e7cc8b Reviewed-by: Edward Welbourne Reviewed-by: Liang Qi Reviewed-by: Morten Johan Sørvig --- src/3rdparty/freetype/src/sfnt/pngshim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/freetype/src/sfnt/pngshim.c b/src/3rdparty/freetype/src/sfnt/pngshim.c index ca85d9751f..fc78b6d5df 100644 --- a/src/3rdparty/freetype/src/sfnt/pngshim.c +++ b/src/3rdparty/freetype/src/sfnt/pngshim.c @@ -68,6 +68,7 @@ ( ( __clang_major__ >= 4 ) || \ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ defined( __OPTIMIZE__ ) && \ + !defined( __EMSCRIPTEN__ ) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __clang__ From 103d307f2e596e5e7d2eb706117223bf65264e5f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 30 Sep 2019 12:00:43 -0700 Subject: [PATCH 02/24] Be explicit about QDataStream serialization: explicit casts to int The reader uses int variables, so use the same in the writer. Change-Id: I1496b069cc534f1a838dfffd15c94c7cacd3dd93 Reviewed-by: Laszlo Agocs --- src/gui/rhi/qshader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index c22b029dc8..9d35d83336 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -348,10 +348,10 @@ void QShader::removeShader(const QShaderKey &key) static void writeShaderKey(QDataStream *ds, const QShaderKey &k) { - *ds << k.source(); + *ds << int(k.source()); *ds << k.sourceVersion().version(); *ds << k.sourceVersion().flags(); - *ds << k.sourceVariant(); + *ds << int(k.sourceVariant()); } /*! @@ -369,7 +369,7 @@ QByteArray QShader::serialized() const return QByteArray(); ds << QSB_VERSION; - ds << d->stage; + ds << int(d->stage); ds << d->desc.toBinaryJson(); ds << d->shaders.count(); for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) { From ad11cab4842a4d35fe80641ae3eec7f2d8817652 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 10 Aug 2018 12:17:49 +0200 Subject: [PATCH 03/24] Allow longer time-zone components on Android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Android uses its own time-zone naming, which includes a zone called "Canada/East-Saskatchewan", whose second component is 17 characters long. This violates a rule in the IANA naming scheme for zones, that limits components to 14 characters each. So tweak the isValidId() check to allow Android its long names. Android has added Outer Mongolian time-zones, which are as borked as many others in 1970, so blacklist those transitionEachZone() tests. Fixes: QTBUG-69128 Change-Id: I46f674f095431335b16900860d83b624257ae3bb Reviewed-by: Jan Arve Sæther --- src/corelib/time/qtimezoneprivate.cpp | 6 ++++++ tests/auto/corelib/time/qtimezone/BLACKLIST | 12 ++++++++---- tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | 11 +++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/corelib/time/qtimezoneprivate.cpp b/src/corelib/time/qtimezoneprivate.cpp index 569b343187..00dc8b4ced 100644 --- a/src/corelib/time/qtimezoneprivate.cpp +++ b/src/corelib/time/qtimezoneprivate.cpp @@ -632,7 +632,13 @@ bool QTimeZonePrivate::isValidId(const QByteArray &ianaId) // Somewhat slack hand-rolled version: const int MinSectionLength = 1; +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + // Android has its own naming of zones. + // "Canada/East-Saskatchewan" has a 17-character second component. + const int MaxSectionLength = 17; +#else const int MaxSectionLength = 14; +#endif int sectionLength = 0; for (const char *it = ianaId.begin(), * const end = ianaId.end(); it != end; ++it, ++sectionLength) { const char ch = *it; diff --git a/tests/auto/corelib/time/qtimezone/BLACKLIST b/tests/auto/corelib/time/qtimezone/BLACKLIST index 840c3b1181..b820bab3d9 100644 --- a/tests/auto/corelib/time/qtimezone/BLACKLIST +++ b/tests/auto/corelib/time/qtimezone/BLACKLIST @@ -2,10 +2,6 @@ [dataStreamTest] android -# QTBUG-69128 -[isTimeZoneIdAvailable] -android - # QTBUG-69129 [specificTransition] android @@ -75,10 +71,14 @@ android android [transitionEachZone:Asia/Chita@1970] android +[transitionEachZone:Asia/Choibalsan@1970] +android [transitionEachZone:Asia/Dushanbe@1970] android [transitionEachZone:Asia/Ho_Chi_Minh@1970] android +[transitionEachZone:Asia/Hovd@1970] +android [transitionEachZone:Asia/Kathmandu@1970] android [transitionEachZone:Asia/Katmandu@1970] @@ -109,6 +109,10 @@ android android [transitionEachZone:Asia/Thimphu@1970] android +[transitionEachZone:Asia/Ulaanbaatar@1970] +android +[transitionEachZone:Asia/Ulan_Bator@1970] +android [transitionEachZone:Asia/Ust-Nera@1970] android [transitionEachZone:Atlantic/Cape_Verde@1970] diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index 9f51ff8ba8..f425691d9c 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -706,6 +706,7 @@ void tst_QTimeZone::isValidId_data() // a-z, A-Z, 0-9, '.', '-', '_' are valid chars // Can't start with '-' // Parts separated by '/', each part min 1 and max of 14 chars + // (Android has parts with lengths up to 17, so tolerates this as a special case.) #define TESTSET(name, section, valid) \ QTest::newRow(name " front") << QByteArray(section "/xyz/xyz") << valid; \ QTest::newRow(name " middle") << QByteArray("xyz/" section "/xyz") << valid; \ @@ -713,8 +714,13 @@ void tst_QTimeZone::isValidId_data() TESTSET("empty", "", false); TESTSET("minimal", "m", true); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + TESTSET("maximal", "East-Saskatchewan", true); // Android actually uses this + TESTSET("too long", "North-Saskatchewan", false); // ... but thankfully not this. +#else TESTSET("maximal", "12345678901234", true); TESTSET("too long", "123456789012345", false); +#endif TESTSET("bad hyphen", "-hyphen", false); TESTSET("good hyphen", "hy-phen", true); @@ -759,8 +765,13 @@ void tst_QTimeZone::isValidId_data() QTest::newRow("a,z alone") << QByteArray("a,z") << false; QTest::newRow("/z alone") << QByteArray("/z") << false; QTest::newRow("-z alone") << QByteArray("-z") << false; +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + QTest::newRow("long alone") << QByteArray("12345678901234567") << true; + QTest::newRow("over-long alone") << QByteArray("123456789012345678") << false; +#else QTest::newRow("long alone") << QByteArray("12345678901234") << true; QTest::newRow("over-long alone") << QByteArray("123456789012345") << false; +#endif #else QSKIP("This test requires a Qt -developer-build."); From 80ac9e8b7ce8e3f79af0b00610a0a4b0ff17abe4 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 12 Nov 2019 17:59:51 +0100 Subject: [PATCH 04/24] Compile fix for MinGW 8.1.0 Workaround for libpng bug in GCC 8.1.0. Task-number: QTQAINFRA-3303 Change-Id: Id7668e795cb4ab16de3199fc3727d844aa31bfad Reviewed-by: Ville Voutilainen --- src/gui/image/image.pri | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 3b2ced3f58..1f42f28d1e 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -79,6 +79,14 @@ qtConfig(png) { HEADERS += image/qpnghandler_p.h SOURCES += image/qpnghandler.cpp QMAKE_USE_PRIVATE += libpng + + win32:mingw { + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86048 + GCC_VERSION = "$${QMAKE_GCC_MAJOR_VERSION}.$${QMAKE_GCC_MINOR_VERSION}.$${QMAKE_GCC_PATCH_VERSION}" + equals(GCC_VERSION, "8.1.0") { + QMAKE_CXXFLAGS += -fno-reorder-blocks-and-partition + } + } } # SIMD From c15a069830baf87f57c84e86326cf86ba9a39713 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 12 Jun 2019 20:49:06 +0200 Subject: [PATCH 05/24] QTreeView: make sure to not ask the old model during setModel Within QTreeView::setModel() the header might emit columnCountChanged which then tries to update the geometries based on the old model which is wrong. Fix it by setting geometryRecursionBlock to true so QTreeView::updateGeometries() will not ask the old model for it's data. Fixes: QTBUG-75982 Change-Id: Ia0dd36cd7c6c5347fbc285deac43da6941accbe7 Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qtreeview.cpp | 2 ++ .../widgets/itemviews/qtreeview/tst_qtreeview.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 413cc2a9cd..034c1f4b4f 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -233,7 +233,9 @@ void QTreeView::setModel(QAbstractItemModel *model) d->viewItems.clear(); d->expandedIndexes.clear(); d->hiddenIndexes.clear(); + d->geometryRecursionBlock = true; // do not update geometries due to signals from the headers d->header->setModel(model); + d->geometryRecursionBlock = false; QAbstractItemView::setModel(model); // QAbstractItemView connects to a private slot diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 44195d3b25..58ca924fe2 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -2862,6 +2862,7 @@ public: }; Node *root; + bool crash = false; EvilModel(QObject *parent = nullptr): QAbstractItemModel(parent), root(new Node) {} @@ -2870,6 +2871,11 @@ public: delete root; } + void setCrash() + { + crash = true; + } + void change() { emit layoutAboutToBeChanged(); @@ -2938,6 +2944,10 @@ public: QVariant data(const QModelIndex &idx, int role) const override { + if (crash) { + QTest::qFail("Should not get here...", __FILE__, __LINE__); + return QVariant(); + } if (idx.isValid() && role == Qt::DisplayRole) { Node *parentNode = root; if (idx.isValid()) { @@ -2957,6 +2967,7 @@ void tst_QTreeView::evilModel_data() { QTest::addColumn("visible"); QTest::newRow("visible") << false; + QTest::newRow("visible") << true; } void tst_QTreeView::evilModel() @@ -3126,6 +3137,9 @@ void tst_QTreeView::evilModel() model.change(); view.setRootIndex(secondLevel); + + model.setCrash(); + view.setModel(nullptr); } void tst_QTreeView::indexRowSizeHint() From 9f48f1ebc21f783cd8bb7daab942d70aebf085bc Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 15 Jun 2017 15:07:35 +0200 Subject: [PATCH 06/24] QLineEdit: Fix End key for input masks Consider this simple example: QLineEdit edit; edit.setInputMask( "9-9-9-9-9-9" ); edit.show(); Without any input, m_text will contain: " - - - - - ". text() removes the input mask's mask characters from that and returns " ". A string with 6 spaces. Thus currently the End key jumps to position 6, which is in the middle of the string. Using m_text the End key jumps to the actual end. [ChangeLog][QtWidgets][QLineEdit] Fixed End key in combination with certain input masks. Task-number: QTBUG-16187 Task-number: QTBUG-20414 Change-Id: Ibb30a1dfa2f78103611b5afc9971dc43e8bdcc4a Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qwidgetlinecontrol_p.h | 2 +- tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 8ebed25084..a8fffd23dc 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -217,7 +217,7 @@ public: void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); } void home(bool mark) { moveCursor(0, mark); } - void end(bool mark) { moveCursor(text().length(), mark); } + void end(bool mark) { moveCursor(m_text.length(), mark); } int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const; QRect rectForPos(int pos) const; diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 0cfbc651ad..d37fb5c173 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -760,6 +760,14 @@ void tst_QLineEdit::keypress_inputMask_data() keys.addKeyClick(Qt::Key_Delete); QTest::newRow("deleting all") << QString("000.000;_") << keys << QString(".") << QString("___.___"); } + { + QTestEventList keys; + // inserting at end + addKeySequenceStandardKey(keys, QKeySequence::MoveToEndOfLine); + keys.addKeyClick(Qt::Key_Left); + keys.addKeyClick(Qt::Key_0); + QTest::newRow("insert at end") << QString("9-9-9") << keys << QString("--0") << QString(" - -0"); + } { QTestEventList keys; // inserting '12.12' then two backspaces From 54f5b8975055f1d48c74efab085acd6338aa1e3c Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 12 Nov 2019 10:46:00 +0100 Subject: [PATCH 07/24] Fix: QIcon high dpi scaling when aspect ratio differs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an icon engine is asked to produce a pixmap scaled to a certain size, it may return one with a different aspect ratio than requested. In particular, an SVG will use its own aspect ratio, as it should. QIcon's DPR calculation would break down in this case, resulting in ugly scaling. Fixes: QTBUG-79371 Change-Id: Id97049259dcee1a2980474250ef1163be5639085 Reviewed-by: Morten Johan Sørvig --- src/gui/image/qicon.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index df8220a0c6..0fe4cd45cb 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -165,6 +165,11 @@ QIconPrivate::QIconPrivate(QIconEngine *e) qreal QIconPrivate::pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize) { QSize targetSize = requestedSize * displayDevicePixelRatio; + if ((actualSize.width() == targetSize.width() && actualSize.height() <= targetSize.height()) || + (actualSize.width() <= targetSize.width() && actualSize.height() == targetSize.height())) { + // Correctly scaled for dpr, just having different aspect ratio + return displayDevicePixelRatio; + } qreal scale = 0.5 * (qreal(actualSize.width()) / qreal(targetSize.width()) + qreal(actualSize.height() / qreal(targetSize.height()))); return qMax(qreal(1.0), displayDevicePixelRatio *scale); From 61def1f6cdf2eff521f77c9186fc3bb929359ab9 Mon Sep 17 00:00:00 2001 From: Florian Korsakissok Date: Wed, 13 Nov 2019 13:46:24 +0100 Subject: [PATCH 08/24] HiDPI: Select most fitting pixel ratio when painting QIcon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a way to select a better pixel ratio when the QPainter has a valid pointer to a QPaintDevice than simply getting the global app pixel ratio. Change-Id: I8f89fd01094bbac7a01a83be89991730b0fa6597 Reviewed-by: Thorbjørn Lund Martsum --- src/gui/image/qicon.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 0fe4cd45cb..84e387e317 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -190,7 +190,12 @@ QPixmapIconEngine::~QPixmapIconEngine() void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) { - QSize pixmapSize = rect.size() * qt_effective_device_pixel_ratio(0); + qreal dpr = 1.0; + if (QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps)) { + auto paintDevice = painter->device(); + dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio(); + } + const QSize pixmapSize = rect.size() * dpr; QPixmap px = pixmap(pixmapSize, mode, state); painter->drawPixmap(rect, px); } From 737fd5550bbbc727af18cc2ce43a71753ab95b95 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Oct 2019 21:16:49 -0700 Subject: [PATCH 09/24] Change the QtCore library output to show the plugin path It's a lot more useful than the include dir. It actually helps debug problems. Change-Id: I1496b069cc534f1a838dfffd15ca07fe8ad1c8c6 Reviewed-by: Edward Welbourne Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qlibraryinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8bcf67e73d..276741c9fb 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -887,10 +887,10 @@ void qt_core_boilerplate() "\n" "Installation prefix: %s\n" "Library path: %s\n" - "Include path: %s\n", + "Plugin path: %s\n", qt_configure_prefix_path_str + 12, qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1], - qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]); + qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::PluginsPath - 1]); QT_PREPEND_NAMESPACE(qDumpCPUFeatures)(); From 4218c3044d19d4f94de0bd673c83fa043f5604ae Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 13 Nov 2019 18:09:15 +0100 Subject: [PATCH 10/24] Revert "[macOS] Skip test that triggers a buffer overflow in CoreFoundation" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allegedly Apple has fixed the bug that made this necessary, so we should be able to include these two test-cases once more. This reverts commit ba9585bd02ba975013d73a75fa2382ffa708c990. Fixes: QTBUG-69875 Change-Id: I5ac6019c0d647691eda6cdbb2a53e7471859d4a3 Reviewed-by: Tor Arne Vestbø Reviewed-by: Qt CI Bot --- tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 3aa3d97dbc..20ed7500b5 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -595,10 +595,7 @@ void tst_QLocale::emptyCtor_data() ADD_CTOR_TEST("zz_zz", "C"); ADD_CTOR_TEST("zz...", "C"); ADD_CTOR_TEST("en.bla", "en_US"); -#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer)) - // See QTBUG-69875 ADD_CTOR_TEST("en@bla", "en_US"); -#endif ADD_CTOR_TEST("en_blaaa", "en_US"); ADD_CTOR_TEST("en_zz", "en_US"); ADD_CTOR_TEST("en_GB.bla", "en_GB"); @@ -607,10 +604,7 @@ void tst_QLocale::emptyCtor_data() // Empty optional fields, but with punctuators supplied ADD_CTOR_TEST("en.", "en_US"); -#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer)) - // See QTBUG-69875 ADD_CTOR_TEST("en@", "en_US"); -#endif ADD_CTOR_TEST("en.@", "en_US"); ADD_CTOR_TEST("en_", "en_US"); ADD_CTOR_TEST("en_.", "en_US"); From 52c8e9dc99b9405502d1a37b6406a55e5e156142 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 12 Nov 2019 21:56:09 +0100 Subject: [PATCH 11/24] Fix precompiled headers on macOS Since commit 059172c6 precompiled headers did not work anymore on macOS, because the ${QMAKE_PCH_ARCH} string was suddenly appearing in locations where it was not replaced with the actual architecture, e.g. the directory where the PCH files are written. Fix this by replacing the whole file path and not just portions of it. Fixes: QTBUG-79694 Change-Id: I925d4ee8980a0de3205a0e387a516a5c6f8cfa4b Reviewed-by: Alexandru Croitor Reviewed-by: BogDan Vatra Reviewed-by: Kai Koehne --- qmake/generators/unix/unixmake.cpp | 21 +++++++++++---------- qmake/generators/unix/unixmake2.cpp | 11 +++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index e56e8c41b6..f7bd6dc663 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -208,15 +208,15 @@ UnixMakefileGenerator::init() escapeFilePath(pchBaseName + language + headerSuffix)); const ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS"); for (const ProString &arch : pchArchs) { - QString suffix = headerSuffix; - suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); + QString file = pchBaseName + language + headerSuffix; + file.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); if (project->isActiveConfig("clang_pch_style") - && (suffix.endsWith(QLatin1String(".pch")) - || suffix.endsWith(QLatin1String(".gch")))) { - suffix.chop(4); // must omit header suffix for -include to recognize the PCH + && (file.endsWith(QLatin1String(".pch")) + || file.endsWith(QLatin1String(".gch")))) { + file.chop(4); // must omit header suffix for -include to recognize the PCH } pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'), - escapeFilePath(pchBaseName + language + suffix)); + escapeFilePath(file)); } } } @@ -363,10 +363,11 @@ QStringList if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH for (const ProString &arch : qAsConst(pchArchs)) { - QString suffix = header_suffix; - if (!arch.isEmpty()) - suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString()); - QString precompiledHeader = header_prefix + language + suffix; + QString precompiledHeader = header_prefix + language + header_suffix; + if (!arch.isEmpty()) { + precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"), + arch.toQString()); + } if (!ret.contains(precompiledHeader)) ret += precompiledHeader; } diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 20f2c88444..550fa9d834 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1017,10 +1017,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (pchArchs.isEmpty()) pchArchs << ProString(); // normal single-arch PCH for (const ProString &arch : qAsConst(pchArchs)) { - auto suffix = header_suffix.toQString(); + QString file = precomph_out_dir + header_prefix + language + header_suffix; if (!arch.isEmpty()) - suffix.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); - precomp_files += precomph_out_dir + header_prefix + language + suffix; + file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); + precomp_files += file; } } } @@ -1140,7 +1140,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile_f << "\n\trm -f " << escapeFilePath(pchArchOutput); } else { - t << "\n\t" << mkdir_p_asstring(pchOutputDir); + QString outDir = pchOutputDir; + if (!arch.isEmpty()) + outDir.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()); + t << "\n\t" << mkdir_p_asstring(outDir); } auto pchArchFlags = pchFlags; From c30ffe1d33e6f48fa94e2003d7c9b17f4c83a6e9 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Fri, 15 Nov 2019 09:08:22 +0100 Subject: [PATCH 12/24] Doc: Move the common documentation to a qdocinc The member functions of QStandardPath and Qt.labs.platform.StandardPath behave the same, so it's ideal to maintain their documentation in one place. Task-number: QTBUG-79827 Change-Id: I349dbb85cd9b6a3bedac329c0707fc07057cd64b Reviewed-by: Paul Wicking --- .../standardpath/functiondocs.qdocinc | 129 ++++++++++++++++++ src/corelib/io/qstandardpaths.cpp | 66 +-------- 2 files changed, 136 insertions(+), 59 deletions(-) create mode 100644 doc/global/includes/standardpath/functiondocs.qdocinc diff --git a/doc/global/includes/standardpath/functiondocs.qdocinc b/doc/global/includes/standardpath/functiondocs.qdocinc new file mode 100644 index 0000000000..4385b6446d --- /dev/null +++ b/doc/global/includes/standardpath/functiondocs.qdocinc @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [displayName] + + Returns a localized display name for the given location \a type + or an empty QString if no relevant location can be found. + +//! [displayName] + + +//! [findExecutable] + + Finds the executable named \a executableName in the specified + \a paths, or the system paths if paths is empty. + + On most operating systems the system path is determined by the + \c PATH environment variable. The directories where to search for + the executable can be set in the paths argument. To search in + both your own paths and the system paths, call findExecutable + twice, once with paths set and once with paths empty. + Symlinks are not resolved in order to preserve behavior for the + case of executables whose behavior depends on the name they are + invoked with + . + \note On Windows, the usual executable extensions (from the PATHEXT + environment variable) are automatically appended. For example, the + findExecutable("foo") call finds \c foo.exe or \c foo.bat if + present. + + Returns the absolute file path to the executable, or an empty + string if not found. + +//! [findExecutable] + +//! [locate] + + Finds a file or directory called \a fileName in the standard + locations for \a type. + + The \a options flag lets you specify whether to look for files + or directories. By default, this flag is set to \c LocateFile. + + Returns the absolute path to the first file or directory found, + otherwise returns an empty string. + +//! [locate] + +//! [locateAll] + + Finds all files or directories by the name, \a fileName, in the + standard locations for \a type. + + The \a options flag lets you specify whether to look for files + or directories. By default, this flag is set to \c LocateFile. + + Returns the list of all the files that were found. + +//! [locateAll] + +//! [setTestModeEnabled] + + If \a testMode is \c true, this enables a special "test mode" in + QStandardPaths, which changes writable locations to point to + test directories. This prevents auto tests from reading + or writing to the current user's configuration. + + It affects the locations into which test programs might write + files: \c GenericDataLocation, \c DataLocation, \c ConfigLocation, + \c GenericConfigLocation, \c AppConfigLocation, + \c GenericCacheLocation, and \c CacheLocation. Other locations + are not affected. + + On Unix, \c XDG_DATA_HOME is set to \c{~/.qttest/share}, + \c XDG_CONFIG_HOME is set to \c{~/.qttest/config}, and + \c XDG_CACHE_HOME is set to \c{~/.qttest/cache}. + + On macOS, data goes to \c{~/.qttest/Application Support}, + cache goes to \c{~/.qttest/Cache}, and config goes to + \c{~/.qttest/Preferences}. + + On Windows, everything goes to a "qttest" directory under + \c{%APPDATA%}. + +//! [setTestModeEnabled] + +//! [standardLocations] + + Returns all the directories where files of \a type belong. + + The list of directories is sorted from high to low priority, + starting with writableLocation() if it can be determined. + This list is empty if no locations for type are defined. + +//! [standardLocations] + +//! [writableLocation] + + Returns the directory where files of \a type should be written to, + or an empty string if the location cannot be determined. + + \note The storage location returned may not exist; that is, + it may need to be created by the system or the user. + +//! [writableLocation] diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 3b5f2f97da..6ebef3ee20 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -357,22 +357,14 @@ QT_BEGIN_NAMESPACE /*! \fn QString QStandardPaths::writableLocation(StandardLocation type) - Returns the directory where files of \a type should be written to, or an empty string - if the location cannot be determined. - - \note The storage location returned can be a directory that does not exist; i.e., it - may need to be created by the system or the user. + \include standardpath/functiondoc.qdocinc writableLocation */ /*! \fn QStringList QStandardPaths::standardLocations(StandardLocation type) - Returns all the directories where files of \a type belong. - - The list of directories is sorted from high to low priority, starting with - writableLocation() if it can be determined. This list is empty if no locations - for \a type are defined. + \include standardpath/functiondoc.qdocinc standardLocations \sa writableLocation() */ @@ -396,11 +388,7 @@ static bool existsAsSpecified(const QString &path, QStandardPaths::LocateOptions } /*! - Tries to find a file or directory called \a fileName in the standard locations - for \a type. - - The full path to the first file or directory (depending on \a options) found is returned. - If no such file or directory can be found, an empty string is returned. + \include standardpath/functiondoc.qdocinc locate */ QString QStandardPaths::locate(StandardLocation type, const QString &fileName, LocateOptions options) { @@ -414,12 +402,7 @@ QString QStandardPaths::locate(StandardLocation type, const QString &fileName, L } /*! - Tries to find all files or directories called \a fileName in the standard locations - for \a type. - - The \a options flag allows to specify whether to look for files or directories. - - Returns the list of all the files that were found. + \include standardpath/functiondoc.qdocinc locateAll */ QStringList QStandardPaths::locateAll(StandardLocation type, const QString &fileName, LocateOptions options) { @@ -492,23 +475,7 @@ static inline QString #endif // Q_OS_WIN /*! - Finds the executable named \a executableName in the paths specified by \a paths, - or the system paths if \a paths is empty. - - On most operating systems the system path is determined by the PATH environment variable. - - The directories where to search for the executable can be set in the \a paths argument. - To search in both your own paths and the system paths, call findExecutable twice, once with - \a paths set and once with \a paths empty. - - Symlinks are not resolved, in order to preserve behavior for the case of executables - whose behavior depends on the name they are invoked with. - - \note On Windows, the usual executable extensions (from the PATHEXT environment variable) - are automatically appended, so that for instance findExecutable("foo") will find foo.exe - or foo.bat if present. - - Returns the absolute file path to the executable, or an empty string if not found. + \include standardpath/functiondoc.qdocinc findExecutable */ QString QStandardPaths::findExecutable(const QString &executableName, const QStringList &paths) { @@ -566,10 +533,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr } /*! - \fn QString QStandardPaths::displayName(StandardLocation type) - - Returns a localized display name for the given location \a type or - an empty QString if no relevant location can be found. + \include standardpath/functiondoc.qdocinc displayName */ #if !defined(Q_OS_MAC) && !defined(QT_BOOTSTRAPPED) @@ -626,23 +590,7 @@ QString QStandardPaths::displayName(StandardLocation type) /*! \fn void QStandardPaths::setTestModeEnabled(bool testMode) - If \a testMode is true, this enables a special "test mode" in - QStandardPaths, which changes writable locations - to point to test directories, in order to prevent auto tests from reading from - or writing to the current user's configuration. - - This affects the locations into which test programs might write files: - GenericDataLocation, DataLocation, ConfigLocation, GenericConfigLocation, - AppConfigLocation, GenericCacheLocation, CacheLocation. - Other locations are not affected. - - On Unix, \c XDG_DATA_HOME is set to \e ~/.qttest/share, \c XDG_CONFIG_HOME is - set to \e ~/.qttest/config, and \c XDG_CACHE_HOME is set to \e ~/.qttest/cache. - - On \macos, data goes to \e ~/.qttest/Application Support, cache goes to - \e ~/.qttest/Cache, and config goes to \e ~/.qttest/Preferences. - - On Windows, everything goes to a "qttest" directory under Application Data. + \include standardpath/functiondoc.qdocinc setTestModeEnabled */ static bool qsp_testMode = false; From 17ec21e824fd1955658e4ee3fd4d627f93affe7e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 15 Nov 2019 10:16:57 +0100 Subject: [PATCH 13/24] Android: remove remaining reference to -android-toolchain-version This amends 65dfc485adc1c5de4840f217c47c6ad79d26ae82. Change-Id: I5e0ec7632befe0650138d1977d42313dc0acf3bf Reviewed-by: Joerg Bornemann --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index 19016d5c12..6657870e4b 100755 --- a/configure +++ b/configure @@ -446,8 +446,7 @@ while [ "$#" -gt 0 ]; do -android-ndk| \ -android-ndk-platform| \ -android-ndk-host| \ - -android-arch| \ - -android-toolchain-version) + -android-arch) VAR=`echo $1 | sed 's,^-\(.*\),\1,'` shift VAL="$1" From d17094df60d7d05bb583d26fb8d1de1a7a4fb072 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Nov 2019 14:40:51 +0100 Subject: [PATCH 14/24] Sub-Attaq: Fix compilation with -no-opengl Add missing include removed by 13426aff248c25b44ac377f37dc3e3a54ea0ea86. Fixes: QTBUG-80163 Change-Id: I6b81f399a3abf637a2023700baac09b631d652d5 Reviewed-by: Christian Ehrlicher --- examples/widgets/animation/sub-attaq/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/widgets/animation/sub-attaq/mainwindow.cpp b/examples/widgets/animation/sub-attaq/mainwindow.cpp index 8f545ecebd..f9617a22eb 100644 --- a/examples/widgets/animation/sub-attaq/mainwindow.cpp +++ b/examples/widgets/animation/sub-attaq/mainwindow.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #ifndef QT_NO_OPENGL From 6a7a4aac0a94650247d8578475a8725009d7d569 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 17 Nov 2019 00:11:21 +0100 Subject: [PATCH 15/24] Doc: add warning for binding values in QSqlQuery Not all SQL operations support binding values like the PRAGMA instruction of SQLite. This patch adds a warning for the developer to make it clearer that binding values cannot be used for everything. Task-number: QTBUG-80082 Change-Id: Ie1d33815d74a0759a3593df9410b8bad448f6fe9 Reviewed-by: Sze Howe Koh --- src/sql/kernel/qsqlquery.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index e7c444f5b9..34a3ba3755 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -182,6 +182,9 @@ QSqlQueryPrivate::~QSqlQueryPrivate() You can retrieve the values of all the fields in a single variable (a map) using boundValues(). + \note Not all SQL operations support binding values. Refer to your database + system's documentation to check their availability. + \section1 Approaches to Binding Values Below we present the same example using each of the four From 9567103f388af8f07042744706f0d5b9f0d18e22 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sun, 17 Nov 2019 20:09:00 +0800 Subject: [PATCH 16/24] qmake: Remove /O3 from win32-icc Use O3 causes warnings when combined with O2, so just remove it. Partially revert commit 11111c5a7d71024f281322d9b310ce37210fc4c2 Change-Id: Ifbf6e024e35933ecc3610d6efc3423589dab9a38 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- qmake/Makefile.win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 7324817af2..4e7724f14e 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -13,7 +13,7 @@ QMKSRC = $(SOURCE_PATH)\qmake !if "$(QMAKESPEC)" == "win32-icc" CXX = icl LINKER = xilink -CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11 /O3 +CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11 !elseif "$(QMAKESPEC)" == "win32-clang-msvc" CXX = clang-cl LINKER = lld-link From 54d5ca0c2766e915c960fa437cee6c20a324c1a7 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sat, 16 Nov 2019 16:53:08 +0100 Subject: [PATCH 17/24] Doc: improve Using Model Indexes in Model View Programming guide The current example using QFileSystemModel doesn't take into account the asynchronous nature of that model. This puts people on the wrong path on how to use it. This patch improves the snippet as well as the explanation steps. Change-Id: I5c7a3c19aad48847f0b965b5eb69b492d6263f51 Reviewed-by: Paul Wicking --- src/widgets/doc/snippets/simplemodel-use/main.cpp | 7 +++++-- src/widgets/doc/src/model-view-programming.qdoc | 13 +++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/widgets/doc/snippets/simplemodel-use/main.cpp b/src/widgets/doc/snippets/simplemodel-use/main.cpp index 3e106c8eea..940669e101 100644 --- a/src/widgets/doc/snippets/simplemodel-use/main.cpp +++ b/src/widgets/doc/snippets/simplemodel-use/main.cpp @@ -79,8 +79,11 @@ int main(int argc, char *argv[]) //! [0] QFileSystemModel *model = new QFileSystemModel; - QModelIndex parentIndex = model->index(QDir::currentPath()); - int numRows = model->rowCount(parentIndex); + connect(model, &QFileSystemModel::directoryLoaded, [model](const QString &directory) { + QModelIndex parentIndex = model->index(directory); + int numRows = model->rowCount(parentIndex); + }); + model->setRootPath(QDir::currentPath); //! [0] //! [1] diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc index 236582ef3f..ede1ebf932 100644 --- a/src/widgets/doc/src/model-view-programming.qdoc +++ b/src/widgets/doc/src/model-view-programming.qdoc @@ -465,14 +465,19 @@ Although this does not show a normal way of using a model, it demonstrates the conventions used by models when dealing with model indexes. + QFileSystemModel loading is asynchronous to minimize system resource use. + We have to take that into account when dealing with this model. + We construct a file system model in the following way: \snippet simplemodel-use/main.cpp 0 - In this case, we set up a default QFileSystemModel, obtain a parent index - using a specific implementation of \l{QFileSystemModel::}{index()} - provided by that model, and we count the number of rows in the model using - the \l{QFileSystemModel::}{rowCount()} function. + In this case, we start by setting up a default QFileSystemModel. We connect + it to a lambda, in which we will obtain a parent index using a specific + implementation of \l{QFileSystemModel::}{index()} provided by that model. + In the lambda, we count the number of rows in the model using the + \l{QFileSystemModel::}{rowCount()} function. Finally, we set the root path + of the QFileSystemModel so it starts loading data and triggers the lambda. For simplicity, we are only interested in the items in the first column of the model. We examine each row in turn, obtaining a model index for From ede867f581c0894e13d669f5364610df7ade0eb5 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 17 Nov 2019 13:10:41 +0100 Subject: [PATCH 18/24] QWheelEvent: add \since flag for ctor c08bf215cceda784cd02f8fa20e5b2431e0d9ef9 added a new QWheelEvent ctor but missed the \since flag. Fixes: QTBUG-80088 Change-Id: I6c81179999dd100162dc0cd5dc28e7b5b843b437 Reviewed-by: Shawn Rutledge --- src/gui/kernel/qevent.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 2b28052dd5..f555f4dc05 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -846,6 +846,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, /*! Constructs a wheel event object. + \since 5.12 The \a pos provides the location of the mouse cursor within the window. The position in global coordinates is specified by \a globalPos. From d7cb21ac085117f879a8aa1d7727b2ca52d3353d Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 15 Nov 2019 21:46:32 +0100 Subject: [PATCH 19/24] QDom: use QLocale::C when converting a double to a xml attribute QDomElement::setAttribute(QString, double) did not use QString::setNum() but qsnprintf(). This is wrong because qsnprintf() is using the current locale instead QLocale::C. It was also inconsistent to QDomElement::setAttributeNS() which was already using QString::setNum(). Also fix the documentation which stated that all QDomElement::setAttribute() format the values according the current locale. Fixes: QTBUG-80068 Change-Id: Iabb0b39c0d0723060527542c283a5435f26f31ca Reviewed-by: Thiago Macieira --- src/xml/dom/qdom.cpp | 19 +++----- tests/auto/xml/dom/qdom/tst_qdom.cpp | 69 ++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 8d232237bf..04151c3f31 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -4818,20 +4818,20 @@ void QDomElement::setAttribute(const QString& name, const QString& value) \fn void QDomElement::setAttribute(const QString& name, int value) \overload - The number is formatted according to the current locale. + The formatting always uses QLocale::C. */ /*! \fn void QDomElement::setAttribute(const QString& name, uint value) \overload - The number is formatted according to the current locale. + The formatting always uses QLocale::C. */ /*! \overload - The number is formatted according to the current locale. + The formatting always uses QLocale::C. */ void QDomElement::setAttribute(const QString& name, qlonglong value) { @@ -4845,7 +4845,7 @@ void QDomElement::setAttribute(const QString& name, qlonglong value) /*! \overload - The number is formatted according to the current locale. + The formatting always uses QLocale::C. */ void QDomElement::setAttribute(const QString& name, qulonglong value) { @@ -4859,7 +4859,7 @@ void QDomElement::setAttribute(const QString& name, qulonglong value) /*! \overload - The number is formatted according to the current locale. + The formatting always uses QLocale::C. */ void QDomElement::setAttribute(const QString& name, float value) { @@ -4873,19 +4873,14 @@ void QDomElement::setAttribute(const QString& name, float value) /*! \overload - The number is formatted according to the current locale. + The formatting always uses QLocale::C. */ void QDomElement::setAttribute(const QString& name, double value) { if (!impl) return; QString x; - char buf[256]; - int count = qsnprintf(buf, sizeof(buf), "%.16g", value); - if (count > 0) - x = QString::fromLatin1(buf, count); - else - x.setNum(value); // Fallback + x.setNum(value); IMPL->setAttribute(name, x); } diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index b09a3447e3..99639df5b0 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -57,6 +57,7 @@ private slots: void toString_02(); void hasAttributes_data(); void hasAttributes(); + void setGetAttributes(); void save_data(); void save(); void saveWithSerialization() const; @@ -392,6 +393,74 @@ void tst_QDom::hasAttributes() QTEST( visitedNodes, "visitedNodes" ); } +void tst_QDom::setGetAttributes() +{ + QDomDocument doc; + QDomElement rootNode = doc.createElement("Root"); + doc.appendChild(rootNode); + + const QLocale oldLocale = QLocale(); + QLocale::setDefault(QLocale::German); // decimal separator != '.' + + const QString qstringVal("QString"); + const qlonglong qlonglongVal = std::numeric_limits::min(); + const qulonglong qulonglongVal = std::numeric_limits::max(); + const int intVal = std::numeric_limits::min(); + const uint uintVal = std::numeric_limits::max(); + const float floatVal = 0.1234f; + const double doubleVal = 0.1234; + + rootNode.setAttribute("qstringVal", qstringVal); + rootNode.setAttribute("qlonglongVal", qlonglongVal); + rootNode.setAttribute("qulonglongVal", qulonglongVal); + rootNode.setAttribute("intVal", intVal); + rootNode.setAttribute("uintVal", uintVal); + rootNode.setAttribute("floatVal", floatVal); + rootNode.setAttribute("doubleVal", doubleVal); + + QDomElement nsNode = doc.createElement("NS"); + rootNode.appendChild(nsNode); + nsNode.setAttributeNS("namespace", "qstringVal", qstringVal); + nsNode.setAttributeNS("namespace", "qlonglongVal", qlonglongVal); + nsNode.setAttributeNS("namespace", "qulonglongVal", qulonglongVal); + nsNode.setAttributeNS("namespace", "intVal", intVal); + nsNode.setAttributeNS("namespace", "uintVal", uintVal); + nsNode.setAttributeNS("namespace", "floatVal", floatVal); // not available atm + nsNode.setAttributeNS("namespace", "doubleVal", doubleVal); + + bool bOk; + QCOMPARE(rootNode.attribute("qstringVal"), qstringVal); + QCOMPARE(rootNode.attribute("qlonglongVal").toLongLong(&bOk), qlonglongVal); + QVERIFY(bOk); + QCOMPARE(rootNode.attribute("qulonglongVal").toULongLong(&bOk), qulonglongVal); + QVERIFY(bOk); + QCOMPARE(rootNode.attribute("intVal").toInt(&bOk), intVal); + QVERIFY(bOk); + QCOMPARE(rootNode.attribute("uintVal").toUInt(&bOk), uintVal); + QVERIFY(bOk); + QCOMPARE(rootNode.attribute("floatVal").toFloat(&bOk), floatVal); + QVERIFY(bOk); + QCOMPARE(rootNode.attribute("doubleVal").toDouble(&bOk), doubleVal); + QVERIFY(bOk); + + QCOMPARE(nsNode.attributeNS("namespace", "qstringVal"), qstringVal); + QCOMPARE(nsNode.attributeNS("namespace", "qlonglongVal").toLongLong(&bOk), qlonglongVal); + QVERIFY(bOk); + QCOMPARE(nsNode.attributeNS("namespace", "qulonglongVal").toULongLong(&bOk), qulonglongVal); + QVERIFY(bOk); + QCOMPARE(nsNode.attributeNS("namespace", "intVal").toInt(&bOk), intVal); + QVERIFY(bOk); + QCOMPARE(nsNode.attributeNS("namespace", "uintVal").toUInt(&bOk), uintVal); + QVERIFY(bOk); + QCOMPARE(nsNode.attributeNS("namespace", "floatVal").toFloat(&bOk), floatVal); + QVERIFY(bOk); + QCOMPARE(nsNode.attributeNS("namespace", "doubleVal").toDouble(&bOk), doubleVal); + QVERIFY(bOk); + + QLocale::setDefault(oldLocale); +} + + int tst_QDom::hasAttributesHelper( const QDomNode& node ) { int visitedNodes = 1; From 315c2c468e504b83d616e2068bd4f7688ff58cf7 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Fri, 15 Nov 2019 09:37:05 +0200 Subject: [PATCH 20/24] tst_QScopeGuard: Remove unused lambda capture qt5/qtbase/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp:100:38: warning: lambda capture 'caught' is not used [-Wunused-lambda-capture] auto cleanup = qScopeGuard([&caught] { s_globalState++; }); ~^~~~~~ Change-Id: I0d9b85896594f3ea35c8003846d4ac7ab5e33d16 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp index f95d48f042..01181ce20e 100644 --- a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp +++ b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp @@ -67,7 +67,7 @@ void tst_QScopedGuard::exceptions() bool caught = false; QT_TRY { - auto cleanup = qScopeGuard([&caught] { s_globalState++; }); + auto cleanup = qScopeGuard([] { s_globalState++; }); QT_THROW(std::bad_alloc()); //if Qt compiled without exceptions this is noop s_globalState = 100; } From c8df1a2c6dcf47bb784d31905b3cb918ac02dac2 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 20 Nov 2019 08:30:50 +0100 Subject: [PATCH 21/24] QTemporaryFile: Add a note about behavior on Linux Mostly copied from the 5.10 changelog file. Task-number: QTBUG-80157 Change-Id: I58654fe998ada603241b9a7cb967f55e66ebc954 Reviewed-by: Christian Ehrlicher Reviewed-by: Tomasz Siekierda Reviewed-by: Thiago Macieira --- src/corelib/io/qtemporaryfile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index acd31f4d84..55d13dad70 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -631,6 +631,12 @@ QString QTemporaryFilePrivate::defaultTemplateName() case sensitive. If the template is not present in the filename, QTemporaryFile appends the generated part to the filename given. + \note On Linux, QTemporaryFile will attempt to create unnamed temporary + files. If that succeeds, open() will return true but exists() will be + false. If you call fileName() or any function that calls it, + QTemporaryFile will give the file a name, so most applications will + not see a difference. + \sa QDir::tempPath(), QFile */ From 3b98fe7f773668ed8b35478fa3a8ca0590acc450 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 18 Nov 2019 18:53:59 +0300 Subject: [PATCH 22/24] xcb: Simplify code by using helper QXcbIntegration::defaultConnection() Change-Id: Ieb0e21d85fcd0c168b1bb090e967d02a8a6a6083 Reviewed-by: Mikhail Svetkin --- src/plugins/platforms/xcb/qxcbintegration.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 95ca40fc95..efda6b67ce 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -317,8 +317,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const case OpenGL: case ThreadedOpenGL: { - const auto *connection = qAsConst(m_connections).first(); - if (const auto *integration = connection->glIntegration()) + if (const auto *integration = defaultConnection()->glIntegration()) return cap != ThreadedOpenGL || integration->supportsThreadedOpenGL(); return false; } From 5d1af4f0be0815778aa4f9c3e32a432d9989613b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 8 Nov 2019 16:55:06 +0100 Subject: [PATCH 23/24] Compile fontconfig-related code on non-Unix platforms ...if the feature is enabled. This fixes the build for MSYS2 with fontconfig. Fixes: QTBUG-79748 Change-Id: I2c834b6d968766f98c5df2f3df5c8c9bdbd80f11 Reviewed-by: Kai Koehne --- src/platformsupport/fontdatabases/fontdatabases.pro | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/platformsupport/fontdatabases/fontdatabases.pro b/src/platformsupport/fontdatabases/fontdatabases.pro index f2bac9ab94..c3985ed398 100644 --- a/src/platformsupport/fontdatabases/fontdatabases.pro +++ b/src/platformsupport/fontdatabases/fontdatabases.pro @@ -17,9 +17,10 @@ qtConfig(freetype) { unix { include($$PWD/genericunix/genericunix.pri) - qtConfig(fontconfig) { - include($$PWD/fontconfig/fontconfig.pri) - } +} + +qtConfig(fontconfig) { + include($$PWD/fontconfig/fontconfig.pri) } win32:!winrt { From 73a764c24700089228b4092e983061f788c6d232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 19 Nov 2019 17:15:50 +0100 Subject: [PATCH 24/24] =?UTF-8?q?Don=E2=80=99t=20warn=20on=20QT=5FAUTO=5FS?= =?UTF-8?q?CREEN=5FSCALE=5FFACTOR=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This warning turned out to be spammy, since the env. variable may be set by KDE, in which case there is nothing the user or app developer can do to fix the situation. QT_AUTO_SCREEN_SCALE_FACTOR is now Done on X11, and remains Deprecated on all other platforms. Change-Id: I9d372655624b0e0b822f0a70e9aec4b18ab98630 Reviewed-by: Frederik Gladhorn --- src/gui/kernel/qhighdpiscaling.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 0782a49481..fde6bb0180 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -56,6 +56,9 @@ Q_LOGGING_CATEGORY(lcScaling, "qt.scaling"); #ifndef QT_NO_HIGHDPISCALING static const char legacyDevicePixelEnvVar[] = "QT_DEVICE_PIXEL_RATIO"; + +// Note: QT_AUTO_SCREEN_SCALE_FACTOR is Done on X11, and should be kept +// working as-is. It's Deprecated on all other platforms. static const char legacyAutoScreenEnvVar[] = "QT_AUTO_SCREEN_SCALE_FACTOR"; static const char enableHighDpiScalingEnvVar[] = "QT_ENABLE_HIGHDPI_SCALING"; @@ -104,12 +107,6 @@ static inline qreal initialGlobalScaleFactor() if (dpr > 0) result = dpr; } - - if (qEnvironmentVariableIsSet(legacyAutoScreenEnvVar)) { - qWarning("Warning: %s is deprecated. Instead use:\n" - " %s to enable platform plugin controlled per-screen factors.", - legacyAutoScreenEnvVar, enableHighDpiScalingEnvVar); - } } return result; }