From 23e605cc5b71f68d6c9e6168053226d027ea46d4 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 30 Jul 2019 16:42:44 +0200 Subject: [PATCH 01/43] Plug a memory leak introduced in e24a4976bebd7ca90deac2b40c08900625773 While it is correct not to call the functor when the context object has been destroyed, we still need ot clean up the slotObj. It's a low- probability memory leak: the context object has to disappear while waiting for a host resolution, and for repeated requests for the same host the cache takes over anyway. Task-number: QTBUG-76276 Change-Id: Id9daf391353b8252443f3186a7d504d70c553b24 Reviewed-by: Timur Pocheptsov --- src/network/kernel/qhostinfo_p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h index bbf4cc36d11..fa6529bdfd7 100644 --- a/src/network/kernel/qhostinfo_p.h +++ b/src/network/kernel/qhostinfo_p.h @@ -105,12 +105,12 @@ public Q_SLOTS: inline void emitResultsReady(const QHostInfo &info) { if (slotObj) { - // we used to have a context object, but it's already destroyed - if (withContextObject && !receiver) - return; - QHostInfo copy = info; - void *args[2] = { 0, reinterpret_cast(©) }; - slotObj->call(const_cast(receiver.data()), args); + // we either didn't have a context object, or it's still alive + if (!withContextObject || receiver) { + QHostInfo copy = info; + void *args[2] = { 0, reinterpret_cast(©) }; + slotObj->call(const_cast(receiver.data()), args); + } slotObj->destroyIfLastRef(); } else { emit resultsReady(info); From 3d7bd7ad19254bb1c4794349e71501e58c91891e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 30 Jul 2019 11:27:49 +0200 Subject: [PATCH 02/43] Fix hit testing in non-client area of fixed-size windows, don't show resize cursors The m_windowState member is never updated regarding active state; isActive is instead reimplemented to query the window manager, so use that. To extend the area where the user can move the window over the entire titlebar of fixed-height windows, just test whether the mouse position is within the titlebar. Change-Id: I6b87aacd0bdab511cfd4959df1114af5c6013852 Fixes: QTBUG-77220 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index eb521dac529..7d511bf0d7e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2621,7 +2621,8 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re // QTBUG-32663, suppress resize cursor for fixed size windows. const QWindow *w = window(); if (!w->isTopLevel() // Task 105852, minimized windows need to respond to user input. - || !(m_windowState & ~Qt::WindowActive) + || (m_windowState != Qt::WindowNoState) + || !isActive() || (m_data.flags & Qt::FramelessWindowHint)) { return false; } @@ -2641,12 +2642,10 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re return true; } if (localPos.y() < 0) { - const QMargins margins = frameMargins(); - const int topResizeBarPos = margins.left() - margins.top(); - if (localPos.y() < topResizeBarPos) { + const int topResizeBarPos = -frameMargins().top(); + if (localPos.y() >= topResizeBarPos) *result = HTCAPTION; // Extend caption over top resize bar, let's user move the window. - return true; - } + return true; } } if (fixedWidth && (localPos.x() < 0 || localPos.x() >= size.width())) { From 174061f9f32ac76c6b8a6d155d772e37708d8cfc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 31 Jul 2019 10:23:39 +0200 Subject: [PATCH 03/43] QHighDPI: Fix broken scaling of QPoint(F) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason, the overload resolution of the High DPI scale() functions introduced by b6ded193ee64ffe67df6d22e7a23aa1ea9e02ec7 chose the wrong overloads for QPointF and/or QPoint; it fell back to the generic template intended for qreal, QSize, etc, ignoring the origin. Remove the template and spell out all overloads. Fixes: QTBUG-77255 Change-Id: I5661f16f7326f65156f646f430f5a0c71d5302d2 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qhighdpiscaling_p.h | 20 ++++- tests/auto/gui/kernel/kernel.pro | 3 + .../qhighdpiscaling/qhighdpiscaling.pro | 6 ++ .../qhighdpiscaling/tst_qhighdpiscaling.cpp | 77 +++++++++++++++++++ 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro create mode 100644 tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 3410c1d345a..c43641b8c98 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -59,6 +59,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -117,13 +118,26 @@ private: namespace QHighDpi { -template -inline T scale(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0)) +inline qreal scale(qreal value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) { - Q_UNUSED(origin) return value * scaleFactor; } +inline QSize scale(const QSize &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) +{ + return value * scaleFactor; +} + +inline QSizeF scale(const QSizeF &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) +{ + return value * scaleFactor; +} + +inline QVector2D scale(const QVector2D &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0)) +{ + return value * float(scaleFactor); +} + inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0)) { return (pos - origin) * scaleFactor + origin; diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index fbd3b1b3712..42135dae247 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -11,6 +11,7 @@ SUBDIRS=\ qguimetatype \ qguitimer \ qguivariant \ + qhighdpiscaling \ qinputmethod \ qkeyevent \ qkeysequence \ @@ -35,6 +36,8 @@ win32:!winrt:qtHaveModule(network): SUBDIRS += noqteventloop !qtHaveModule(network): SUBDIRS -= \ qguieventloop +!qtConfig(highdpiscaling): SUBDIRS -= qhighdpiscaling + !qtConfig(opengl): SUBDIRS -= qopenglwindow android|uikit: SUBDIRS -= qclipboard diff --git a/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro new file mode 100644 index 00000000000..6cd7bb01f54 --- /dev/null +++ b/tests/auto/gui/kernel/qhighdpiscaling/qhighdpiscaling.pro @@ -0,0 +1,6 @@ +CONFIG += testcase +TARGET = tst_qhighdpiscaling + +QT += core-private gui-private testlib + +SOURCES += tst_qhighdpiscaling.cpp diff --git a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp new file mode 100644 index 00000000000..969b2351ec4 --- /dev/null +++ b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include + +class tst_QHighDpiScaling: public QObject +{ + Q_OBJECT + +private slots: + void scale(); +}; + +// Emulate the case of a High DPI secondary screen +class MyPlatformScreen : public QPlatformScreen +{ +public: + QRect geometry() const override { return QRect(3840, 0, 3840, 1920); } + QRect availableGeometry() const override { return geometry(); } + + int depth() const override { return 32; } + QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; } +}; + +// QTBUG-77255: Test some scaling overloads +void tst_QHighDpiScaling::scale() +{ + QHighDpiScaling::setGlobalFactor(2); + QScopedPointer screen(new MyPlatformScreen); + + qreal nativeValue = 10; + const qreal value = QHighDpi::fromNativePixels(nativeValue, screen.data()); + QCOMPARE(value, qreal(5)); + QCOMPARE(QHighDpi::toNativePixels(value, screen.data()), nativeValue); + + // 10, 10 within screen should translate to 5,5 with origin preserved + const QPoint nativePoint = screen->geometry().topLeft() + QPoint(10, 10); + const QPoint point = QHighDpi::fromNativePixels(nativePoint, screen.data()); + QCOMPARE(point, QPoint(3845, 5)); + QCOMPARE(QHighDpi::toNativePixels(point, screen.data()), nativePoint); + + const QPointF nativePointF(nativePoint); + const QPointF pointF = QHighDpi::fromNativePixels(nativePointF, screen.data()); + QCOMPARE(pointF, QPointF(3845, 5)); + QCOMPARE(QHighDpi::toNativePixels(pointF, screen.data()), nativePointF); +} + +#include "tst_qhighdpiscaling.moc" +QTEST_MAIN(tst_QHighDpiScaling); From 9ad8debe38332a9d61a79e1b0017c19c442f4e49 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 30 Jul 2019 20:46:55 +0300 Subject: [PATCH 04/43] qlalr: fix compilation with C++20 std::not1 is deprecated in C++17, removed in C++20. Use its replacement, std::not_fn. Change-Id: I37d4929c81c2a5befeb44f954ae77b23960d2ff0 Reviewed-by: Ville Voutilainen --- src/tools/qlalr/lalr.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/qlalr/lalr.cpp b/src/tools/qlalr/lalr.cpp index ec960925aa6..541523d49c8 100644 --- a/src/tools/qlalr/lalr.cpp +++ b/src/tools/qlalr/lalr.cpp @@ -295,6 +295,12 @@ void Automaton::build () buildDefaultReduceActions (); } +#if defined(__cpp_lib_not_fn) && __cpp_lib_not_fn >= 201603 +# define Q_NOT_FN std::not_fn +#else +# define Q_NOT_FN std::not1 +#endif + void Automaton::buildNullables () { bool changed = true; @@ -305,7 +311,7 @@ void Automaton::buildNullables () for (RulePointer rule = _M_grammar->rules.begin (); rule != _M_grammar->rules.end (); ++rule) { - NameList::iterator nn = std::find_if (rule->rhs.begin (), rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator nn = std::find_if(rule->rhs.begin(), rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (nn == rule->rhs.end ()) changed |= nullables.insert (rule->lhs).second; @@ -646,7 +652,7 @@ void Automaton::buildIncludesDigraph () if (! _M_grammar->isNonTerminal (*A)) continue; - NameList::iterator first_not_nullable = std::find_if (dot, rule->rhs.end (), std::not1 (Nullable (this))); + NameList::iterator first_not_nullable = std::find_if(dot, rule->rhs.end(), Q_NOT_FN(Nullable(this))); if (first_not_nullable != rule->rhs.end ()) continue; From bd8ef7fe24f80b193a3c47cc77795d766d35d25e Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Aug 2019 13:58:48 +0200 Subject: [PATCH 05/43] Blacklist tst_http2::connectToHost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test if flakey. Change-Id: I1f956f47ab4cf0602f3631e4f7908df35f5ce83f Reviewed-by: Tor Arne Vestbø --- tests/auto/network/access/http2/BLACKLIST | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/auto/network/access/http2/BLACKLIST diff --git a/tests/auto/network/access/http2/BLACKLIST b/tests/auto/network/access/http2/BLACKLIST new file mode 100644 index 00000000000..8f26c5b89e6 --- /dev/null +++ b/tests/auto/network/access/http2/BLACKLIST @@ -0,0 +1,3 @@ + See qtbase/src/testlib/qtestblacklist.cpp for format +[connectToHost] +* From a34b0855f160add13d08c21715dd6853094c23e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 30 Jul 2019 15:41:57 +0200 Subject: [PATCH 06/43] macOS: Don't assume NSWindows will be created on the screen we request The user may have assigned the application to start up on a specific display, in which case the window's screen is nil after creation, and the resulting screen will be delivered as a normal screen change once the window is ordered on screen. Fixes: QTBUG-77154 Change-Id: Idade6d833e31654db239243f2430166b5d86eca2 Reviewed-by: Volker Hilsheimer --- src/plugins/platforms/cocoa/qcocoawindow.mm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index b609fb39954..ab20c7abe99 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1569,8 +1569,8 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) } rect.translate(-targetScreen->geometry().topLeft()); - QCocoaScreen *cocoaScreen = static_cast(targetScreen->handle()); - NSRect frame = QCocoaScreen::mapToNative(rect, cocoaScreen); + auto *targetCocoaScreen = static_cast(targetScreen->handle()); + NSRect frame = QCocoaScreen::mapToNative(rect, targetCocoaScreen); // Create NSWindow Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class]; @@ -1579,15 +1579,22 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) // Deferring window creation breaks OpenGL (the GL context is // set up before the window is shown and needs a proper window) backing:NSBackingStoreBuffered defer:NO - screen:cocoaScreen->nativeScreen() + screen:targetCocoaScreen->nativeScreen() platformWindow:this]; - Q_ASSERT_X(nsWindow.screen == cocoaScreen->nativeScreen(), "QCocoaWindow", - "Resulting NSScreen should match the requested NSScreen"); + // The resulting screen can be different from the screen requested if + // for example the application has been assigned to a specific display. + auto resultingScreen = QCocoaIntegration::instance()->screenForNSScreen(nsWindow.screen); - if (targetScreen != window()->screen()) { + // But may not always be resolved at this point, in which case we fall back + // to the target screen. The real screen will be delivered as a screen change + // when resolved as part of ordering the window on screen. + if (!resultingScreen) + resultingScreen = targetCocoaScreen; + + if (resultingScreen->screen() != window()->screen()) { QWindowSystemInterface::handleWindowScreenChanged< - QWindowSystemInterface::SynchronousDelivery>(window(), targetScreen); + QWindowSystemInterface::SynchronousDelivery>(window(), resultingScreen->screen()); } static QSharedPointer sharedDelegate([[QNSWindowDelegate alloc] init], From 89e97e99378f90cd70e4b9f0462b8baece471d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 16:01:22 +0200 Subject: [PATCH 07/43] Pass qmake arguments when creating Xcode project from Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0020273b200465f44a135848b4fd505793e85c30 Reviewed-by: Jörg Bornemann --- mkspecs/features/mac/default_post.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index c46222debd3..f34b305d08c 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -261,7 +261,7 @@ xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identif QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting !macx-xcode { - generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) + generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode $(EXPORT__PRO_FILE_) $$QMAKE_ARGS generate_xcode_project.target = xcodeproj QMAKE_EXTRA_VARIABLES += _PRO_FILE_ QMAKE_EXTRA_TARGETS += generate_xcode_project From 360000342ab095a936d8f09951e2b19c04c2678a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 30 Jul 2019 16:09:11 +0200 Subject: [PATCH 08/43] macOS: Improve screen positioning during window creation Allow AppKit to resolve screen for NSWindow lazily in the case where the position is outside any known screen. And explicitly set the style mask if detecting the corner case of positioning a window in the unavailable space on a rotated screen. In testing the effect of creating the window with a borderless style mask and then updating the mask did not seem to have any visual consequences, but we try to limit this mode just in case by only enabling it in the corner cases we detect. Change-Id: I4b7fcc6755a1ad5ff2683bec79d80a78226edae0 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoawindow.mm | 33 +++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ab20c7abe99..d6f88b4f237 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1543,12 +1543,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) Qt::WindowType type = window()->type(); Qt::WindowFlags flags = window()->flags(); - // Note: The macOS window manager has a bug, where if a screen is rotated, it will not allow - // a window to be created within the area of the screen that has a Y coordinate (I quadrant) - // higher than the height of the screen in its non-rotated state, unless the window is - // created with the NSWindowStyleMaskBorderless style mask. - NSWindowStyleMask styleMask = windowStyleMask(flags); - QRect rect = geometry(); QScreen *targetScreen = nullptr; @@ -1559,22 +1553,37 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel) } } + NSWindowStyleMask styleMask = windowStyleMask(flags); + if (!targetScreen) { qCWarning(lcQpaWindow) << "Window position" << rect << "outside any known screen, using primary screen"; targetScreen = QGuiApplication::primaryScreen(); - // AppKit will only reposition a window that's outside the target screen area if - // the window has a title bar. If left out, the window ends up with no screen. - // The style mask will be corrected to the original style mask in setWindowFlags. - styleMask |= NSWindowStyleMaskTitled; + // Unless the window is created as borderless AppKit won't find a position and + // screen that's close to the requested invalid position, and will always place + // the window on the primary screen. + styleMask = NSWindowStyleMaskBorderless; } rect.translate(-targetScreen->geometry().topLeft()); auto *targetCocoaScreen = static_cast(targetScreen->handle()); - NSRect frame = QCocoaScreen::mapToNative(rect, targetCocoaScreen); + NSRect contentRect = QCocoaScreen::mapToNative(rect, targetCocoaScreen); + + if (targetScreen->primaryOrientation() == Qt::PortraitOrientation) { + // The macOS window manager has a bug, where if a screen is rotated, it will not allow + // a window to be created within the area of the screen that has a Y coordinate (I quadrant) + // higher than the height of the screen in its non-rotated state (including a magic padding + // of 24 points), unless the window is created with the NSWindowStyleMaskBorderless style mask. + if (styleMask && (contentRect.origin.y + 24 > targetScreen->geometry().width())) { + qCDebug(lcQpaWindow) << "Window positioned on portrait screen." + << "Adjusting style mask during creation"; + styleMask = NSWindowStyleMaskBorderless; + } + } // Create NSWindow Class windowClass = shouldBePanel ? [QNSPanel class] : [QNSWindow class]; - QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:frame + QCocoaNSWindow *nsWindow = [[windowClass alloc] initWithContentRect:contentRect + // Mask will be updated in setWindowFlags if not the final mask styleMask:styleMask // Deferring window creation breaks OpenGL (the GL context is // set up before the window is shown and needs a proper window) From 662798d785c309a343c13648cb018c7f556757a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 29 Jul 2019 16:40:08 +0200 Subject: [PATCH 09/43] macOS: Add system detection and version defines for macOS Catalina (10.15) Change-Id: I127efe752ebb70825f1b31f0d64c4293d1c71820 Reviewed-by: Simon Hausmann Reviewed-by: Volker Hilsheimer --- src/corelib/global/qoperatingsystemversion.cpp | 8 ++++++++ src/corelib/global/qoperatingsystemversion.h | 1 + src/corelib/global/qsystemdetection.h | 14 ++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 94dc261b417..bc6adb54dc3 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -437,6 +437,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSHighSierra = const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave = QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14); +/*! + \variable QOperatingSystemVersion::MacOSCatalina + \brief a version corresponding to macOS Catalina (version 10.15). + \since 5.12.5 + */ +const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina = + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15); + /*! \variable QOperatingSystemVersion::AndroidJellyBean \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16). diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index df01e5438a9..89c60c49607 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -71,6 +71,7 @@ public: static const QOperatingSystemVersion MacOSSierra; static const QOperatingSystemVersion MacOSHighSierra; static const QOperatingSystemVersion MacOSMojave; + static const QOperatingSystemVersion MacOSCatalina; static const QOperatingSystemVersion AndroidJellyBean; static const QOperatingSystemVersion AndroidJellyBean_MR1; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index a2e51fa3300..3e38e6790be 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -231,17 +231,23 @@ # if !defined(__MAC_10_14) # define __MAC_10_14 101400 # endif +# if !defined(__MAC_10_15) +# define __MAC_10_15 101500 +# endif # if !defined(MAC_OS_X_VERSION_10_11) -# define MAC_OS_X_VERSION_10_11 101100 +# define MAC_OS_X_VERSION_10_11 __MAC_10_11 # endif # if !defined(MAC_OS_X_VERSION_10_12) -# define MAC_OS_X_VERSION_10_12 101200 +# define MAC_OS_X_VERSION_10_12 __MAC_10_12 # endif # if !defined(MAC_OS_X_VERSION_10_13) -# define MAC_OS_X_VERSION_10_13 101300 +# define MAC_OS_X_VERSION_10_13 __MAC_10_13 # endif # if !defined(MAC_OS_X_VERSION_10_14) -# define MAC_OS_X_VERSION_10_14 101400 +# define MAC_OS_X_VERSION_10_14 __MAC_10_14 +# endif +# if !defined(MAC_OS_X_VERSION_10_15) +# define MAC_OS_X_VERSION_10_15 __MAC_10_15 # endif # # if !defined(__IPHONE_10_0) From ec62033bc25ed60a6bb9286d07e4f4485800b068 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 1 Aug 2019 15:01:27 +0200 Subject: [PATCH 10/43] tst_http2::connectToHost - add a fix for SecureTransport backend One of the tests above was unsetting a variable that enforces the use of a temporary keychain. We have to set it back, otherwise the test is failing. What surprises me though - why I had this problem only locally and not on CI? Apparently, SecureTransport is not covered by our configurations ... Change-Id: I0ff1e3e304632869391ed61213c245b949d8c778 Reviewed-by: Volker Hilsheimer --- tests/auto/network/access/http2/tst_http2.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index ce685a1b1cc..10dad253374 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -591,6 +591,19 @@ void tst_Http2::connectToHost() #if QT_CONFIG(ssl) Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn); + +#if QT_CONFIG(securetransport) + // Normally on macOS we use plain text only for SecureTransport + // does not support ALPN on the server side. With 'direct encrytped' + // we have to use TLS sockets (== private key) and thus suppress a + // keychain UI asking for permission to use a private key. + // Our CI has this, but somebody testing locally - will have a problem. + qputenv("QT_SSL_USE_TEMPORARY_KEYCHAIN", QByteArray("1")); + auto envRollback = qScopeGuard([](){ + qunsetenv("QT_SSL_USE_TEMPORARY_KEYCHAIN"); + }); +#endif // QT_CONFIG(securetransport) + #else Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect); Q_ASSERT(targetServer->isClearText()); From a22bb694ce27b16b3ad672b09700937362b9a320 Mon Sep 17 00:00:00 2001 From: Pavel Artsishevsky Date: Tue, 30 Jul 2019 04:04:45 +0300 Subject: [PATCH 11/43] Fix QPainter's ColorDodge and ColorBurn composition modes Added checking corner cases (more specific formulas) in color_dodge_op()/color_dodge_op_rgb64() and color_burn_op()/color_burn_op_rgb64() to produce correct results for any input. Task-number: QTBUG-77231 Change-Id: I274f80b356bd4236a9176a84a95604c2eb01787a Reviewed-by: Konstantin Tokarev Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qcompositionfunctions.cpp | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp index 027bf231152..9308710c0b3 100644 --- a/src/gui/painting/qcompositionfunctions.cpp +++ b/src/gui/painting/qcompositionfunctions.cpp @@ -1763,8 +1763,10 @@ void QT_FASTCALL comp_func_Lighten_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QR } /* - if Sca.Da + Dca.Sa >= Sa.Da + if Sca.Da + Dca.Sa > Sa.Da Dca' = Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa) + else if Sca == Sa + Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa) otherwise Dca' = Dca.Sa/(1-Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa) */ @@ -1775,8 +1777,10 @@ static inline int color_dodge_op(int dst, int src, int da, int sa) const int src_da = src * da; const int temp = src * (255 - da) + dst * (255 - sa); - if (src_da + dst_sa >= sa_da) + if (src_da + dst_sa > sa_da) return qt_div_255(sa_da + temp); + else if (src == sa || sa == 0) + return qt_div_255(temp); else return qt_div_255(255 * dst_sa / (255 - 255 * src / sa) + temp); } @@ -1788,8 +1792,10 @@ static inline uint color_dodge_op_rgb64(qint64 dst, qint64 src, qint64 da, qint6 const qint64 src_da = src * da; const qint64 temp = src * (65535 - da) + dst * (65535 - sa); - if (src_da + dst_sa >= sa_da) + if (src_da + dst_sa > sa_da) return qt_div_65535(sa_da + temp); + else if (src == sa || sa == 0) + return qt_div_65535(temp); else return qt_div_65535(65535 * dst_sa / (65535 - 65535 * src / sa) + temp); } @@ -1915,8 +1921,10 @@ void QT_FASTCALL comp_func_ColorDodge_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const } /* - if Sca.Da + Dca.Sa <= Sa.Da + if Sca.Da + Dca.Sa < Sa.Da Dca' = Sca.(1 - Da) + Dca.(1 - Sa) + else if Sca == 0 + Dca' = Dca.Sa + Sca.(1 - Da) + Dca.(1 - Sa) otherwise Dca' = Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa) */ @@ -1928,8 +1936,10 @@ static inline int color_burn_op(int dst, int src, int da, int sa) const int temp = src * (255 - da) + dst * (255 - sa); - if (src == 0 || src_da + dst_sa <= sa_da) + if (src_da + dst_sa < sa_da) return qt_div_255(temp); + else if (src == 0) + return qt_div_255(dst_sa + temp); return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); } @@ -1941,8 +1951,10 @@ static inline uint color_burn_op_rgb64(qint64 dst, qint64 src, qint64 da, qint64 const qint64 temp = src * (65535 - da) + dst * (65535 - sa); - if (src == 0 || src_da + dst_sa <= sa_da) + if (src_da + dst_sa < sa_da) return qt_div_65535(temp); + else if (src == 0) + return qt_div_65535(dst_sa + temp); return qt_div_65535(sa * (src_da + dst_sa - sa_da) / src + temp); } From 455963ce4996055e1f9a9a3c8d0d6a1abf64cd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 14:48:49 +0200 Subject: [PATCH 12/43] macOS: Don't require setting all three color buffer sizes in QSurfaceFormat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaa6eb4d64f549a31aa5c53145e8b37facec4ea78 Reviewed-by: Andy Nichols Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qsurfaceformat.cpp | 12 ------------ src/plugins/platforms/cocoa/qcocoaglcontext.mm | 11 +++++++++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 1a814ec21fb..4e2bcad50f6 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -554,10 +554,6 @@ int QSurfaceFormat::alphaBufferSize() const /*! Set the desired \a size in bits of the red channel of the color buffer. - - \note On Mac OSX, be sure to set the buffer size of all color channels, - otherwise this setting will have no effect. If one of the buffer sizes is not set, - the current bit-depth of the screen is used. */ void QSurfaceFormat::setRedBufferSize(int size) { @@ -569,10 +565,6 @@ void QSurfaceFormat::setRedBufferSize(int size) /*! Set the desired \a size in bits of the green channel of the color buffer. - - \note On Mac OSX, be sure to set the buffer size of all color channels, - otherwise this setting will have no effect. If one of the buffer sizes is not set, - the current bit-depth of the screen is used. */ void QSurfaceFormat::setGreenBufferSize(int size) { @@ -584,10 +576,6 @@ void QSurfaceFormat::setGreenBufferSize(int size) /*! Set the desired \a size in bits of the blue channel of the color buffer. - - \note On Mac OSX, be sure to set the buffer size of all color channels, - otherwise this setting will have no effect. If one of the buffer sizes is not set, - the current bit-depth of the screen is used. */ void QSurfaceFormat::setBlueBufferSize(int size) { diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index e45ea7efd3d..d91b2cabaf0 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -197,8 +197,15 @@ NSOpenGLPixelFormat *QCocoaGLContext::pixelFormatForSurfaceFormat(const QSurface attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize(); if (format.alphaBufferSize() > 0) attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize(); - if (format.redBufferSize() > 0 && format.greenBufferSize() > 0 && format.blueBufferSize() > 0) { - const int colorSize = format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize(); + + auto rbz = format.redBufferSize(); + auto gbz = format.greenBufferSize(); + auto bbz = format.blueBufferSize(); + if (rbz > 0 || gbz > 0 || bbz > 0) { + auto fallbackSize = qMax(rbz, qMax(gbz, bbz)); + auto colorSize = (rbz > 0 ? rbz : fallbackSize) + + (gbz > 0 ? gbz : fallbackSize) + + (bbz > 0 ? bbz : fallbackSize); attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy; } From 8c0787cfa1a906ebe25907515d86050303b127e7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 31 Jul 2019 10:55:14 +0200 Subject: [PATCH 13/43] Fix dependency_libs entry of .la files Libtool cannot cope with absolute paths in the dependency_libs entry. We split absolute paths into -L and -l here. Change-Id: I30bf11e490d1993d2a4d88c114e07bbae12def6d Fixes: QTBUG-76625 Reviewed-by: Kai Koehne --- qmake/generators/unix/unixmake2.cpp | 38 +++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index d9bcccf2e27..abc37149a93 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1450,7 +1450,36 @@ UnixMakefileGenerator::libtoolFileName(bool fixify) void UnixMakefileGenerator::writeLibtoolFile() { + auto fixDependencyLibs + = [this](const ProStringList &libs) + { + ProStringList result; + for (auto lib : libs) { + auto fi = fileInfo(lib.toQString()); + if (fi.isAbsolute()) { + const QString libDirArg = "-L" + fi.path(); + if (!result.contains(libDirArg)) + result += libDirArg; + QString namespec = fi.fileName(); + int dotPos = namespec.lastIndexOf('.'); + if (dotPos != -1 && namespec.startsWith("lib")) { + namespec.truncate(dotPos); + namespec.remove(0, 3); + } else { + debug_msg(1, "Ignoring dependency library %s", + lib.toLatin1().constData()); + continue; + } + result += "-l" + namespec; + } else { + result += lib; + } + } + return result; + }; + QString fname = libtoolFileName(), lname = fname; + debug_msg(1, "Writing libtool file %s", fname.toLatin1().constData()); mkdir(fileInfo(fname).path()); int slsh = lname.lastIndexOf(Option::dir_sep); if(slsh != -1) @@ -1488,12 +1517,11 @@ UnixMakefileGenerator::writeLibtoolFile() << ".a'\n\n"; t << "# Libraries that this one depends upon.\n"; + static const ProKey libVars[] = { "LIBS", "QMAKE_LIBS" }; ProStringList libs; - libs << "LIBS" << "QMAKE_LIBS"; - t << "dependency_libs='"; - for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) - t << fixLibFlags((*it).toKey()).join(' ') << ' '; - t << "'\n\n"; + for (auto var : libVars) + libs += fixLibFlags(var); + t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n"; t << "# Version information for " << lname << "\n"; int maj = project->first("VER_MAJ").toInt(); From 4f116f00fcd93decbf6fc01b61b0be7c293d3c39 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Mon, 5 Aug 2019 15:24:16 +0300 Subject: [PATCH 14/43] Fix GCC 4.8 build Change-Id: I4994146b359e8e37f6c0fa1b27f03fb9e800fdd5 Fixes: QTBUG-77218 Reviewed-by: Simon Hausmann --- src/gui/painting/qtriangulator_p.h | 2 +- src/gui/text/qtextlayout.h | 4 +- src/widgets/styles/qstyleoption.h | 46 +++++++++---------- .../kernel/qapplication/tst_qapplication.cpp | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/gui/painting/qtriangulator_p.h b/src/gui/painting/qtriangulator_p.h index c9ae2571f40..0abf87308a1 100644 --- a/src/gui/painting/qtriangulator_p.h +++ b/src/gui/painting/qtriangulator_p.h @@ -94,7 +94,7 @@ public: } QVertexIndexVector() = default; - QVertexIndexVector(const QVertexIndexVector &other) = default; + QVertexIndexVector(const QVertexIndexVector &) = default; inline QVertexIndexVector &operator = (const QVertexIndexVector &other) { if (t == UnsignedInt) diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index a29791534ee..2fc0fcd55a9 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -114,8 +114,8 @@ public: // not ambiguous. Implementation detail that should not be documented. template #endif - QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice) - : QTextLayout(text, font, const_cast(paintdevice)) + QTextLayout(const QString &textData, const QFont &textFont, const QPaintDevice *paintdevice) + : QTextLayout(textData, textFont, const_cast(paintdevice)) {} #else QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice = nullptr); diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 763575ff5b8..7f5edf42795 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -118,7 +118,7 @@ public: QStyleOptionFocusRect(); QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionFocusRect &operator=(const QStyleOptionFocusRect &other) = default; + QStyleOptionFocusRect &operator=(const QStyleOptionFocusRect &) = default; protected: QStyleOptionFocusRect(int version); @@ -143,7 +143,7 @@ public: QStyleOptionFrame(); QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionFrame &operator=(const QStyleOptionFrame &other) = default; + QStyleOptionFrame &operator=(const QStyleOptionFrame &) = default; protected: QStyleOptionFrame(int version); @@ -173,7 +173,7 @@ public: QStyleOptionTabWidgetFrame(); inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionTabWidgetFrame &operator=(const QStyleOptionTabWidgetFrame &other) = default; + QStyleOptionTabWidgetFrame &operator=(const QStyleOptionTabWidgetFrame &) = default; protected: QStyleOptionTabWidgetFrame(int version); @@ -197,7 +197,7 @@ public: QStyleOptionTabBarBase(); QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionTabBarBase &operator=(const QStyleOptionTabBarBase &other) = default; + QStyleOptionTabBarBase &operator=(const QStyleOptionTabBarBase &) = default; protected: QStyleOptionTabBarBase(int version); @@ -229,7 +229,7 @@ public: QStyleOptionHeader(); QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionHeader &operator=(const QStyleOptionHeader &other) = default; + QStyleOptionHeader &operator=(const QStyleOptionHeader &) = default; protected: QStyleOptionHeader(int version); @@ -252,7 +252,7 @@ public: QStyleOptionButton(); QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionButton &operator=(const QStyleOptionButton &other) = default; + QStyleOptionButton &operator=(const QStyleOptionButton &) = default; protected: QStyleOptionButton(int version); @@ -290,7 +290,7 @@ public: QStyleOptionTab(); QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionTab &operator=(const QStyleOptionTab &other) = default; + QStyleOptionTab &operator=(const QStyleOptionTab &) = default; protected: QStyleOptionTab(int version); @@ -321,7 +321,7 @@ public: int midLineWidth; QStyleOptionToolBar(); QStyleOptionToolBar(const QStyleOptionToolBar &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionToolBar &operator=(const QStyleOptionToolBar &other) = default; + QStyleOptionToolBar &operator=(const QStyleOptionToolBar &) = default; protected: QStyleOptionToolBar(int version); @@ -349,7 +349,7 @@ public: QStyleOptionProgressBar(); QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionProgressBar &operator=(const QStyleOptionProgressBar &other) = default; + QStyleOptionProgressBar &operator=(const QStyleOptionProgressBar &) = default; protected: QStyleOptionProgressBar(int version); @@ -380,7 +380,7 @@ public: QStyleOptionMenuItem(); QStyleOptionMenuItem(const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionMenuItem &operator=(const QStyleOptionMenuItem &other) = default; + QStyleOptionMenuItem &operator=(const QStyleOptionMenuItem &) = default; protected: QStyleOptionMenuItem(int version); @@ -400,7 +400,7 @@ public: QStyleOptionDockWidget(); QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionDockWidget &operator=(const QStyleOptionDockWidget &other) = default; + QStyleOptionDockWidget &operator=(const QStyleOptionDockWidget &) = default; protected: QStyleOptionDockWidget(int version); @@ -452,7 +452,7 @@ public: QStyleOptionViewItem(); QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionViewItem &operator=(const QStyleOptionViewItem &other) = default; + QStyleOptionViewItem &operator=(const QStyleOptionViewItem &) = default; protected: QStyleOptionViewItem(int version); @@ -483,7 +483,7 @@ public: QStyleOptionToolBox(); QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionToolBox &operator=(const QStyleOptionToolBox &other) = default; + QStyleOptionToolBox &operator=(const QStyleOptionToolBox &) = default; protected: QStyleOptionToolBox(int version); @@ -503,7 +503,7 @@ public: QStyleOptionRubberBand(); QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionRubberBand &operator=(const QStyleOptionRubberBand &other) = default; + QStyleOptionRubberBand &operator=(const QStyleOptionRubberBand &) = default; protected: QStyleOptionRubberBand(int version); @@ -522,7 +522,7 @@ public: QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex); QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionComplex &operator=(const QStyleOptionComplex &other) = default; + QStyleOptionComplex &operator=(const QStyleOptionComplex &) = default; }; #if QT_CONFIG(slider) @@ -547,7 +547,7 @@ public: QStyleOptionSlider(); QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionSlider &operator=(const QStyleOptionSlider &other) = default; + QStyleOptionSlider &operator=(const QStyleOptionSlider &) = default; protected: QStyleOptionSlider(int version); @@ -567,7 +567,7 @@ public: QStyleOptionSpinBox(); QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionSpinBox &operator=(const QStyleOptionSpinBox &other) = default; + QStyleOptionSpinBox &operator=(const QStyleOptionSpinBox &) = default; protected: QStyleOptionSpinBox(int version); @@ -595,7 +595,7 @@ public: QStyleOptionToolButton(); QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionToolButton &operator=(const QStyleOptionToolButton &other) = default; + QStyleOptionToolButton &operator=(const QStyleOptionToolButton &) = default; protected: QStyleOptionToolButton(int version); @@ -618,7 +618,7 @@ public: QStyleOptionComboBox(); QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionComboBox &operator=(const QStyleOptionComboBox &other) = default; + QStyleOptionComboBox &operator=(const QStyleOptionComboBox &) = default; protected: QStyleOptionComboBox(int version); @@ -637,7 +637,7 @@ public: QStyleOptionTitleBar(); QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionTitleBar &operator=(const QStyleOptionTitleBar &other) = default; + QStyleOptionTitleBar &operator=(const QStyleOptionTitleBar &) = default; protected: QStyleOptionTitleBar(int version); @@ -658,7 +658,7 @@ public: QStyleOptionGroupBox(); QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionGroupBox &operator=(const QStyleOptionGroupBox &other) = default; + QStyleOptionGroupBox &operator=(const QStyleOptionGroupBox &) = default; protected: QStyleOptionGroupBox(int version); }; @@ -673,7 +673,7 @@ public: QStyleOptionSizeGrip(); QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; } - QStyleOptionSizeGrip &operator=(const QStyleOptionSizeGrip &other) = default; + QStyleOptionSizeGrip &operator=(const QStyleOptionSizeGrip &) = default; protected: QStyleOptionSizeGrip(int version); }; @@ -690,7 +690,7 @@ public: QStyleOptionGraphicsItem(); QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; } - QStyleOptionGraphicsItem &operator=(const QStyleOptionGraphicsItem &other) = default; + QStyleOptionGraphicsItem &operator=(const QStyleOptionGraphicsItem &) = default; static qreal levelOfDetailFromTransform(const QTransform &worldTransform); protected: QStyleOptionGraphicsItem(int version); diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 3b387c92350..7ee085b81c9 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -491,7 +491,7 @@ void tst_QApplication::lastWindowClosed() QPointer dialog = new QDialog; dialog->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("Dialog")); QVERIFY(dialog->testAttribute(Qt::WA_QuitOnClose)); - QTimer::singleShot(1000, dialog, &QDialog::accept); + QTimer::singleShot(1000, dialog.data(), &QDialog::accept); dialog->exec(); QVERIFY(dialog); QCOMPARE(spy.count(), 0); From 64d949207686a0225a78de572548a5361e340ae3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jul 2019 08:54:30 -0700 Subject: [PATCH 15/43] Fix race condition on qt_create_tls() on Windows If this function is called by multiple threads, more than one could reach the mutex locking and call TlsAlloc(), but only the last one would save the data. The others would be leaked and, worse, be used by those other threads. [ChangeLog][QtCore][QObject] Fixed a resource leak caused by a race condition if multiple QObjects were created at the same time, for the first time in an application, from multiple threads (implies threads not started with QThread). Fixes: QTBUG-77238 Change-Id: Ife213d861bb14c1787e1fffd15b63a5818bcc807 Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/thread/qthread_win.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index e56fe2c6aea..5c7642c26ea 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -99,6 +99,8 @@ void qt_create_tls() return; static QBasicMutex mutex; QMutexLocker locker(&mutex); + if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES) + return; qt_current_thread_data_tls_index = TlsAlloc(); } From 787e498487831c55be89979824709622ba29f17c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 24 Jun 2019 09:41:07 +0200 Subject: [PATCH 16/43] QMutexPool: fix memory order of atomic operations The array of QAtomicPointer can be initialized using relaxed stores of nullptr, since nullptr is the whole data. But once we store an actual QMutex pointer in the array, we need to publish the indirect data thus created. We did this, with testAndSetRelease(); what was missing was a corresponding acquire fence on load, without which there is no happens-before relationship between the writes performed by the QMutex ctor and the reads performed by a subsequent mutex.lock(), say, on the same data. Fix by adding acquire fences to all loads. That includes the dtor, since mutexes may have been created in different threads, and never been imported into this_thread before the dtor is running. As a drive-by, return a new'ed QMutex that was successfully installed directly to the caller, without again going through a load-acquire. Fixes: QTBUG-59164 Change-Id: Ia25d205b1127c8c4de0979cef997d1a88123c5c3 Reviewed-by: David Faure Reviewed-by: Giuseppe D'Angelo Reviewed-by: Thiago Macieira (cherry picked from commit 65b8f59e045bb41fef99b1a44f462115de65064a) (cherry picked from commit da38f0d691d9d7eacfac5fbcbd47b887bd59bd39) --- src/corelib/thread/qmutexpool.cpp | 9 ++++++--- src/corelib/thread/qmutexpool_p.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 3f9e8da9427..bb063b8ab67 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -104,7 +104,7 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) QMutexPool::~QMutexPool() { for (int index = 0; index < mutexes.count(); ++index) - delete mutexes[index].load(); + delete mutexes[index].loadAcquire(); } /*! @@ -129,9 +129,12 @@ QMutex *QMutexPool::createMutex(int index) { // mutex not created, create one QMutex *newMutex = new QMutex(recursionMode); - if (!mutexes[index].testAndSetRelease(0, newMutex)) + if (!mutexes[index].testAndSetRelease(nullptr, newMutex)) { delete newMutex; - return mutexes[index].load(); + return mutexes[index].loadAcquire(); + } else { + return newMutex; + } } /*! diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 89d006ac29f..00710199b88 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -68,7 +68,7 @@ public: inline QMutex *get(const void *address) { int index = uint(quintptr(address)) % mutexes.count(); - QMutex *m = mutexes[index].load(); + QMutex *m = mutexes[index].loadAcquire(); if (m) return m; else From 0ea7360eaa70c2b024a37b2ff9106531440cdee7 Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Wed, 7 Aug 2019 10:50:55 +0200 Subject: [PATCH 17/43] Fix two examples in QUrl::toLocalFile() documentation Change-Id: Ib17844e1dd696a41815bdf58924ff40d684884a8 Reviewed-by: Cristian Maureira-Fredes --- src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp b/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp index 79af776ce4b..e3c3005c332 100644 --- a/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_io_qurl.cpp @@ -183,7 +183,7 @@ QUrl url("http://qt-project.org/support/file.html"); //! [19] //! [20] - qDebug() << QUrl("file:file.txt").toLocalFile(); // "file:file.txt" - qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "file:///home/user/file.txt" + qDebug() << QUrl("file:file.txt").toLocalFile(); // "file.txt" + qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "/home/user/file.txt" qDebug() << QUrl("file.txt").toLocalFile(); // ""; wasn't a local file as it had no scheme //! [20] From fccb519809d8e64db0e9cc54852c8612fe59b6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 6 Aug 2019 17:48:15 +0200 Subject: [PATCH 18/43] Don't rely on QWidget::internalWinId in QWidgetBackingStore QWidget does not handle QWindow and QPlatformWindow being destroyed behind its back, and the QWidget state for internalWinId and the Qt::WA_WState_Created attribute can easily get out of sync with reality. To avoid QWidgetBackingStore mistakenly thinking that a widget does not have a platform window it can operate on we use the QWindow and QPlatformWindow handles directly, instead of relying on the winId. This is a stop gap until we can teach QWidget to deal with dynamic changes to its underlying window handles. Change-Id: Ib09bea2ad62c42e9667a20ca6b5faf0f957288da Fixes: QTBUG-74559 Reviewed-by: Lars Knoll --- src/widgets/kernel/qwidgetbackingstore.cpp | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index a32eb2a03bc..24b86650134 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -76,6 +76,11 @@ extern QRegion qt_dirtyRegion(QWidget *); Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList) #endif +static bool hasPlatformWindow(QWidget *widget) +{ + return widget && widget->windowHandle() && widget->windowHandle()->handle(); +} + /** * Flushes the contents of the \a backingStore into the screen area of \a widget. * \a region is the region to be updated in \a widget coordinates. @@ -198,7 +203,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa QRegion paintRegion = toBePainted; QRect widgetRect = widget->rect(); - if (!widget->internalWinId()) { + if (!hasPlatformWindow(widget)) { QWidget *nativeParent = widget->nativeParentWidget(); const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0)); paintRegion.translate(offset); @@ -715,7 +720,7 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg } // Alien widgets. - if (!widget->internalWinId() && !widget->isWindow()) { + if (!hasPlatformWindow(widget) && !widget->isWindow()) { QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case). if (nativeParent == tlw) { if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) @@ -845,7 +850,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) destRect = destRect.translated(dx, dy).intersected(clipR); const QRect sourceRect(destRect.translated(-dx, -dy)); const QRect parentRect(rect & clipR); - const bool nativeWithTextureChild = textureChildSeen && q->internalWinId(); + const bool nativeWithTextureChild = textureChildSeen && hasPlatformWindow(q); const bool accelerateMove = accelEnv && isOpaque && !nativeWithTextureChild #if QT_CONFIG(graphicsview) @@ -1013,9 +1018,9 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo for (int i = 0; i < wd->children.size(); ++i) { QWidget *w = qobject_cast(wd->children.at(i)); // Stop at native widgets but store them. Stop at hidden widgets too. - if (w && !w->isWindow() && w->internalWinId()) + if (w && !w->isWindow() && hasPlatformWindow(w)) nativeChildren->append(w); - if (w && !w->isWindow() && !w->internalWinId() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) + if (w && !w->isWindow() && !hasPlatformWindow(w) && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen) findTextureWidgetsRecursively(tlw, w, widgetTextures, nativeChildren); } } @@ -1046,7 +1051,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) Q_ASSERT(!tl->isEmpty()); for (int i = 0; i < tl->count(); ++i) { QWidget *w = static_cast(tl->source(i)); - if ((w->internalWinId() && w == widget) || (!w->internalWinId() && w->nativeParentWidget() == widget)) + if ((hasPlatformWindow(w) && w == widget) || (!hasPlatformWindow(w) && w->nativeParentWidget() == widget)) return tl; } } @@ -1157,7 +1162,8 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize) return; - if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped) + if (!exposedWidget || !hasPlatformWindow(exposedWidget) + || !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped) || !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) { return; } @@ -1330,8 +1336,8 @@ void QWidgetBackingStore::doSync() w->d_func()->sendPaintEvent(w->rect()); if (w != tlw) { QWidget *npw = w->nativeParentWidget(); - if (w->internalWinId() || (npw && npw != tlw)) { - if (!w->internalWinId()) + if (hasPlatformWindow(w) || (npw && npw != tlw)) { + if (!hasPlatformWindow(w)) w = npw; QWidgetPrivate *wPrivate = w->d_func(); if (!wPrivate->needsFlush) From 53a6f7b7836ef5084106ed63f6745c20d663affa Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 6 Aug 2019 13:15:35 +0200 Subject: [PATCH 19/43] eglfs: Fix raster windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also sanitize the initial WebAssembly hack. Both eglfs and wasm lack the concept of true raster windows. A QWindow with RasterSurface is rendered with OpenGL no matter what. The two platforms took two different approaches to work around the rest of the machinery: - wasm disabled the QOpenGLContext warning for non-OpenGL QWindows, - eglfs forced the QWindow surfaceType to OpenGLSurface whenever it was originally set to RasterSurface. Now, the latter breaks since c4e9eabc309a275efc222f4127f31ba4677259b7, leaving all raster window applications failing on eglfs, because flush in the backingstore is now checking the surface type and disallows OpenGLSurface windows. (just like how QOpenGLContext disallows RasterSurface windows) To solve all this correctly, introduce a new platform capability, OpenGLOnRasterSurface, and remove the special handling in the platform plugins. Change-Id: I7785dfb1c955577bbdccdc14ebaaac5babdec57c Fixes: QTBUG-77100 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qopenglcontext.cpp | 3 --- src/gui/kernel/qplatformintegration.cpp | 3 +++ src/gui/kernel/qplatformintegration.h | 3 ++- src/gui/kernel/qsurface.cpp | 6 ++++++ src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 1 + src/plugins/platforms/eglfs/api/qeglfswindow.cpp | 9 ++------- src/plugins/platforms/eglfs/api/qeglfswindow_p.h | 1 - src/plugins/platforms/wasm/qwasmintegration.cpp | 1 + 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 499d16c109f..e8c64bdc01f 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -977,11 +977,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (!surface->surfaceHandle()) return false; if (!surface->supportsOpenGL()) { -#ifndef Q_OS_WASM // ### work around the WASM platform plugin using QOpenGLContext with raster surfaces. - // see QTBUG-70076 qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface; return false; -#endif } if (!d->platformGLContext->makeCurrent(surface->surfaceHandle())) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index ac4d12b0244..258d214c7af 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -244,6 +244,9 @@ QPlatformServices *QPlatformIntegration::services() const \value TopStackedNativeChildWindows The platform supports native child windows via QWindowContainer without having to punch a transparent hole in the backingstore. (since 5.10) + + \value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current + in combination with a QWindow of type RasterSurface. */ /*! diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 1179daeb323..0b999de2644 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -103,7 +103,8 @@ public: AllGLFunctionsQueryable, ApplicationIcon, SwitchableWidgetComposition, - TopStackedNativeChildWindows + TopStackedNativeChildWindows, + OpenGLOnRasterSurface }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp index 415e64b39c4..709f28d4318 100644 --- a/src/gui/kernel/qsurface.cpp +++ b/src/gui/kernel/qsurface.cpp @@ -39,6 +39,8 @@ #include "qsurface.h" #include "qopenglcontext.h" +#include +#include QT_BEGIN_NAMESPACE @@ -103,6 +105,10 @@ QT_BEGIN_NAMESPACE bool QSurface::supportsOpenGL() const { SurfaceType type = surfaceType(); + if (type == RasterSurface) { + QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration(); + return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface); + } return type == OpenGLSurface || type == RasterGLSurface; } diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index c8a1ddf9b9b..674f579b4fd 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -265,6 +265,7 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons case RasterGLSurface: return false; #endif case WindowManagement: return false; + case OpenGLOnRasterSurface: return true; default: return QPlatformIntegration::hasCapability(cap); } } diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index c1d5af47aa8..1fed1828824 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -64,7 +64,6 @@ QEglFSWindow::QEglFSWindow(QWindow *w) m_backingStore(0), m_rasterCompositingContext(0), #endif - m_raster(false), m_winId(0), m_surface(EGL_NO_SURFACE), m_window(0), @@ -94,11 +93,6 @@ void QEglFSWindow::create() m_winId = newWId(); - // Save the original surface type before changing to OpenGLSurface. - m_raster = (window()->surfaceType() == QSurface::RasterSurface); - if (m_raster) // change to OpenGL, but not for RasterGLSurface - window()->setSurfaceType(QSurface::OpenGLSurface); - if (window()->type() == Qt::Desktop) { QRect fullscreenRect(QPoint(), screen()->availableGeometry().size()); QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect); @@ -329,7 +323,8 @@ QEglFSScreen *QEglFSWindow::screen() const bool QEglFSWindow::isRaster() const { - return m_raster || window()->surfaceType() == QSurface::RasterGLSurface; + const QWindow::SurfaceType type = window()->surfaceType(); + return type == QSurface::RasterSurface || type == QSurface::RasterGLSurface; } #ifndef QT_NO_OPENGL diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h index b0091e2a629..be2a0630d3c 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h @@ -118,7 +118,6 @@ protected: QOpenGLCompositorBackingStore *m_backingStore; QOpenGLContext *m_rasterCompositingContext; #endif - bool m_raster; WId m_winId; EGLSurface m_surface; diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 3829043d078..05d6ae21f51 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -113,6 +113,7 @@ bool QWasmIntegration::hasCapability(QPlatformIntegration::Capability cap) const case RasterGLSurface: return false; // to enable this you need to fix qopenglwidget and quickwidget for wasm case MultipleWindows: return true; case WindowManagement: return true; + case OpenGLOnRasterSurface: return true; default: return QPlatformIntegration::hasCapability(cap); } } From 36cc171b9314bf77fc84d4273dceb6264aef7134 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 6 Aug 2019 07:50:14 +0200 Subject: [PATCH 20/43] tst_http2::connectToHost - fix flakiness some assumptions were incorrect: our test server immediately sends its SETTINGS frame, as a result we have to reply with client preface + SETTINGS(ACK). So QVERIFY(!prefaceOK) was wrong from the beginning and was only passing by pure luck. Change-Id: Ie43f0d4ac41deb0e5339badaae6149a9b2f9d9b3 Reviewed-by: Timur Pocheptsov Reviewed-by: Volker Hilsheimer --- tests/auto/network/access/http2/BLACKLIST | 3 --- tests/auto/network/access/http2/tst_http2.cpp | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 tests/auto/network/access/http2/BLACKLIST diff --git a/tests/auto/network/access/http2/BLACKLIST b/tests/auto/network/access/http2/BLACKLIST deleted file mode 100644 index 8f26c5b89e6..00000000000 --- a/tests/auto/network/access/http2/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ - See qtbase/src/testlib/qtestblacklist.cpp for format -[connectToHost] -* diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 10dad253374..4b4b8d541a5 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -648,9 +648,6 @@ void tst_Http2::connectToHost() eventLoop.exitLoop(); QCOMPARE(reply->error(), QNetworkReply::NoError); QVERIFY(reply->isFinished()); - // Nothing must be sent yet: - QVERIFY(!prefaceOK); - QVERIFY(!serverGotSettingsACK); // Nothing received back: QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull()); QCOMPARE(reply->readAll().size(), 0); From 1880fba971ed8ae8e813829ff3668132371e88a7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 29 Jul 2019 14:16:00 +0200 Subject: [PATCH 21/43] Android: Fix QMenu on 64 bit The platform menu tags in Qt are actually the pointers, so they are 64-bit values when the build is 64 bit. Since menu IDs in Android are 32-bit ints, we cannot cast back and forth like we do. To fix this, we add a separate hash of menu IDs to allow mapping between Java and C++. For easier book-keeping, we add the hashes to the menu bar and menu classes, so that we can easily recycle old menu IDs when they are no longer in use. Note that overriding the tag on the menus by calling setTag() will not work, since Qt Widgets will later override it again by setting it back to the menu's pointer. [ChangeLog][Android] Fixed an issue where menus would not work on 64 bit builds. Task-number: QTBUG-76036 Change-Id: Icaa1d235d4166331669139251656ea0159e85195 Reviewed-by: Frederik Gladhorn --- .../platforms/android/androidjnimenu.cpp | 12 +++--- .../android/qandroidplatformmenu.cpp | 43 ++++++++++++++++--- .../platforms/android/qandroidplatformmenu.h | 5 +++ .../android/qandroidplatformmenubar.cpp | 34 ++++++++++++++- .../android/qandroidplatformmenubar.h | 6 +++ 5 files changed, 88 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp index 6f548aba528..e9359def0fc 100644 --- a/src/plugins/platforms/android/androidjnimenu.cpp +++ b/src/plugins/platforms/android/androidjnimenu.cpp @@ -225,10 +225,11 @@ namespace QtAndroidMenu QString itemText = removeAmpersandEscapes(item->text()); jstring jtext = env->NewString(reinterpret_cast(itemText.data()), itemText.length()); + jint menuId = platformMenu->menuId(item); jobject menuItem = env->CallObjectMethod(menu, addMenuItemMethodID, menuNoneValue, - int(item->tag()), + menuId, order++, jtext); env->DeleteLocalRef(jtext); @@ -262,10 +263,11 @@ namespace QtAndroidMenu QString itemText = removeAmpersandEscapes(item->text()); jstring jtext = env->NewString(reinterpret_cast(itemText.data()), itemText.length()); + jint menuId = visibleMenuBar->menuId(item); jobject menuItem = env->CallObjectMethod(menu, addMenuItemMethodID, menuNoneValue, - int(item->tag()), + menuId, order++, jtext); env->DeleteLocalRef(jtext); @@ -290,7 +292,7 @@ namespace QtAndroidMenu const QAndroidPlatformMenuBar::PlatformMenusType &menus = visibleMenuBar->menus(); if (menus.size() == 1) { // Expanded menu - QAndroidPlatformMenuItem *item = static_cast(menus.front()->menuItemForTag(menuId)); + QAndroidPlatformMenuItem *item = static_cast(menus.front()->menuItemForId(menuId)); if (item) { if (item->menu()) { showContextMenu(item->menu(), QRect(), env); @@ -301,7 +303,7 @@ namespace QtAndroidMenu } } } else { - QAndroidPlatformMenu *menu = static_cast(visibleMenuBar->menuForTag(menuId)); + QAndroidPlatformMenu *menu = static_cast(visibleMenuBar->menuForId(menuId)); if (menu) showContextMenu(menu, QRect(), env); } @@ -341,7 +343,7 @@ namespace QtAndroidMenu static jboolean onContextItemSelected(JNIEnv *env, jobject /*thiz*/, jint menuId, jboolean checked) { QMutexLocker lock(&visibleMenuMutex); - QAndroidPlatformMenuItem * item = static_cast(visibleMenu->menuItemForTag(menuId)); + QAndroidPlatformMenuItem * item = static_cast(visibleMenu->menuItemForId(menuId)); if (item) { if (item->menu()) { showContextMenu(item->menu(), QRect(), env); diff --git a/src/plugins/platforms/android/qandroidplatformmenu.cpp b/src/plugins/platforms/android/qandroidplatformmenu.cpp index d9cecebf2c1..7ce603831f3 100644 --- a/src/plugins/platforms/android/qandroidplatformmenu.cpp +++ b/src/plugins/platforms/android/qandroidplatformmenu.cpp @@ -62,6 +62,7 @@ void QAndroidPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatform m_menuItems.end(), static_cast(before)), static_cast(menuItem)); + m_menuHash.insert(m_nextMenuId++, menuItem); } void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem) @@ -72,6 +73,21 @@ void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem) static_cast(menuItem)); if (it != m_menuItems.end()) m_menuItems.erase(it); + + { + int maxId = -1; + QHash::iterator it = m_menuHash.begin(); + while (it != m_menuHash.end()) { + if (it.value() == menuItem) { + it = m_menuHash.erase(it); + } else { + maxId = qMax(maxId, it.key()); + ++it; + } + } + + m_nextMenuId = maxId + 1; + } } void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem) @@ -139,6 +155,16 @@ void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, const QRect &t QtAndroidMenu::showContextMenu(this, targetRect, QJNIEnvironmentPrivate()); } +QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const +{ + for (QAndroidPlatformMenuItem *menuItem : m_menuItems) { + if (menuItem->tag() == tag) + return menuItem; + } + + return nullptr; +} + QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const { if (position < m_menuItems.size()) @@ -146,13 +172,20 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const return 0; } -QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const +int QAndroidPlatformMenu::menuId(QPlatformMenuItem *menu) const { - for (QPlatformMenuItem *menuItem : m_menuItems) { - if (menuItem->tag() == tag) - return menuItem; + QHash::const_iterator it; + for (it = m_menuHash.constBegin(); it != m_menuHash.constEnd(); ++it) { + if (it.value() == menu) + return it.key(); } - return 0; + + return -1; +} + +QPlatformMenuItem *QAndroidPlatformMenu::menuItemForId(int menuId) const +{ + return m_menuHash.value(menuId); } QAndroidPlatformMenu::PlatformMenuItemsType QAndroidPlatformMenu::menuItems() const diff --git a/src/plugins/platforms/android/qandroidplatformmenu.h b/src/plugins/platforms/android/qandroidplatformmenu.h index 47e650f2d78..b1d6a887877 100644 --- a/src/plugins/platforms/android/qandroidplatformmenu.h +++ b/src/plugins/platforms/android/qandroidplatformmenu.h @@ -73,6 +73,8 @@ public: QPlatformMenuItem *menuItemAt(int position) const override; QPlatformMenuItem *menuItemForTag(quintptr tag) const override; + QPlatformMenuItem *menuItemForId(int menuId) const; + int menuId(QPlatformMenuItem *menuItem) const; PlatformMenuItemsType menuItems() const; QMutex *menuItemsMutex(); @@ -84,6 +86,9 @@ private: bool m_enabled; bool m_isVisible; QMutex m_menuItemsMutex; + + int m_nextMenuId = 0; + QHash m_menuHash; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformmenubar.cpp b/src/plugins/platforms/android/qandroidplatformmenubar.cpp index 35930f06283..7c6299b4b79 100644 --- a/src/plugins/platforms/android/qandroidplatformmenubar.cpp +++ b/src/plugins/platforms/android/qandroidplatformmenubar.cpp @@ -61,6 +61,7 @@ void QAndroidPlatformMenuBar::insertMenu(QPlatformMenu *menu, QPlatformMenu *bef m_menus.end(), static_cast(before)), static_cast(menu)); + m_menuHash.insert(m_nextMenuId++, menu); } void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu) @@ -69,6 +70,30 @@ void QAndroidPlatformMenuBar::removeMenu(QPlatformMenu *menu) m_menus.erase(std::find(m_menus.begin(), m_menus.end(), static_cast(menu))); + + int maxId = -1; + QHash::iterator it = m_menuHash.begin(); + while (it != m_menuHash.end()) { + if (it.value() == menu) { + it = m_menuHash.erase(it); + } else { + maxId = qMax(maxId, it.key()); + ++it; + } + } + + m_nextMenuId = maxId + 1; +} + +int QAndroidPlatformMenuBar::menuId(QPlatformMenu *menu) const +{ + QHash::const_iterator it; + for (it = m_menuHash.constBegin(); it != m_menuHash.constEnd(); ++it) { + if (it.value() == menu) + return it.key(); + } + + return -1; } void QAndroidPlatformMenuBar::syncMenu(QPlatformMenu *menu) @@ -86,12 +111,17 @@ void QAndroidPlatformMenuBar::handleReparent(QWindow *newParentWindow) QPlatformMenu *QAndroidPlatformMenuBar::menuForTag(quintptr tag) const { - for (QPlatformMenu *menu : m_menus) { + for (QAndroidPlatformMenu *menu : m_menus) { if (menu->tag() == tag) return menu; } - return 0; + return nullptr; +} + +QPlatformMenu *QAndroidPlatformMenuBar::menuForId(int menuId) const +{ + return m_menuHash.value(menuId); } QWindow *QAndroidPlatformMenuBar::parentWindow() const diff --git a/src/plugins/platforms/android/qandroidplatformmenubar.h b/src/plugins/platforms/android/qandroidplatformmenubar.h index f5935b81779..81a26c72f44 100644 --- a/src/plugins/platforms/android/qandroidplatformmenubar.h +++ b/src/plugins/platforms/android/qandroidplatformmenubar.h @@ -43,6 +43,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -60,6 +61,8 @@ public: void syncMenu(QPlatformMenu *menu) override; void handleReparent(QWindow *newParentWindow) override; QPlatformMenu *menuForTag(quintptr tag) const override; + QPlatformMenu *menuForId(int menuId) const; + int menuId(QPlatformMenu *menu) const; QWindow *parentWindow() const override; PlatformMenusType menus() const; @@ -69,6 +72,9 @@ private: PlatformMenusType m_menus; QWindow *m_parentWindow; QMutex m_menusListMutex; + + int m_nextMenuId = 0; + QHash m_menuHash; }; QT_END_NAMESPACE From 79e0effead13f60676bb5170fe92615d981827e7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 7 Aug 2019 15:25:49 +0200 Subject: [PATCH 22/43] Fix crash in QTextDocument::clearUndoRedoStacks() When calling QTextDocument::clearUndoRedoStacks() with UndoStack, there were two bugs: The first was that we were retrieving the item at "undoState" and deleting this. This is actually the upper limit of the for loop. If the stack does not contain any redos, then it would be == undoStack.size() and we would assert. If there were redos, then we would delete the item at undoState multiple times (actually undoState times). In addition, when the loop exited, we first removed the dangling pointers using remove() and then there was a weird resize() to the new size minus the old undoState. This would either assert because we tried to resize to a negative number, or it would arbitrarily remove items from the stack. [ChangeLog][QtGui][Text] Fixed a crash bug in QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack). Task-number: QTBUG-69546 Change-Id: I8a93e828ec27970763a2756071fa0b01678d2dcd Reviewed-by: Simon Hausmann Reviewed-by: Konstantin Ritt --- src/gui/text/qtextdocument_p.cpp | 3 +-- .../gui/text/qtextdocument/tst_qtextdocument.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 66e038122c1..059e665d122 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1103,12 +1103,11 @@ void QTextDocumentPrivate::clearUndoRedoStacks(QTextDocument::Stacks stacksToCle bool redoCommandsAvailable = undoState != undoStack.size(); if (stacksToClear == QTextDocument::UndoStack && undoCommandsAvailable) { for (int i = 0; i < undoState; ++i) { - QTextUndoCommand c = undoStack.at(undoState); + QTextUndoCommand c = undoStack.at(i); if (c.command & QTextUndoCommand::Custom) delete c.custom; } undoStack.remove(0, undoState); - undoStack.resize(undoStack.size() - undoState); undoState = 0; if (emitSignals) emitUndoAvailable(false); diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 32131352c36..c04c8413769 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -188,6 +188,8 @@ private slots: void lineHeightType(); void cssLineHeightMultiplier(); + + void clearUndoRedoStacks(); private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); void buildRegExpData(); @@ -3486,5 +3488,16 @@ void tst_QTextDocument::cssLineHeightMultiplier() } } +void tst_QTextDocument::clearUndoRedoStacks() +{ + QTextDocument doc; + QTextCursor c(&doc); + c.insertText(QStringLiteral("lorem ipsum")); + QVERIFY(doc.isUndoAvailable()); + doc.clearUndoRedoStacks(QTextDocument::UndoStack); // Don't crash + QVERIFY(!doc.isUndoAvailable()); +} + + QTEST_MAIN(tst_QTextDocument) #include "tst_qtextdocument.moc" From a3dec41cf1c8078e11eae90167a0282eba2ce084 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Jul 2019 10:19:44 +0200 Subject: [PATCH 23/43] Add attribution for AGLFN We were missing attribution for the AGLFN tables. Task-number: QTBUG-70968 Change-Id: Ib84cbd25c9f7c49611761c9eba16624de5b77dd2 Reviewed-by: Lars Knoll --- src/gui/text/AGLFN_LICENSE.txt | 26 ++++++++++++++++++++++++++ src/gui/text/qt_attribution.json | 17 +++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/gui/text/AGLFN_LICENSE.txt create mode 100644 src/gui/text/qt_attribution.json diff --git a/src/gui/text/AGLFN_LICENSE.txt b/src/gui/text/AGLFN_LICENSE.txt new file mode 100644 index 00000000000..50abffca157 --- /dev/null +++ b/src/gui/text/AGLFN_LICENSE.txt @@ -0,0 +1,26 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +Neither the name of Adobe Systems Incorporated nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/gui/text/qt_attribution.json b/src/gui/text/qt_attribution.json new file mode 100644 index 00000000000..c3a57267e2f --- /dev/null +++ b/src/gui/text/qt_attribution.json @@ -0,0 +1,17 @@ +[ + { + "Id": "aglfn", + "Name": "Adobe Glyph List For New Fonts", + "QDocModule": "qtgui", + "Description": "Provides standardized names for glyphs.", + "QtUsage": "Used by PDF generator to make it easier for reader applications to resolve the original contents of rendered text.", + "Path": "qfontsubset_agl.cpp", + + "Homepage": "https://github.com/adobe-type-tools/agl-aglfn", + "Version": "1.7", + "License": "BSD 3-Clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "AGLFN_LICENSE.txt", + "Copyright": "Copyright 2002, 2003, 2005, 2006, 2008, 2010, 2015 Adobe Systems" + } +] From 4d9375020c59282b447aad5189c2adb12931e4a1 Mon Sep 17 00:00:00 2001 From: Jason Haslam Date: Tue, 18 Jun 2019 11:51:38 -0600 Subject: [PATCH 24/43] macOS: Fix tab button rendering issue This fixes rendering artifacts for the specific case of the first unselected vertical (west) tab button in a tab bar. The popup button gets drawn at the beginning of the tab bar instead of translated to the actual location of the tab. Fixes: QTBUG-76385 Change-Id: I17112c56eabacf34e470314d4cc6b263ba632ec1 Reviewed-by: Timur Pocheptsov --- src/plugins/styles/mac/qmacstyle_mac.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 1ff1c22788d..07651fc2061 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -3944,6 +3944,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter CGContextScaleCTM(ctx, -1, 1); CGContextTranslateCTM(ctx, -frameRect.left(), 0); } else if (tabDirection == QMacStylePrivate::West && tp == QStyleOptionTab::Beginning) { + CGContextTranslateCTM(ctx, 0, opt->rect.top()); CGContextScaleCTM(ctx, 1, -1); CGContextTranslateCTM(ctx, 0, -frameRect.right()); } else if (tabDirection == QMacStylePrivate::East && tp == QStyleOptionTab::End) { From ca20b449592ed05eca0c476d2fcf5d0851d92c36 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Tue, 6 Aug 2019 10:50:52 +0300 Subject: [PATCH 25/43] A GCC 4.8 build fix Change-Id: Ic128486711118e1124739e8dca30547ab8ba9816 Reviewed-by: Simon Hausmann --- tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 5b4a5d30a5e..d13c1451895 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -486,7 +486,7 @@ void tst_QApplication::lastWindowClosed() QPointer dialog = new QDialog; dialog->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("Dialog")); QVERIFY(dialog->testAttribute(Qt::WA_QuitOnClose)); - QTimer::singleShot(1000, dialog, &QDialog::accept); + QTimer::singleShot(1000, dialog.data(), &QDialog::accept); dialog->exec(); QVERIFY(dialog); QCOMPARE(spy.count(), 0); From 6ac610c79bf7f311ee244d45583eb669ada58781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 31 Jul 2019 15:42:46 +0200 Subject: [PATCH 26/43] Allow specifying explicit SDK version on Apple platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables building against the latest SDK, while still opting out of features that this SDK normally enables, by lowering the SDK version set in the BUILD_VERSION/VERSION_MIN_MACOSX load command. Change-Id: Id5f13524740bfbf5eda10a5d0c2e3fda04bf3f52 Reviewed-by: Jörg Bornemann Reviewed-by: Morten Johan Sørvig Reviewed-by: Timur Pocheptsov --- mkspecs/features/mac/default_post.prf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index f34b305d08c..60b2eb2117b 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -1,5 +1,9 @@ load(default_post) +# Recompute SDK version in case the user set it explicitly +sdk_version = $$QMAKE_MAC_SDK_VERSION +QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion) + contains(TEMPLATE, .*app) { !macx-xcode:if(isEmpty(BUILDS)|build_pass) { # Detect changes to the platform SDK @@ -14,7 +18,7 @@ contains(TEMPLATE, .*app) { !versionAtLeast(QMAKE_MAC_SDK_VERSION, $$QT_MAC_SDK_VERSION_MIN): \ warning("Qt requires at least version $$QT_MAC_SDK_VERSION_MIN of the platform SDK," \ - "you're using $${QMAKE_MAC_SDK_VERSION}. Please upgrade.") + "you're building against version $${QMAKE_MAC_SDK_VERSION}. Please upgrade.") !isEmpty(QT_MAC_SDK_VERSION_MAX) { # For Qt developers only @@ -244,6 +248,11 @@ macx-xcode { QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT} } +!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) { + # Explicit SDK version has been set, respect that + QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version +} + cache(QMAKE_XCODE_DEVELOPER_PATH, stash) !isEmpty(QMAKE_XCODE_VERSION): \ cache(QMAKE_XCODE_VERSION, stash) From afb326f07109da0035112e6f56e683e37b8a5d72 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 17 Nov 2017 10:59:47 +0100 Subject: [PATCH 27/43] Refactor lockedAlphaMapForGlyph Simply return a Glyph pointer and not a QImage to avoid allocating and deleting lots of d pointers for QImage when drawing text. Saves one new/delete pair per glyph drawn and speeds up text drawing by 10% for relatively large glyphs (probably more for smaller ones). The qtext::paintLayoutToPixmap() benchmark shows a 16% improvement in performance with this change. Renamed the method to glyphData(). Change-Id: I7a353de521e4f4321c770fb1ac6043d33f6f332c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpaintengine_raster.cpp | 35 +++++++++++----- src/gui/text/qfontengine.cpp | 25 ++--------- src/gui/text/qfontengine_p.h | 23 ++++++++--- .../fontdatabases/freetype/qfontengine_ft.cpp | 41 +++---------------- .../fontdatabases/freetype/qfontengine_ft_p.h | 20 +-------- 5 files changed, 53 insertions(+), 91 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 096e4a5c5b0..885c46e121b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2908,19 +2908,34 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, for (int i = 0; i < numGlyphs; i++) { QFixed spp = fontEngine->subPixelPositionForX(positions[i].x); - QPoint offset; - const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, - &offset); - if (alphaMap == 0 || alphaMap->isNull()) + const QFontEngine::Glyph *alphaMap = fontEngine->glyphData(glyphs[i], spp, neededFormat, s->matrix); + if (!alphaMap) continue; - alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(), - qFloor(positions[i].x) + offset.x(), - qRound(positions[i].y) + offset.y(), - alphaMap->width(), alphaMap->height(), - fontEngine->expectsGammaCorrectedBlending()); + int depth; + int bytesPerLine; + switch (alphaMap->format) { + case QFontEngine::Format_Mono: + depth = 1; + bytesPerLine = ((alphaMap->width + 31) & ~31) >> 3; + break; + case QFontEngine::Format_A8: + depth = 8; + bytesPerLine = (alphaMap->width + 3) & ~3; + break; + case QFontEngine::Format_A32: + depth = 32; + bytesPerLine = alphaMap->width * 4; + break; + default: + Q_UNREACHABLE(); + }; - fontEngine->unlockAlphaMapForGlyph(); + alphaPenBlt(alphaMap->data, bytesPerLine, depth, + qFloor(positions[i].x) + alphaMap->x, + qRound(positions[i].y) - alphaMap->y, + alphaMap->width, alphaMap->height, + fontEngine->expectsGammaCorrectedBlending()); } } else { diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 5506d88f020..1895ac82837 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -923,29 +923,10 @@ QFixed QFontEngine::subPixelPositionForX(QFixed x) const return subPixelPosition; } -QImage *QFontEngine::lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, - QFontEngine::GlyphFormat neededFormat, - const QTransform &t, QPoint *offset) +QFontEngine::Glyph *QFontEngine::glyphData(glyph_t, QFixed, + QFontEngine::GlyphFormat, const QTransform &) { - Q_ASSERT(currentlyLockedAlphaMap.isNull()); - if (neededFormat == Format_None) - neededFormat = Format_A32; - - if (neededFormat != Format_A32) - currentlyLockedAlphaMap = alphaMapForGlyph(glyph, subPixelPosition, t); - else - currentlyLockedAlphaMap = alphaRGBMapForGlyph(glyph, subPixelPosition, t); - - if (offset != 0) - *offset = QPoint(0, 0); - - return ¤tlyLockedAlphaMap; -} - -void QFontEngine::unlockAlphaMapForGlyph() -{ - Q_ASSERT(!currentlyLockedAlphaMap.isNull()); - currentlyLockedAlphaMap = QImage(); + return nullptr; } QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 682395ece6f..48dcdbeff73 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -124,6 +124,22 @@ public: }; Q_DECLARE_FLAGS(ShaperFlags, ShaperFlag) + /* Used with the Freetype font engine. We don't cache glyphs that are too large anyway, so we can make this struct rather small */ + struct Glyph { + Glyph() = default; + ~Glyph() { delete [] data; } + short linearAdvance = 0; + unsigned char width = 0; + unsigned char height = 0; + short x = 0; + short y = 0; + short advance = 0; + signed char format = 0; + uchar *data = nullptr; + private: + Q_DISABLE_COPY(Glyph); + }; + virtual ~QFontEngine(); inline Type type() const { return m_type; } @@ -191,11 +207,7 @@ public: virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t); virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t); virtual QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t, const QColor &color = QColor()); - virtual QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, - GlyphFormat neededFormat, - const QTransform &t = QTransform(), - QPoint *offset = 0); - virtual void unlockAlphaMapForGlyph(); + virtual Glyph *glyphData(glyph_t glyph, QFixed subPixelPosition, GlyphFormat neededFormat, const QTransform &t); virtual bool hasInternalCaching() const { return false; } virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/) @@ -346,7 +358,6 @@ public: void loadKerningPairs(QFixed scalingFactor); GlyphFormat glyphFormat; - QImage currentlyLockedAlphaMap; int m_subPixelPositionCount; // Number of positions within a single pixel for this cache inline QVariant userData() const { return m_userData; } diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index ef80d68bfed..e132442e379 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -106,7 +106,7 @@ static bool ft_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *leng return result; } -static QFontEngineFT::Glyph emptyGlyph = {0, 0, 0, 0, 0, 0, 0, 0}; +static QFontEngineFT::Glyph emptyGlyph; static const QFontEngine::HintStyle ftInitialDefaultHintStyle = #ifdef Q_OS_WIN @@ -556,11 +556,6 @@ void QFreetypeFace::addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, slot->bitmap.buffer, slot->bitmap.pitch, slot->bitmap.width, slot->bitmap.rows, path); } -QFontEngineFT::Glyph::~Glyph() -{ - delete [] data; -} - struct LcdFilterDummy { static inline void filterPixel(uchar &, uchar &, uchar &) @@ -1986,11 +1981,10 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng return img; } -QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixelPosition, - QFontEngine::GlyphFormat neededFormat, - const QTransform &t, QPoint *offset) +QFontEngine::Glyph *QFontEngineFT::glyphData(glyph_t glyphIndex, QFixed subPixelPosition, + QFontEngine::GlyphFormat neededFormat, const QTransform &t) { - Q_ASSERT(currentlyLockedAlphaMap.isNull()); + Q_ASSERT(cacheEnabled); if (isBitmapFont()) neededFormat = Format_Mono; @@ -2000,33 +1994,10 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe neededFormat = Format_A8; Glyph *glyph = loadGlyphFor(glyphIndex, subPixelPosition, neededFormat, t); - - if (offset != 0 && glyph != 0) - *offset = QPoint(glyph->x, -glyph->y); - - currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat); - - const bool glyphHasGeometry = glyph != nullptr && glyph->height != 0 && glyph->width != 0; - if (!cacheEnabled && glyph != &emptyGlyph) { - currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy(); - delete glyph; - } - - if (!glyphHasGeometry) + if (!glyph || !glyph->width || !glyph->height) return nullptr; - if (currentlyLockedAlphaMap.isNull()) - return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset); - - QImageData *data = currentlyLockedAlphaMap.data_ptr(); - data->is_locked = true; - - return ¤tlyLockedAlphaMap; -} - -void QFontEngineFT::unlockAlphaMapForGlyph() -{ - QFontEngine::unlockAlphaMapForGlyph(); + return glyph; } static inline bool is2dRotation(const QTransform &t) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h index 109bae86e9b..2863d206d24 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h @@ -129,20 +129,6 @@ private: class QFontEngineFT : public QFontEngine { public: - - /* we don't cache glyphs that are too large anyway, so we can make this struct rather small */ - struct Glyph { - ~Glyph(); - int linearAdvance : 22; - unsigned char width; - unsigned char height; - short x; - short y; - short advance; - signed char format; - uchar *data; - }; - struct GlyphInfo { int linearAdvance; unsigned short width; @@ -241,11 +227,9 @@ private: QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format) override; - QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, - GlyphFormat neededFormat, const QTransform &t, - QPoint *offset) override; + Glyph *glyphData(glyph_t glyph, QFixed subPixelPosition, + GlyphFormat neededFormat, const QTransform &t) override; bool hasInternalCaching() const override { return cacheEnabled; } - void unlockAlphaMapForGlyph() override; bool expectsGammaCorrectedBlending() const override; void removeGlyphFromCache(glyph_t glyph) override; From aef0fba3c550915318db5b350892f558ec7e77ff Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 7 Aug 2019 13:33:41 +0200 Subject: [PATCH 28/43] QCocoaMenuLoader: get rid of lastAppSpecificItem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Look it up when needed instead. Also, simplify our ownership logic - do not retain/autorelease that is already owned by a menu (via its itemArray). Fixes: QTBUG-76523 Change-Id: I60a2ed0d192396baf99eec7b37fa5cc10e5db626 Reviewed-by: Tor Arne Vestbø --- .../platforms/cocoa/qcocoamenuloader.mm | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index da0fc5c6a1d..d384078e91b 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -59,7 +59,6 @@ NSMenuItem *aboutItem; NSMenuItem *aboutQtItem; NSMenuItem *hideItem; - NSMenuItem *lastAppSpecificItem; NSMenuItem *servicesItem; NSMenuItem *hideAllOthersItem; NSMenuItem *showAllItem; @@ -118,6 +117,9 @@ [appMenu addItem:[NSMenuItem separatorItem]]; // Preferences + // We'll be adding app specific items after this. The macOS HIG state that, + // "In general, a Preferences menu item should be the first app-specific menu item." + // https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/ preferencesItem = [[QCocoaNSMenuItem alloc] init]; preferencesItem.title = @"Preferences…"; preferencesItem.keyEquivalent = @","; @@ -126,11 +128,6 @@ preferencesItem.hidden = YES; [appMenu addItem:preferencesItem]; - // We'll be adding app specific items after this. The macOS HIG state that, - // "In general, a Preferences menu item should be the first app-specific menu item." - // https://developer.apple.com/macos/human-interface-guidelines/menus/menu-bar-menus/ - lastAppSpecificItem = preferencesItem; - [appMenu addItem:[NSMenuItem separatorItem]]; // Services item and menu @@ -194,8 +191,6 @@ [showAllItem release]; [quitItem release]; - [lastAppSpecificItem release]; - [super dealloc]; } @@ -272,25 +267,20 @@ // No reason to create the item if it already exists. for (NSMenuItem *item in appMenu.itemArray) if (qt_objc_cast(item).platformMenuItem == platformItem) - return [[item retain] autorelease]; + return item; // Create an App-Specific menu item, insert it into the menu and return // it as an autorelease item. QCocoaNSMenuItem *item; if (platformItem->isSeparator()) - item = [[QCocoaNSMenuItem separatorItemWithPlatformMenuItem:platformItem] retain]; + item = [QCocoaNSMenuItem separatorItemWithPlatformMenuItem:platformItem]; else - item = [[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem]; + item = [[[QCocoaNSMenuItem alloc] initWithPlatformMenuItem:platformItem] autorelease]; - const auto location = [appMenu indexOfItem:lastAppSpecificItem]; + const auto location = [self indexOfLastAppSpecificMenuItem]; + [appMenu insertItem:item atIndex:NSInteger(location) + 1]; - if (!lastAppSpecificItem.separatorItem) - [lastAppSpecificItem release]; - lastAppSpecificItem = item; // Keep track of this for later (i.e., don't release it) - - [appMenu insertItem:item atIndex:location + 1]; - - return [[item retain] autorelease]; + return item; } - (void)orderFrontStandardAboutPanel:(id)sender @@ -344,8 +334,24 @@ - (NSArray *)mergeable { // Don't include the quitItem here, since we want it always visible and enabled regardless - // Note that lastAppSpecificItem may be nil, so we can't use @[] here. - return [NSArray arrayWithObjects:preferencesItem, aboutItem, aboutQtItem, lastAppSpecificItem, nil]; + auto items = [NSArray arrayWithObjects:preferencesItem, aboutItem, aboutQtItem, + appMenu.itemArray[[self indexOfLastAppSpecificMenuItem]], nil]; + return items; } +- (NSUInteger)indexOfLastAppSpecificMenuItem +{ + // Either the 'Preferences', which is the first app specific menu item, or something + // else we appended later (thus the reverse order): + const auto location = [appMenu.itemArray indexOfObjectWithOptions:NSEnumerationReverse + passingTest:^BOOL(NSMenuItem *item, NSUInteger, BOOL *) { + if (auto qtItem = qt_objc_cast(item)) + return qtItem != quitItem; + return NO; + }]; + Q_ASSERT(location != NSNotFound); + return location; +} + + @end From c76b86aec64c4098434340ec17a26d7b2a32338e Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Sun, 4 Aug 2019 08:42:26 +0300 Subject: [PATCH 29/43] BLACKLIST contains_QPointF for msvc-2019 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-77312 Change-Id: I5197d160d9b3c70b538c2e5a43c31120e1bed5f0 Reviewed-by: Tony Sarajärvi --- tests/auto/gui/painting/qpainterpath/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/gui/painting/qpainterpath/BLACKLIST diff --git a/tests/auto/gui/painting/qpainterpath/BLACKLIST b/tests/auto/gui/painting/qpainterpath/BLACKLIST new file mode 100644 index 00000000000..b3e6d3bfe40 --- /dev/null +++ b/tests/auto/gui/painting/qpainterpath/BLACKLIST @@ -0,0 +1,2 @@ +[contains_QPointF] +msvc-2019 From 39e937a538325c4fc40a790496f2a39d28f8eba4 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 2 Aug 2019 09:24:37 +0200 Subject: [PATCH 30/43] Fix host architecture detection for canadian cross builds If the host architecture is different from -platform (canadian cross build with -external-hostbindir) then we cannot use QMAKE_HOST.os to deduce the executable extension for that platform, because this value comes from the qmake binary that was pointed to by -external-hostbindir. Move the target name deduction mechanism to the actual configure test .pro files to make sure the right scopes are available, and write the deduced target name to a text file. That text file is read by qtConfTest_architecture to get the right binary to analyze. Fixes: QTBUG-77286 Change-Id: I68b844dd51dbfda6432a4b0dca6331899c82255f Reviewed-by: Kai Koehne --- config.tests/arch/arch.pro | 1 + config.tests/arch/arch_host.pro | 1 + config.tests/arch/write_info.pri | 14 ++++++++++++++ configure.pri | 20 +------------------- 4 files changed, 17 insertions(+), 19 deletions(-) create mode 100644 config.tests/arch/write_info.pri diff --git a/config.tests/arch/arch.pro b/config.tests/arch/arch.pro index 45a7eb33af9..c607898b71e 100644 --- a/config.tests/arch/arch.pro +++ b/config.tests/arch/arch.pro @@ -1 +1,2 @@ SOURCES = arch.cpp +include(write_info.pri) diff --git a/config.tests/arch/arch_host.pro b/config.tests/arch/arch_host.pro index cefdbc77ef1..ea0d1fa5728 100644 --- a/config.tests/arch/arch_host.pro +++ b/config.tests/arch/arch_host.pro @@ -1,2 +1,3 @@ option(host_build) SOURCES = arch.cpp +include(write_info.pri) diff --git a/config.tests/arch/write_info.pri b/config.tests/arch/write_info.pri new file mode 100644 index 00000000000..3b55a63f49e --- /dev/null +++ b/config.tests/arch/write_info.pri @@ -0,0 +1,14 @@ +targetinfofile = $$basename(_PRO_FILE_) +targetinfofile ~= s/pro$/target.txt/ + +win32 { + ext = .exe +} else:android { + file_prefix = lib + ext = .so +} else:wasm { + ext = .wasm +} + +content = $${file_prefix}$${TARGET}$${ext} +write_file($$OUT_PWD/$$targetinfofile, content) diff --git a/configure.pri b/configure.pri index e9fd0558543..09c34af4ee2 100644 --- a/configure.pri +++ b/configure.pri @@ -266,28 +266,10 @@ defineTest(qtConfTest_architecture) { !qtConfTest_compile($${1}): \ error("Could not determine $$eval($${1}.label). See config.log for details.") - host = $$eval($${1}.host) - isEmpty(host): host = false - file_prefix = - ext = - $$host { - equals(QMAKE_HOST.os, Windows): \ - ext = .exe - } else { - win32 { - ext = .exe - } else:android { - file_prefix = lib - ext = .so - } else:wasm { - ext = .wasm - } - } - test = $$eval($${1}.test) output = $$eval($${1}.output) test_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)/$$test - test_out_file = $$test_out_dir/$$file_prefix$$output$$ext + test_out_file = $$test_out_dir/$$cat($$test_out_dir/$${output}.target.txt) exists($$test_out_file): \ content = $$cat($$test_out_file, blob) else: \ From 6ce9404a6e7ad6ba3ff37f6890fe400c643c3d52 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Aug 2019 22:56:30 -0700 Subject: [PATCH 31/43] QBitArray: fix fromBits() and actually test it When I initially added it, it was ony for QCborValue, but I never added the tests. Turns out there were two bugs: [ChangeLog][QtCore][QBitArray] Fixed two bugs that caused QBitArrays created using fromBits() not to compare equal to the equivalent QBitArray created using other methods if the size was zero or not a multiple of 4. If the size modulus 8 was 5, 6, or 7, the data was actually incorrect. Fixes: QTBUG-77285 Change-Id: Ife213d861bb14c1787e1fffd15b70573d162042c Reviewed-by: Lars Knoll --- src/corelib/tools/qbitarray.cpp | 12 ++-- .../corelib/tools/qbitarray/tst_qbitarray.cpp | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 4e8e3c241e4..94aadf7fdf6 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2019 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -132,12 +132,12 @@ QT_BEGIN_NAMESPACE * We overallocate the byte array by 1 byte. The first user bit is at * d.data()[1]. On the extra first byte, we store the difference between the * number of bits in the byte array (including this byte) and the number of - * bits in the bit array. Therefore, it's always a number between 8 and 15. + * bits in the bit array. Therefore, for a non-empty QBitArray, it's always a + * number between 8 and 15. For the empty one, d is the an empty QByteArray and + * *d.constData() is the QByteArray's terminating NUL (0) byte. * * This allows for fast calculation of the bit array size: * inline int size() const { return (d.size() << 3) - *d.constData(); } - * - * Note: for an array of zero size, *d.constData() is the QByteArray implicit NUL. */ /*! @@ -326,6 +326,8 @@ void QBitArray::fill(bool value, int begin, int end) QBitArray QBitArray::fromBits(const char *data, qsizetype size) { QBitArray result; + if (size == 0) + return result; qsizetype nbytes = (size + 7) / 8; result.d = QByteArray(nbytes + 1, Qt::Uninitialized); @@ -334,7 +336,7 @@ QBitArray QBitArray::fromBits(const char *data, qsizetype size) // clear any unused bits from the last byte if (size & 7) - bits[nbytes] &= 0xffU >> (size & 7); + bits[nbytes] &= 0xffU >> (8 - (size & 7)); *bits = result.d.size() * 8 - size; return result; diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index d19eac75304..9a7c099228c 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -84,6 +84,8 @@ private slots: void operator_noteq(); void resize(); + void fromBits_data(); + void fromBits(); }; void tst_QBitArray::size_data() @@ -610,5 +612,60 @@ void tst_QBitArray::resize() } +void tst_QBitArray::fromBits_data() +{ + QTest::addColumn("data"); + QTest::addColumn("size"); + QTest::addColumn("expected"); + + QTest::newRow("empty") << QByteArray() << 0 << QBitArray(); + + auto add = [](const QByteArray &tag, const char *data) { + QTest::newRow(tag) << QByteArray(data, (tag.size() + 7) / 8) << tag.size() + << QStringToQBitArray(tag); + }; + + // "0" to "0000000000000000" + for (int i = 1; i < 16; ++i) { + char zero[2] = { 0, 0 }; + QByteArray pattern(i, '0'); + add(pattern, zero); + } + + // "1" to "1111111111111111" + for (int i = 1; i < 16; ++i) { + char one[2] = { '\xff', '\xff' }; + QByteArray pattern(i, '1'); + add(pattern, one); + } + + // trailing 0 and 1 + char zero = 1; + char one = 0; + QByteArray pzero = "1"; + QByteArray pone = "0"; + for (int i = 2; i < 8; ++i) { + zero <<= 1; + pzero.prepend('0'); + add(pzero, &zero); + + one = (one << 1) | 1; + pone.prepend('1'); + add(pone, &one); + } +} + +void tst_QBitArray::fromBits() +{ + QFETCH(QByteArray, data); + QFETCH(int, size); + QFETCH(QBitArray, expected); + + QBitArray fromBits = QBitArray::fromBits(data, size); + QCOMPARE(fromBits, expected); + + QCOMPARE(QBitArray::fromBits(fromBits.bits(), fromBits.size()), expected); +} + QTEST_APPLESS_MAIN(tst_QBitArray) #include "tst_qbitarray.moc" From 48b3ec6e8e4be23e0d4620fb32b8c7faf082569d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 5 Aug 2019 21:29:02 -0700 Subject: [PATCH 32/43] QBitArray: change modulo 8 with bitwise-AND 7 They're the same only for unsigned values. Modulo of negative numbers since C++11 has an expected behavior and generates more code: %rax = %rax & 7: andl $7, %eax %rax = %rax % 8 with GCC: cqto shrq $61, %rdx addq %rdx, %rax andl $7, %eax subq %rdx, %rax [read as ((%rax + (%rax < 0 ? 7 : 0)) & 7) - (%rax < 0 ? 7 : 0))] With Clang: movq %rax, %rcx sarq $63, %rcx shrq $61, %rcx addq %rax, %rcx andq $-8, %rcx subq %rcx, %rax Change-Id: Ife213d861bb14c1787e1fffd15b83b004be7eba0 Reviewed-by: Lars Knoll --- src/corelib/tools/qbitarray.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 4e8e3c241e4..4952090620c 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -154,8 +154,8 @@ QBitArray::QBitArray(int size, bool value) uchar* c = reinterpret_cast(d.data()); memset(c + 1, value ? 0xff : 0, d.size() - 1); *c = d.size()*8 - size; - if (value && size && size % 8) - *(c+1+size/8) &= (1 << (size%8)) - 1; + if (value && size && size & 7) + *(c+1+size/8) &= (1 << (size & 7)) - 1; } /*! \fn int QBitArray::size() const @@ -227,8 +227,8 @@ void QBitArray::resize(int size) uchar* c = reinterpret_cast(d.data()); if (size > (s << 3)) memset(c + s, 0, d.size() - s); - else if ( size % 8) - *(c+1+size/8) &= (1 << (size%8)) - 1; + else if (size & 7) + *(c+1+size/8) &= (1 << (size & 7)) - 1; *c = d.size()*8 - size; } } From d502b19b283806d2ef5c6b7bfd79baef15f3845c Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 7 Aug 2019 08:21:35 +0800 Subject: [PATCH 33/43] Fix std detection for win32-clang-msvc clang-cl will never support C++ standards newer than C++14 without these flags. I didn't add them to msvc-based-version.conf because on Windows, only clang-cl use the same flags with MSVC, both ICC and MinGW have their own flags. So they are clang-cl specific flags. Change-Id: Ia44a5ea4237c77ea5e897fffded32cbc008a4729 Reviewed-by: Thiago Macieira --- mkspecs/win32-clang-msvc/qmake.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkspecs/win32-clang-msvc/qmake.conf b/mkspecs/win32-clang-msvc/qmake.conf index 9a7f70454d7..b60a4b8c8b1 100644 --- a/mkspecs/win32-clang-msvc/qmake.conf +++ b/mkspecs/win32-clang-msvc/qmake.conf @@ -39,6 +39,11 @@ QMAKE_CXXFLAGS += -Wno-microsoft-enum-value QMAKE_LINK = lld-link QMAKE_LIB = llvm-lib /NOLOGO +QMAKE_CXXFLAGS_CXX11 = -std:c++11 +QMAKE_CXXFLAGS_CXX14 = -std:c++14 +QMAKE_CXXFLAGS_CXX1Z = -std:c++17 +QMAKE_CXXFLAGS_CXX2A = -std:c++latest + QMAKE_CFLAGS_LTCG = -flto QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG # Leave QMAKE_LFLAGS_LTCG empty because lld-link doesn't need any additional parameters From aca43d29f8a1c90d14069ac602cf0ba7beaba300 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 6 Aug 2019 14:04:35 +0200 Subject: [PATCH 34/43] Fix sign change warning The conversion from int to uint is deliberate here, so let's cast and avoid a warning for users compiling with warnings enabled. Change-Id: I7136d6161ace735be49f8d987338f6d401a5c78a Fixes: QTBUG-77245 Reviewed-by: Thiago Macieira --- src/corelib/serialization/qjsonvalue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/serialization/qjsonvalue.h b/src/corelib/serialization/qjsonvalue.h index d8e121524d1..4df689078e5 100644 --- a/src/corelib/serialization/qjsonvalue.h +++ b/src/corelib/serialization/qjsonvalue.h @@ -173,9 +173,9 @@ class Q_CORE_EXPORT QJsonValueRef { public: QJsonValueRef(QJsonArray *array, int idx) - : a(array), is_object(false), index(idx) {} + : a(array), is_object(false), index(static_cast(idx)) {} QJsonValueRef(QJsonObject *object, int idx) - : o(object), is_object(true), index(idx) {} + : o(object), is_object(true), index(static_cast(idx)) {} inline operator QJsonValue() const { return toValue(); } QJsonValueRef &operator = (const QJsonValue &val); From a08ac1986d39b4d4614f654b3408c7b846c835c9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 8 Aug 2019 19:12:32 -0700 Subject: [PATCH 35/43] Fix integer overflow in QCryptographicHash's SHA-3 support Because 256 MB * 8 = 2 Gbit, but length*8 is a signed integer overflow, hence UB. Can't really autotest this. Not all systems where we're going to test can allocate 256 MB of RAM. [ChangeLog][QtCore][QCryptographicHash] Fixed a bug that caused the SHA-3 and Keccak algorithms to crash if passed 256 MB of data or more. Fixes: QTBUG-77362 Change-Id: Iec9c051acd73484c8d94fffd15b91f4b1450f5d7 Reviewed-by: Marc Mutz --- src/corelib/tools/qcryptographichash.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index 3c79bb797d2..51f48503fbc 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -387,19 +387,19 @@ void QCryptographicHash::addData(const char *data, int length) break; case RealSha3_224: case Keccak_224: - sha3Update(&d->sha3Context, reinterpret_cast(data), length*8); + sha3Update(&d->sha3Context, reinterpret_cast(data), quint64(length) * 8); break; case RealSha3_256: case Keccak_256: - sha3Update(&d->sha3Context, reinterpret_cast(data), length*8); + sha3Update(&d->sha3Context, reinterpret_cast(data), quint64(length) * 8); break; case RealSha3_384: case Keccak_384: - sha3Update(&d->sha3Context, reinterpret_cast(data), length*8); + sha3Update(&d->sha3Context, reinterpret_cast(data), quint64(length) * 8); break; case RealSha3_512: case Keccak_512: - sha3Update(&d->sha3Context, reinterpret_cast(data), length*8); + sha3Update(&d->sha3Context, reinterpret_cast(data), quint64(length) * 8); break; #endif } From ffc2d5722317fcab86865b11491d7bf7fef3e16d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 8 Aug 2019 19:13:55 -0700 Subject: [PATCH 36/43] QList: fix some integer cast warnings from 64- to 32-bit Not tested because we're not promising to fix them all. Just those two that were reported. Fixes: QTBUG-77391 Change-Id: Iec9c051acd73484c8d94fffd15b91f5e6348635d Reviewed-by: Marc Mutz --- src/corelib/tools/qlist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index e593ba9aa33..74b57f7ad48 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -111,7 +111,7 @@ struct Q_CORE_EXPORT QListData { void remove(int i); void remove(int i, int n); void move(int from, int to); - inline int size() const Q_DECL_NOTHROW { return d->end - d->begin; } + inline int size() const Q_DECL_NOTHROW { return int(d->end - d->begin); } // q6sizetype inline bool isEmpty() const Q_DECL_NOTHROW { return d->end == d->begin; } inline void **at(int i) const Q_DECL_NOTHROW { return d->array + d->begin + i; } inline void **begin() const Q_DECL_NOTHROW { return d->array + d->begin; } @@ -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 n - b; + return typename QList::difference_type(n - b); } } return -1; From 5d7f1133205d14002463456c26a97f8ba17d69b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 7 Aug 2019 13:15:51 +0200 Subject: [PATCH 37/43] Add nullptr guard to QHighDScaling::scaleAndOrigin(QPlatformScreen *) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit b6ded193 added an unconditional dereference of the platformScreen pointer, for calls where nativePostion is non-nullptr. Change-Id: I4a6fbbd0337f91d4fcb76c17b4dc60e1b9ad10ed Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qhighdpiscaling.cpp | 2 ++ .../qhighdpiscaling/tst_qhighdpiscaling.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 0fea4164041..64f13977717 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -456,6 +456,8 @@ QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformS { if (!m_active) return { qreal(1), QPoint() }; + if (!platformScreen) + return { m_factor, QPoint() }; // the global factor const QPlatformScreen *actualScreen = nativePosition ? platformScreen->screenForPosition(*nativePosition) : platformScreen; return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() }; diff --git a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp index 969b2351ec4..ec80c2d02c3 100644 --- a/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp +++ b/tests/auto/gui/kernel/qhighdpiscaling/tst_qhighdpiscaling.cpp @@ -36,6 +36,7 @@ class tst_QHighDpiScaling: public QObject Q_OBJECT private slots: + void factor(); void scale(); }; @@ -50,6 +51,23 @@ public: QImage::Format format() const override { return QImage::Format_ARGB32_Premultiplied; } }; +void tst_QHighDpiScaling::factor() +{ + QHighDpiScaling::setGlobalFactor(2); + + // Verfy that QHighDpiScaling::factor() does not crash on nullptr contexts. + QPoint fakeNativePosition = QPoint(5, 5); + QPlatformScreen *screenContext = nullptr; + QVERIFY(QHighDpiScaling::factor(screenContext) >= 0); + QVERIFY(QHighDpiScaling::factor(screenContext, &fakeNativePosition) >= 0); + QPlatformScreen *platformScreenContext = nullptr; + QVERIFY(QHighDpiScaling::factor(platformScreenContext) >= 0); + QVERIFY(QHighDpiScaling::factor(platformScreenContext, &fakeNativePosition) >= 0); + QWindow *windowContext = nullptr; + QVERIFY(QHighDpiScaling::factor(windowContext) >= 0); + QVERIFY(QHighDpiScaling::factor(windowContext, &fakeNativePosition) >= 0); +} + // QTBUG-77255: Test some scaling overloads void tst_QHighDpiScaling::scale() { From 3729695cc9d550e831567772441ad55bd767ab1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 9 Aug 2019 12:25:05 +0200 Subject: [PATCH 38/43] =?UTF-8?q?macOS:=20Don=E2=80=99t=20show=20hidden=20?= =?UTF-8?q?windows=20while=20z-ordering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling [NSWindow orderBack] will make the window visible again, and will e.g. bring back closed menus on application modality changes. Fixes: QTBUG-77281 Change-Id: I2f89b852ea9f8ab34c709cec96d93fe305984fb9 Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoawindowmanager.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindowmanager.mm b/src/plugins/platforms/cocoa/qcocoawindowmanager.mm index 879bfaa546e..9c45d8c7fc0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowmanager.mm +++ b/src/plugins/platforms/cocoa/qcocoawindowmanager.mm @@ -92,7 +92,8 @@ void QCocoaWindowManager::modalSessionChanged() if (NSApp.modalWindow) { // Lower window to that of the modal windows, but no less nativeWindow.level = NSModalPanelWindowLevel; - [nativeWindow orderBack:nil]; + if ([nativeWindow isVisible]) + [nativeWindow orderBack:nil]; } else { // Restore window's natural window level, whatever that was nativeWindow.level = naturalWindowLevel; From 9bcbba36c73b8d03e8e58898629259489a24e040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 12 Jun 2019 15:29:31 +0200 Subject: [PATCH 39/43] QWizard: Account for missing background image on macOS 10.14+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were loading “Background.png” from the KeyboardSetupAssistant app bundle. As of macOS 10.14 that image is no longer there. Adjust auto tests and document the behavior. Change-Id: Icb4dd73b3fa88927e87bb86db2bc9f7b4a8094f7 Reviewed-by: Tor Arne Vestbø --- .../platforms/cocoa/qcocoanativeinterface.mm | 3 +++ src/widgets/dialogs/qwizard.cpp | 2 +- .../widgets/dialogs/qwizard/tst_qwizard.cpp | 19 +++++++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 7979e430ac2..9bd19dd07c4 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -177,6 +177,9 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard() { + // Note: starting with macOS 10.14, the KeyboardSetupAssistant app bundle no + // longer contains the "Background.png" image. This function then returns a + // null pixmap. const int ExpectedImageWidth = 242; const int ExpectedImageHeight = 414; QCFType urls = LSCopyApplicationURLsForBundleIdentifier( diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 21e1ff27784..f19a4e99afd 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -2890,7 +2890,7 @@ void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap) Returns the pixmap set for role \a which. By default, the only pixmap that is set is the BackgroundPixmap on - \macos. + \macos version 10.13 and earlier. \sa QWizardPage::pixmap(), {Elements of a Wizard Page} */ diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 63f6e67a3e7..da75e64d1e9 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -417,20 +417,19 @@ void tst_QWizard::setPixmap() QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull()); -#ifdef Q_OS_OSX - QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); -#else - QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull()); -#endif + if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13)) + QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); + else + QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull()); QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull()); QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull()); QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull()); -#ifdef Q_OS_OSX - QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); -#else - QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull()); -#endif + if (QSysInfo::macVersion() <= Q_MV_OSX(10, 13)) + QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull()); + else + QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull()); + wizard.setPixmap(QWizard::BannerPixmap, p1); wizard.setPixmap(QWizard::LogoPixmap, p2); wizard.setPixmap(QWizard::WatermarkPixmap, p3); From fcc5323a08f955bcedd8a8a9750173384fa7d71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 7 Jun 2019 16:04:23 +0200 Subject: [PATCH 40/43] Make test less dependent on moving the cursor The sendMouseMove() function calls QTest::mouseMove(), which again calls QCursor::setPos() to move the cursor. It then creates and sends a MouseMove event, using the constructor which picks up the global position by calling QCursor::pos(). On macOS 10.14, QCursor::setPos() may silently fail if the user does not grant the application permission to move the cursor (via a dialog). As result of this the mouse move event gets an incorrect global position. Provide the global position directly when creating the event to make sure it gets the correct value. Task-number: QTBUG-75786 Change-Id: I3e8df450fea802783a3d1dbe471753f502b42de3 Reviewed-by: Richard Moe Gustavsen --- .../widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 28df3a3c38c..1456b9e35c6 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -88,7 +88,7 @@ static void sendMousePress(QWidget *widget, const QPoint &point, Qt::MouseButton static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0) { QTest::mouseMove(widget, point); - QMouseEvent event(QEvent::MouseMove, point, button, buttons, 0); + QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, 0); QApplication::sendEvent(widget, &event); QApplication::processEvents(); } From 08f0db4a72aef570f7fb1ce51ad892740455b67f Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Thu, 8 Aug 2019 08:13:04 +0200 Subject: [PATCH 41/43] doc: Fix QImage Format_RGBX64 documentation The current explanation refers to itself rather than Format_RGBA64. This patch fixes that. Change-Id: Idc4c44ca71813ea2bdddba0c936f772cb7091ca8 Reviewed-by: Paul Wicking Reviewed-by: Sze Howe Koh --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index ebd9037e449..f23debd9313 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -713,7 +713,7 @@ bool QImageData::checkForAlphaPixels() const \value Format_Grayscale8 The image is stored using an 8-bit grayscale format. (added in Qt 5.5) \value Format_Grayscale16 The image is stored using an 16-bit grayscale format. (added in Qt 5.13) \value Format_RGBX64 The image is stored using a 64-bit halfword-ordered RGB(x) format (16-16-16-16). - This is the same as the Format_RGBX64 except alpha must always be 65535. (added in Qt 5.12) + This is the same as the Format_RGBA64 except alpha must always be 65535. (added in Qt 5.12) \value Format_RGBA64 The image is stored using a 64-bit halfword-ordered RGBA format (16-16-16-16). (added in Qt 5.12) \value Format_RGBA64_Premultiplied The image is stored using a premultiplied 64-bit halfword-ordered RGBA format (16-16-16-16). (added in Qt 5.12) From e66f247ccf345f1d303a92e53c21bb53d96c5af2 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 9 Aug 2019 15:54:00 +0200 Subject: [PATCH 42/43] Doc: Extend QMake's documentation of RC_FILE and RES_FILE RC_FILE is not an internal variable that "rarely needs to be modified". Mention that it's about Windows resources and link to the corresponding section. RES_FILE: Add link to RC_FILE and the more general section. Also rephrase "compiled Windows resource file" to "Windows resource compiler's output file" which is more precise. Fixes: QTBUG-8709 Change-Id: I19c61e6a9505d45fc13fefbcd0ba9441191aa42e Reviewed-by: Kai Koehne Reviewed-by: Kavindra Palaraja --- qmake/doc/src/qmake-manual.qdoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index d3148a1e623..2e2962f86c4 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2541,10 +2541,8 @@ \section1 RC_FILE - Specifies the name of the resource file for the application. - The value of this variable is typically handled by - qmake or \l{#QMAKESPEC}{qmake.conf} and rarely - needs to be modified. + Windows only. Specifies the name of the Windows resource file (.rc) for the + target. See \l{Adding Windows Resource Files}. \target RC_CODEPAGE \section1 RC_CODEPAGE @@ -2607,7 +2605,9 @@ \section1 RES_FILE - Specifies the name of the compiled Windows resource file for the target. + Windows only. Specifies the name of the Windows resource compiler's output + file for this target. See \l{RC_FILE} and \l{Adding Windows Resource Files}. + The value of this variable is typically handled by qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. From fb703aea697b12de4810deec9f8605fd062208bd Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 23 Jul 2019 14:47:07 +0200 Subject: [PATCH 43/43] Docs: Fix the snippet lookup for QFileDialog::getOpenFileContent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src_gui_dialogs_qfiledialog.cpp had two snippets labeled "14". This change bumps one of them to "15" and fixes the the snippet lookup for QFileDialog::getOpenFileContent accordingly. Also, fix two typos: "QSting" -> "QString" and "contents has" -> "contents have". Change-Id: Ic018c23b6ca585f30c116b8a6eb29293560c7a35 Reviewed-by: Morten Johan Sørvig --- src/widgets/dialogs/qfiledialog.cpp | 4 ++-- .../doc/snippets/code/src_gui_dialogs_qfiledialog.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index f772eb1241b..2c2d2092261 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2376,10 +2376,10 @@ QList QFileDialog::getOpenFileUrls(QWidget *parent, It can also be used on other platforms, where it will fall back to using QFileDialog. The function is asynchronous and returns immediately. The \a fileOpenCompleted - callback will be called when a file has been selected and its contents has been + callback will be called when a file has been selected and its contents have been read into memory. - \snippet code/src_gui_dialogs_qfiledialog.cpp 14 + \snippet code/src_gui_dialogs_qfiledialog.cpp 15 \since 5.13 */ void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::function &fileOpenCompleted) diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp index 1e9daf824b3..39aca459dbb 100644 --- a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp +++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp @@ -145,8 +145,8 @@ dialog.exec(); "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)" //! [14] -//! [14] -auto fileOpenCompleted = [](const QSting &fileName, const QByteArray &fileContent) { +//! [15] +auto fileOpenCompleted = [](const QString &fileName, const QByteArray &fileContent) { if (fileName.isEmpty()) { // No file was selected } else { @@ -154,4 +154,4 @@ auto fileOpenCompleted = [](const QSting &fileName, const QByteArray &fileConten } } QFileDialog::getOpenFileContent("Images (*.png *.xpm *.jpg)", fileContentReady); -//! [14] +//! [15]