From 4f3b5fab382a14d93a5712252312c56715b9aad3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Jul 2016 15:09:53 +0200 Subject: [PATCH 01/16] QWidgetPrivate::setWindowFlags(): Fix checking for changes in Qt::Window Store the result of the comparison before the calling QWidget::setParent() passing the flags which can modify q->data->window_flags. Previously, this led to the condition triggering when a child window was becoming top level, causing the geometry to be changed (notably for fullscreen windows on Windows, where fullscreen is merely emulated). Amends change 5e99b07a072bedee239ed6980a44719da9ffa7c9. Task-number: QTBUG-54906 Change-Id: I9369d7d9f886451cfdb933746a4572593ffa074a Reviewed-by: Andy Shaw --- src/widgets/kernel/qwidget.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6729969024..b1d80d7b8f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -10340,14 +10340,13 @@ void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags) // the old type was a window and/or the new type is a window QPoint oldPos = q->pos(); bool visible = q->isVisible(); + const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window; q->setParent(q->parentWidget(), flags); // if both types are windows or neither of them are, we restore // the old position - if (!((q->data->window_flags ^ flags) & Qt::Window) - && (visible || q->testAttribute(Qt::WA_Moved))) { + if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved))) q->move(oldPos); - } // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. adjustQuitOnCloseAttribute(); } else { From e41263b61af6bcd16ead9ba50466958a813879ac Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 24 Aug 2016 12:35:50 +0200 Subject: [PATCH 02/16] fix build with qt-xcb and another installed qt in a system location amends fc1092cf, necessary because of (the earlier) a28364bc1. Change-Id: I5c86bcb27854994e59228fd205c799396464554d Reviewed-by: Jake Petroules --- .../xcb/gl_integrations/gl_integrations_plugin_base.pri | 2 ++ src/plugins/platforms/xcb/xcb_qpa_lib.pro | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index c2d3849d8e..68cb91ff3d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -3,6 +3,8 @@ QT += core-private gui-private platformsupport-private xcb_qpa_lib-private INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/../ +load(qt_build_paths) + # needed by Xcursor ... contains(QT_CONFIG, xcb-xlib) { DEFINES += XCB_USE_XLIB diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index db9ea32cd8..9ca8872cb2 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -38,6 +38,8 @@ HEADERS = \ qxcbxsettings.h \ qxcbsystemtraytracker.h +load(qt_build_paths) + DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... contains(QT_CONFIG, xcb-xlib) { From ddb2fd3f5e5f05f851bf6082c9a245cc1f494e04 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 9 Nov 2015 16:46:27 +0100 Subject: [PATCH 03/16] Fix the mysql configure test on RHEL 6.6 On RHEL 6.6, mysql_config --libs returns "-rdynamic" among other arguments. The configure test (config.tests/unix/mysql) would end up passing that to qmake. qmake responds with "***Unknown option -rdynamic ..." Change-Id: Ib1300e62aec8a5d866359f3eaea88d9648c872b9 Reviewed-by: Frederik Gladhorn (cherry picked from commit d7e27e4d26b5359a60ab5acd89ffcc6b42e974b0) Reviewed-by: Oswald Buddenhagen Reviewed-by: Mike Krus --- configure | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index e590da9514..b30e85bd99 100755 --- a/configure +++ b/configure @@ -4781,8 +4781,9 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do [ -z "$CFG_MYSQL_CONFIG" ] && CFG_MYSQL_CONFIG=`"$WHICH" mysql_config` if [ -x "$CFG_MYSQL_CONFIG" ]; then QT_CFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --include 2>/dev/null | filterIncludeOptions` - QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null | filterLibraryOptions` - QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null | filterLibraryOptions` + # -rdynamic should not be returned by mysql_config, but is on RHEL 6.6 + QT_LFLAGS_MYSQL_R=`$CFG_MYSQL_CONFIG --libs_r 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"` + QT_LFLAGS_MYSQL=`$CFG_MYSQL_CONFIG --libs 2>/dev/null | filterLibraryOptions | sed "s/-rdynamic//"` QT_MYSQL_VERSION=`$CFG_MYSQL_CONFIG --version 2>/dev/null` QT_MYSQL_VERSION_MAJOR=`echo $QT_MYSQL_VERSION | cut -d . -f 1` fi From 1f7f73b86a2cb98eb60e2ac6c0ecefa3a98e8753 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 17 Jul 2015 14:41:48 -0700 Subject: [PATCH 04/16] compile.test: append any unknown arguments to the qmake command-line This allows setting of variables, like FOO=bar. Yes, it's intentional that there are no quotes. Change-Id: Ib306f8f647014b399b87ffff13f1d9e6a10fa2f8 (cherry picked from commit e79200bf7f8dbd4f8aa03c8be07a6dfc4328fa50) Reviewed-by: Oswald Buddenhagen Reviewed-by: Mike Krus --- config.tests/unix/compile.test | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 69d4285321..bc5258cf4b 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -17,6 +17,7 @@ CFLAGS="$SYSROOT_FLAG" CXXFLAGS="$SYSROOT_FLAG" MAC_ARCH_CXXFLAGS="" MAC_ARCH_LFLAGS="" +QMAKE_ARGS= while [ "$#" -gt 0 ]; do PARAM=$1 case $PARAM in @@ -56,7 +57,9 @@ while [ "$#" -gt 0 ]; do CXXFLAGS="$CXXFLAGS $PARAM \"$2\"" shift ;; - *) ;; + *) + QMAKE_ARGS="$QMAKE_ARGS $PARAM" + ;; esac shift done @@ -83,6 +86,7 @@ set -- \ "QMAKE_CFLAGS+=$MAC_ARCH_CFLAGS" \ "QMAKE_CXXFLAGS*=$CXXFLAGS" \ "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" \ + $QMAKE_ARGS \ "$SRCDIR/$TEST/$EXE.pro" \ -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then From 882f344964aae5ac4c03f18209ea6256be5ee0ed Mon Sep 17 00:00:00 2001 From: Mike Krus Date: Thu, 28 Jul 2016 12:12:46 +0100 Subject: [PATCH 05/16] Pass no-pkg-config to qmake from config.test if appropriate On macOS, even if pkg-config is present in the path, configure will by default correctly ignore it and set no-pkg-config. However, this was not propagated to qmake when invoked from config.test, so tests which rely on that did not work. This was leading to pkg-config (installed from homebrew) to be used in the libpng test, so it succeeded. But the later Qt build would fail to find png.h from homebrew, as it correctly ignores pkg-config. Task-number: QTBUG-55011 Change-Id: Ic6fb866bea0551f528da56cb545174dcd9bacf0d Reviewed-by: Oswald Buddenhagen Reviewed-by: Liang Qi Reviewed-by: Mike Krus --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index b30e85bd99..0b8b417bbc 100755 --- a/configure +++ b/configure @@ -4293,8 +4293,12 @@ compileTest() if [ "$CFG_SHARED" = "no" ]; then test_config="$QMAKE_CONFIG static" fi + TEST_CONFIG_FLAGS= + if [ -z "$PKG_CONFIG" ]; then + TEST_CONFIG_FLAGS="QT_CONFIG+=no-pkg-config" + fi echo $ECHO_N "checking for $name... $ECHO_C" - "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" + "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS $TEST_CONFIG_FLAGS "$@" } compileTestWithPkgConfig() From 68c2bf1a1ab9a9764658860827ffa4b5eacd0833 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 24 Aug 2016 15:19:43 +0200 Subject: [PATCH 06/16] Correct use of qt_div_255 qt_div_255 does a fast rounded division, the form of rounding is however only valid for positive integers. Correct one case where it was used incorrectly and add it one place it would be valid, and adds a comment to the function. We were using the optimization (x*a + y*(255-a))/255 == (x-y)*a/255 + y but that makes the division by 255 potentially negative. Change-Id: Ie53aa82b66ef801f5d43f8d2ec48880cb4972f69 Reviewed-by: Marc Mutz --- src/gui/painting/qdrawhelper.cpp | 12 ++++++------ src/gui/painting/qdrawhelper_p.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index a0f7155c67..ac22c7fc00 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5754,9 +5754,9 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int dg = gamma[dg]; db = gamma[db]; - int nr = qt_div_255((sr - dr) * mr) + dr; - int ng = qt_div_255((sg - dg) * mg) + dg; - int nb = qt_div_255((sb - db) * mb) + db; + int nr = qt_div_255(sr * mr + dr * (255 - mr)); + int ng = qt_div_255(sg * mg + dg * (255 - mg)); + int nb = qt_div_255(sb * mb + db * (255 - mb)); nr = invgamma[nr]; ng = invgamma[ng]; @@ -5781,9 +5781,9 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in int alpha = coverage; int ialpha = 255 - alpha; - int nr = (sr * alpha + ialpha * dr) / 255; - int ng = (sg * alpha + ialpha * dg) / 255; - int nb = (sb * alpha + ialpha * db) / 255; + int nr = qt_div_255(sr * alpha + dr * ialpha); + int ng = qt_div_255(sg * alpha + dg * ialpha); + int nb = qt_div_255(sb * alpha + db * ialpha); nr = invgamma[nr]; ng = invgamma[ng]; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index ff98d186c5..d636eabe3f 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -705,6 +705,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) { return t; } +// qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; } From f063cb7f81e11b35f4574807659cdf23c101761e Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Mon, 22 Aug 2016 19:39:17 +0300 Subject: [PATCH 07/16] QAbstractSocket: replace a reference to outdated state in documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4acaed88a46acae1ad117b0a95141b20d8744e12 Reviewed-by: Oswald Buddenhagen Reviewed-by: Topi Reiniö --- src/network/socket/qabstractsocket.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 9c1e7a6a49..3d665270fd 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -103,12 +103,12 @@ To close the socket, call disconnectFromHost(). QAbstractSocket enters QAbstractSocket::ClosingState. After all pending data has been written to the socket, QAbstractSocket actually closes the socket, enters - QAbstractSocket::ClosedState, and emits disconnected(). If you want to - abort a connection immediately, discarding all pending data, call abort() - instead. If the remote host closes the connection, QAbstractSocket will - emit error(QAbstractSocket::RemoteHostClosedError), during which the socket - state will still be ConnectedState, and then the disconnected() signal - will be emitted. + QAbstractSocket::UnconnectedState, and emits disconnected(). If you want + to abort a connection immediately, discarding all pending data, call + abort() instead. If the remote host closes the connection, + QAbstractSocket will emit error(QAbstractSocket::RemoteHostClosedError), + during which the socket state will still be ConnectedState, and then the + disconnected() signal will be emitted. The port and address of the connected peer is fetched by calling peerPort() and peerAddress(). peerName() returns the host name of From 3525ede0a5a17ca01b9b92d72df0a1a6b7e77e5d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 25 Aug 2016 15:17:47 +0200 Subject: [PATCH 08/16] QOffscreenSurface: warning-fix - QString(char*) deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Passing a string literal to QWindow::setObjectName() is rude: it wants a QString. Change-Id: Ic4c1079889002f0d5f1028c443456a8be0b7b0fe Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qoffscreensurface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index 18bfaea2a0..056cc19f69 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -177,7 +177,7 @@ void QOffscreenSurface::create() if (QThread::currentThread() != qGuiApp->thread()) qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures."); d->offscreenWindow = new QWindow(d->screen); - d->offscreenWindow->setObjectName("QOffscreenSurface"); + d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface")); // Remove this window from the global list since we do not want it to be destroyed when closing the app. // The QOffscreenSurface has to be usable even after exiting the event loop. QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow); From f4b2115b511ef95f921460d70957788ab496b70b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Mon, 22 Aug 2016 16:06:02 +0200 Subject: [PATCH 09/16] winrt: Add support for version requirements for MSVC2015 Previously we hardcoded the minimum windows version to the initial Windows 10 release. However features have been added which require a higher SDK version (eg drag and drop). Deploying such a package might fail during distribution to consumer devices. Hence introduce WINRT_MANIFEST.minVersion and WINRT_MANIFEST.maxVersionTested as variables for the manifest file. If nothing is specified, both values will be set to the UCRTVersion environment variable, implying the development setup from which qmake has been invoked. Change-Id: I1dcf1e75c67c4ab2fd5a3fdcc32c8783a336e6ff Reviewed-by: Oliver Wolff Reviewed-by: Oswald Buddenhagen --- .../winrt_winphone/manifests/10.0/AppxManifest.xml.in | 4 +++- mkspecs/features/winrt/package_manifest.prf | 7 +++++++ qmake/doc/src/qmake-manual.qdoc | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in b/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in index fc6bfcebcf..9c25feb43f 100644 --- a/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in +++ b/mkspecs/common/winrt_winphone/manifests/10.0/AppxManifest.xml.in @@ -22,7 +22,9 @@ - $${WINRT_MANIFEST.dependencies} + $${WINRT_MANIFEST.dependencies} diff --git a/mkspecs/features/winrt/package_manifest.prf b/mkspecs/features/winrt/package_manifest.prf index 291ebec6e9..e17bda3c8e 100644 --- a/mkspecs/features/winrt/package_manifest.prf +++ b/mkspecs/features/winrt/package_manifest.prf @@ -31,6 +31,8 @@ # WINRT_MANIFEST.capabilities: Specifies capabilities to add to the capability list. # WINRT_MANIFEST.capabilities_device: Specifies device capabilities to add to the capability list. (location, webcam...) # WINRT_MANIFEST.dependencies: Specifies dependencies required by the package. +# WINRT_MANIFEST.minVersion: Specifies the minimum required Windows version to run the package. Defaults to %UCRTVersion% +# WINRT_MANIFEST.maxVersionTested: Specifies the maximum Windows version the package has been tested against. Defaults to WINRT_MANIFEST.minVersion # The manifest is generated for each build pass for normal apps, and only once for vcapps. # - Normal apps have their package root directory in the same place as the target (one for each build pass). @@ -91,6 +93,11 @@ isEmpty(WINRT_MANIFEST.background): WINRT_MANIFEST.background = green isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en + *-msvc2015 { + isEmpty(WINRT_MANIFEST.minVersion): WINRT_MANIFEST.minVersion = $$(UCRTVersion) + isEmpty(WINRT_MANIFEST.minVersion): error("No UCRTVersion found in environment.")) + isEmpty(WINRT_MANIFEST.maxVersionTested): WINRT_MANIFEST.maxVersionTested = $$WINRT_MANIFEST.minVersion + } INDENT = "$$escape_expand(\\r\\n) " diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index ea400c5faf..7386af881e 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2693,6 +2693,13 @@ \row \li version \li The version number of the package. Defaults to \c{1.0.0.0}. + \row + \li minVersion + \li The minimum required Windows version to run the package. Defaults to the environment variable \c UCRTVersion. + \row + \li maxVersionTested + \li The maximum Windows version the package has been tested against. Defaults to \c WINRT_MANIFEST.minVersion + \endtable You can use any combination of those values. From 5f895fe0e212428bae76c65f3b6eaa8a036c7672 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 25 Aug 2016 09:59:06 +0200 Subject: [PATCH 10/16] winrt: Check validity of options shared pointer QErrorMessage autotests managed to create a scenario where the options are not initialized yet, causing a crash later on. Change-Id: Iabad6f181f2bfdc81a9c73f0e67c8ba70753fec6 Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp index bad15126d4..42fe030b23 100644 --- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp +++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp @@ -108,6 +108,9 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa Q_D(QWinRTMessageDialogHelper); QSharedPointer options = this->options(); + if (!options.data()) + return false; + const QString informativeText = options->informativeText(); const QString title = options->windowTitle(); const QString text = informativeText.isEmpty() ? options->text() : (options->text() + QLatin1Char('\n') + informativeText); From ea4aa5b7225c4fcd2f9d556d3bfda61d92d6b0a1 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 25 Aug 2016 15:03:41 +0200 Subject: [PATCH 11/16] winrt: store mimedata in clipboard In addition to setting the clipboard, we also need to store the mimedata being passed. Otherwise requesting the mimedata returns a different object, causing comparisons to fail. Change-Id: I2ffea76e78be091cb98426e387619ac6788ea270 Reviewed-by: Oliver Wolff --- .../platforms/winrt/qwinrtclipboard.cpp | 18 ++++++++++++++++-- src/plugins/platforms/winrt/qwinrtclipboard.h | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp index c385018239..1fb90a8fb7 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp +++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp @@ -56,6 +56,7 @@ typedef IEventHandler ContentChangedHandler; QT_BEGIN_NAMESPACE QWinRTClipboard::QWinRTClipboard() + : m_mimeData(Q_NULLPTR) { #ifndef Q_OS_WINPHONE QEventDispatcherWinRT::runOnXamlThread([this]() { @@ -100,9 +101,16 @@ QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode) const wchar_t *textStr = result.GetRawBuffer(&size); QString text = QString::fromWCharArray(textStr, size); text.replace(QStringLiteral("\r\n"), QStringLiteral("\n")); - m_mimeData.setText(text); - return &m_mimeData; + if (m_mimeData) { + if (m_mimeData->text() == text) + return m_mimeData; + delete m_mimeData; + } + m_mimeData = new QMimeData(); + m_mimeData->setText(text); + + return m_mimeData; #else // Q_OS_WINPHONE return QPlatformClipboard::mimeData(mode); #endif // Q_OS_WINPHONE @@ -143,6 +151,12 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) return; #ifndef Q_OS_WINPHONE + const bool newData = !m_mimeData || m_mimeData != data; + if (newData) { + if (m_mimeData) + delete m_mimeData; + m_mimeData = data; + } const QString text = data ? data->text() : QString(); HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, text]() { HRESULT hr; diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.h b/src/plugins/platforms/winrt/qwinrtclipboard.h index 1fb10bdfc0..fc3d50ce59 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.h +++ b/src/plugins/platforms/winrt/qwinrtclipboard.h @@ -70,7 +70,7 @@ private: #ifndef Q_OS_WINPHONE Microsoft::WRL::ComPtr m_nativeClipBoard; #endif - QMimeData m_mimeData; + QMimeData *m_mimeData; }; QT_END_NAMESPACE From c0a513d55fff9c3bfe4159bb4800a5050f766957 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 25 Aug 2016 15:05:56 +0200 Subject: [PATCH 12/16] winrt: avoid duplicate signal emit emitChanged() will be invoked when the system notifies the application about a clipboard change. Hence, there is no need to call it previously and cause two signals on the same change to be emitted. Change-Id: I99605c9a71054e0610006dbeaaa90c5fb2f46755 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtclipboard.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp index 1fb90a8fb7..14443f380c 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp +++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp @@ -175,7 +175,6 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) return S_OK; }); RETURN_VOID_IF_FAILED("Could not set clipboard text."); - emitChanged(mode); #else // Q_OS_WINPHONE QPlatformClipboard::setMimeData(data, mode); #endif // Q_OS_WINPHONE From 1e85ca2e62e9aba553a53effabf52272aa3acb70 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Aug 2016 13:04:46 +0200 Subject: [PATCH 13/16] QAbstractSpinBox: Clear 'cleared' flag on receiving a keypress Prevent QAbstractSpinBoxPrivate::interpret() from bailing out in focus changes after text has been entered. Task-number: QTBUG-55249 Change-Id: I250b3c50f7db5de2e9356038df20f18ee059df11 Reviewed-by: Maurice Kalinowski --- src/widgets/widgets/qabstractspinbox.cpp | 2 ++ .../widgets/widgets/qspinbox/tst_qspinbox.cpp | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 854befd265..881db81ad4 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1083,6 +1083,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } d->edit->event(event); + if (!d->edit->text().isEmpty()) + d->cleared = false; if (!isVisible()) d->ignoreUpdateEdit = true; } diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 34b05c5291..6d011eed59 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -143,6 +143,8 @@ private slots: void positiveSign(); + void interpretOnLosingFocus(); + void setGroupSeparatorShown_data(); void setGroupSeparatorShown(); @@ -1150,6 +1152,33 @@ void tst_QSpinBox::positiveSign() QCOMPARE(spinBox.text(), QLatin1String("+20")); } +void tst_QSpinBox::interpretOnLosingFocus() +{ + // QTBUG-55249: When typing an invalid value after QSpinBox::clear(), + // it should be fixed up on losing focus. + + static const int minimumValue = 10; + static const int maximumValue = 20; + + QWidget widget; + widget.setWindowTitle(QTest::currentTestFunction()); + QVBoxLayout *layout = new QVBoxLayout(&widget); + QLineEdit *focusDummy = new QLineEdit("focusDummy", &widget); + layout->addWidget(focusDummy); + SpinBox *spinBox = new SpinBox(&widget); + spinBox->setRange(minimumValue, maximumValue); + spinBox->setValue(minimumValue); + layout->addWidget(spinBox); + spinBox->clear(); + spinBox->setFocus(); + widget.show(); + QVERIFY(QTest::qWaitForWindowActive(&widget)); + QTest::keyClick(spinBox, Qt::Key_1); // Too small + focusDummy->setFocus(); + QCOMPARE(spinBox->value(), minimumValue); + QCOMPARE(spinBox->lineEdit()->text().toInt(), minimumValue); +} + void tst_QSpinBox::setGroupSeparatorShown_data() { QTest::addColumn("lang"); From d7d8cde4bbdc47c9ddf73eecf4ddadc1e8515703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 26 Aug 2016 13:25:59 +0200 Subject: [PATCH 14/16] QColorDialog::getRgba: Fixed ignoring of initial alpha value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation for this method explicitly states that the initial color+alpha is used, but its implementation used a QColor constructor that ignores the alpha value. Change-Id: I71721386e7fae0761e079d8840ec0124a8c14e33 Reviewed-by: Marc Mutz Reviewed-by: Thorbjørn Lindeijer --- src/widgets/dialogs/qcolordialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 547a55f19e..c4cc21cbe5 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -2173,7 +2173,8 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent) { - QColor color(getColor(QColor(initial), parent, QString(), ShowAlphaChannel)); + const QColor color = getColor(QColor::fromRgba(initial), parent, QString(), + ShowAlphaChannel); QRgb result = color.isValid() ? color.rgba() : initial; if (ok) *ok = color.isValid(); From 2743cd54a0785b6c8d16b570643281ef61024936 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Apr 2016 13:38:43 -0700 Subject: [PATCH 15/16] Mark Clang 3.9 as warning-free Change-Id: Id75834dab9ed466e94c7ffff1444b71f29f49afd Reviewed-by: Jake Petroules --- mkspecs/features/qt_common.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 171b96f415..c1809468af 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -54,10 +54,10 @@ warnings_are_errors:warning_clean { # compiler. clang:!ios { # Apple clang 4.0-4.2,5.0-5.1,6.0-6.4 - # Regular clang 3.3-3.8 + # Regular clang 3.3-3.9 apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} - contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-8]") { + contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-9]") { QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR } } else:intel_icc:linux { From e52fcb7dc78c83586c813f55f087a98bae4eaa0e Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 27 Sep 2015 01:22:42 +0200 Subject: [PATCH 16/16] QTextDocument: fix string backward search [ChangeLog][QtGui][QTextDocument] Fixed a bug that would return a wrong position when searching backward from the end of the document. Task-number: QTBUG-48182 Change-Id: I6e88f808a50cb840f61e7bc579e2a28c5300089d Reviewed-by: Simon Hausmann --- src/gui/text/qtextdocument.cpp | 2 +- tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 3edf652f35..6cccf417c7 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1309,7 +1309,7 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op //do not include the character given in the position. if (options & FindBackward) { --pos ; - if (pos < subString.size()) + if (pos < 0) return QTextCursor(); } diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 02e2bf27e2..bb20d99e30 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -323,6 +323,8 @@ void tst_QTextDocument::find_data() << 15 << 6 << 11; QTest::newRow("nbsp") << "Hello" + QString(QChar(QChar::Nbsp)) +"World" << " " << int(QTextDocument::FindCaseSensitively) << 0 << 5 << 6; + + QTest::newRow("from-the-end") << "Hello World" << "Hello World" << int(QTextDocument::FindCaseSensitively| QTextDocument::FindBackward) << 11 << 0 << 11; } void tst_QTextDocument::find()