From 198225983df9f402bb368b449f1abeea95ff0dce Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 11 Oct 2017 18:42:32 -0700 Subject: QShortcut: Fall back to cross platform code in absence of QPA menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, absence of a QPA menu means that we should be using our own internal logic since there's no entity on the QCocoaMenuDelegate to take care of the shortcuts. Change-Id: I35ed8f0b55445f61d0528709d4debb636a502002 Task-number: QTBUG-61039 Reviewed-by: Tor Arne Vestbø Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qshortcut.cpp | 4 +++- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 28 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 0585a59e89..f944a7097b 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -289,8 +289,10 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // not the QMenu.) Since we can also reach this code by climbing the menu // hierarchy (see below), or when the shortcut is not a key-equivalent, we // need to check whether the QPA menu is actually disabled. + // When there is no QPA menu, there will be no QCocoaMenuDelegate checking + // for the actual shortcuts. We can then fallback to our own logic. QPlatformMenu *pm = menu->platformMenu(); - if (!pm || !pm->isEnabled()) + if (pm && !pm->isEnabled()) continue; #endif QAction *a = menu->menuAction(); diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index f0fb7bc367..ad30db501a 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -133,6 +133,7 @@ private slots: void menuSize_Scrolling_data(); void menuSize_Scrolling(); void tearOffMenuNotDisplayed(); + void QTBUG_61039_menu_shortcuts(); protected slots: void onActivated(QAction*); @@ -1609,5 +1610,32 @@ void tst_QMenu::tearOffMenuNotDisplayed() QVERIFY(!torn->isVisible()); } +void tst_QMenu::QTBUG_61039_menu_shortcuts() +{ + QAction *actionKamen = new QAction("Action Kamen"); + actionKamen->setShortcut(QKeySequence(QLatin1String("K"))); + + QAction *actionJoe = new QAction("Action Joe"); + actionJoe->setShortcut(QKeySequence(QLatin1String("Ctrl+J"))); + + QMenu menu; + menu.addAction(actionKamen); + menu.addAction(actionJoe); + QVERIFY(!menu.platformMenu()); + + QWidget widget; + widget.addAction(menu.menuAction()); + widget.show(); + QVERIFY(QTest::qWaitForWindowActive(&widget)); + + QSignalSpy actionKamenSpy(actionKamen, &QAction::triggered); + QTest::keyClick(&widget, Qt::Key_K); + QTRY_COMPARE(actionKamenSpy.count(), 1); + + QSignalSpy actionJoeSpy(actionJoe, &QAction::triggered); + QTest::keyClick(&widget, Qt::Key_J, Qt::ControlModifier); + QTRY_COMPARE(actionJoeSpy.count(), 1); +} + QTEST_MAIN(tst_QMenu) #include "tst_qmenu.moc" -- cgit v1.2.3 From 127483b5e30de6c1905ea3280dd45a0b7d6a3813 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 16 Oct 2017 15:34:35 +0200 Subject: Windows QPA: Fix reporting of TabletLeaveProximity events Move the check for totalPacks below; it prevents leave notifications from being handled. Task-number: QTBUG-53628 Change-Id: I2436c51308803337e6d48ef958e03123283d4a1d Reviewed-by: Shawn Rutledge --- .../platforms/windows/qwindowstabletsupport.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 7e1017426f..5fe58fbfa5 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -352,16 +352,26 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L { PACKET proximityBuffer[1]; // we are only interested in the first packet in this case const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer); - if (!totalPacks) - return false; + if (!LOWORD(lParam)) { qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice; - QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime, - m_devices.at(m_currentDevice).currentDevice, - m_devices.at(m_currentDevice).currentPointerType, - m_devices.at(m_currentDevice).uniqueId); + if (totalPacks > 0) { + QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime, + m_devices.at(m_currentDevice).currentDevice, + m_devices.at(m_currentDevice).currentPointerType, + m_devices.at(m_currentDevice).uniqueId); + } else { + QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice, + m_devices.at(m_currentDevice).currentPointerType, + m_devices.at(m_currentDevice).uniqueId); + + } return true; } + + if (!totalPacks) + return false; + const UINT currentCursor = proximityBuffer[0].pkCursor; UINT physicalCursorId; QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &physicalCursorId); -- cgit v1.2.3 From b16add0dc6db16b20f730b763ffa080f953b52e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 13 Oct 2017 14:38:49 +0200 Subject: QNetworkReply: Reduce noise and a fail when building with no-ssl A few tests would QSKIP depending on the inclusion of SSL, producing multiple lines of noise in the output. And one test used https in one of its configurations without checking to see if it could, causing an UnknownProtocolError. Change-Id: I5f54bf1005f962cc027c099b816fbe245dc43d3f Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 39 ++++++++++------------ 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 16f06b2d15..439f1cd618 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -8167,7 +8167,9 @@ void tst_QNetworkReply::ioHttpRedirectErrors_data() "location: http://localhost:%1\r\n\r\n"); QTest::newRow("too-many-redirects") << "http://localhost" << tempRedirectReply << QNetworkReply::TooManyRedirectsError; +#if QT_CONFIG(ssl) QTest::newRow("insecure-redirect") << "https://localhost" << tempRedirectReply << QNetworkReply::InsecureRedirectError; +#endif QTest::newRow("unknown-redirect") << "http://localhost"<< tempRedirectReply.replace("http", "bad_protocol") << QNetworkReply::ProtocolUnknownError; } @@ -8178,7 +8180,7 @@ void tst_QNetworkReply::ioHttpRedirectErrors() QFETCH(QNetworkReply::NetworkError, error); QUrl localhost(url); - MiniHttpServer server("", localhost.scheme() == "https"); + MiniHttpServer server("", localhost.scheme() == QLatin1String("https")); localhost.setPort(server.serverPort()); @@ -8228,11 +8230,13 @@ void tst_QNetworkReply::ioHttpRedirectPolicy_data() QTest::addColumn("statusCode"); QTest::newRow("manual-nossl") << QNetworkRequest::ManualRedirectPolicy << false << 0 << 307; - QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; QTest::newRow("nolesssafe-nossl") << QNetworkRequest::NoLessSafeRedirectPolicy << false << 1 << 200; - QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; QTest::newRow("same-origin-nossl") << QNetworkRequest::SameOriginRedirectPolicy << false << 1 << 200; +#if QT_CONFIG(ssl) + QTest::newRow("manual-ssl") << QNetworkRequest::ManualRedirectPolicy << true << 0 << 307; + QTest::newRow("nolesssafe-ssl") << QNetworkRequest::NoLessSafeRedirectPolicy << true << 1 << 200; QTest::newRow("same-origin-ssl") << QNetworkRequest::SameOriginRedirectPolicy << true << 1 << 200; +#endif } void tst_QNetworkReply::ioHttpRedirectPolicy() @@ -8240,10 +8244,6 @@ void tst_QNetworkReply::ioHttpRedirectPolicy() QFETCH(const QNetworkRequest::RedirectPolicy, policy); QFETCH(const bool, ssl); -#ifdef QT_NO_SSL - if (ssl) - QSKIP("SSL is not supported"); -#endif QFETCH(const int, redirectCount); QFETCH(const int, statusCode); @@ -8251,11 +8251,7 @@ void tst_QNetworkReply::ioHttpRedirectPolicy() // Setup HTTP server. SameOriginRedirector redirectServer("", ssl); - QUrl url(QLatin1String( -#ifndef QT_NO_SSL - ssl ? "https://localhost" : -#endif - "http://localhost")); + QUrl url(QLatin1String(ssl ? "https://localhost" : "http://localhost")); url.setPort(redirectServer.serverPort()); redirectServer.responses.push_back(httpEmpty200Response); @@ -8291,27 +8287,35 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() // 1. NoLessSafeRedirectsPolicy QTest::newRow("nolesssafe-nossl-nossl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; +#if QT_CONFIG(ssl) QTest::newRow("nolesssafe-ssl-ssl-too-many") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("https:/localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("nolesssafe-ssl-nossl-insecure-redirect") << QNetworkRequest::NoLessSafeRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif // 2. SameOriginRedirectsPolicy QTest::newRow("same-origin-nossl-nossl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; +#if QT_CONFIG(ssl) QTest::newRow("same-origin-ssl-ssl-too-many") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost:%1") << 0 << QNetworkReply::TooManyRedirectsError; QTest::newRow("same-origin-https-http-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("http://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif QTest::newRow("same-origin-http-https-wrong-protocol") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("https://localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; QTest::newRow("same-origin-http-http-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#if QT_CONFIG(ssl) QTest::newRow("same-origin-https-https-wrong-host") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://not-so-localhost:%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif QTest::newRow("same-origin-http-http-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << false << QString("http://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; +#if QT_CONFIG(ssl) QTest::newRow("same-origin-https-https-wrong-port") << QNetworkRequest::SameOriginRedirectPolicy << true << QString("https://localhost/%1") << 50 << QNetworkReply::InsecureRedirectError; +#endif } void tst_QNetworkReply::ioHttpRedirectPolicyErrors() @@ -8325,20 +8329,11 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors() QFETCH(const int, maxRedirects); QFETCH(const QNetworkReply::NetworkError, expectedError); -#ifdef QT_NO_SSL - if (ssl || location.contains("https")) - QSKIP("SSL required to run this test"); -#endif - // Setup the server. MiniHttpServer server("", ssl); server.setDataToTransmit(tempRedirectReplyStr().arg(location.arg(server.serverPort())).toLatin1()); - QUrl url(QLatin1String( -#ifndef QT_NO_SSL - ssl ? "https://localhost" : -#endif - "http://localhost")); + QUrl url(QLatin1String(ssl ? "https://localhost" : "http://localhost")); url.setPort(server.serverPort()); QNetworkRequest request(url); -- cgit v1.2.3 From 8fcf171b421cb71f97589e19b548a5eaa996cf72 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 29 Sep 2017 10:52:36 +0200 Subject: Android Accessibility: protect from accessing invalid interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I am not sure if this is going to help, but it is required that the bridge checks that the interfaces it accesses are valid, since that protects from accessing them when they are in the destructor. This should be done, whether it fixes the issue or not. Task-number: QTBUG-45855 Change-Id: I2b96999ca4043f8b33607c864d1d178695d03192 Reviewed-by: Jan Arve Sæther --- .../platforms/android/androidjniaccessibility.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 06624415d3..e4d670239f 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -104,11 +104,11 @@ namespace QtAndroidAccessibility static jintArray childIdListForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - if (iface) { + if (iface && iface->isValid()) { jintArray jArray = env->NewIntArray(jsize(iface->childCount())); for (int i = 0; i < iface->childCount(); ++i) { QAccessibleInterface *child = iface->child(i); - if (child) { + if (child && child->isValid()) { QAccessible::Id ifaceId = QAccessible::uniqueId(child); jint jid = ifaceId; env->SetIntArrayRegion(jArray, i, 1, &jid); @@ -123,9 +123,9 @@ namespace QtAndroidAccessibility static jint parentId(JNIEnv */*env*/, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - if (iface) { + if (iface && iface->isValid()) { QAccessibleInterface *parent = iface->parent(); - if (parent) { + if (parent && parent->isValid()) { if (parent->role() == QAccessible::Application) return -1; return QAccessible::uniqueId(parent); @@ -151,7 +151,7 @@ namespace QtAndroidAccessibility static jint hitTest(JNIEnv */*env*/, jobject /*thiz*/, jfloat x, jfloat y) { QAccessibleInterface *root = interfaceFromId(-1); - if (root) { + if (root && root->isValid()) { QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window()); QAccessibleInterface *child = root->childAt(pos.x(), pos.y()); @@ -170,7 +170,7 @@ namespace QtAndroidAccessibility { // qDebug() << "A11Y: CLICK: " << objectId; QAccessibleInterface *iface = interfaceFromId(objectId); - if (iface && iface->actionInterface()) { + if (iface && iface->isValid() && iface->actionInterface()) { if (iface->actionInterface()->actionNames().contains(QAccessibleActionInterface::pressAction())) iface->actionInterface()->doAction(QAccessibleActionInterface::pressAction()); else @@ -182,13 +182,17 @@ namespace QtAndroidAccessibility static jboolean scrollForward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::increaseAction()); + if (iface && iface->isValid()) + return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::increaseAction()); + return false; } static jboolean scrollBackward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::decreaseAction()); + if (iface && iface->isValid()) + return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::decreaseAction()); + return false; } -- cgit v1.2.3 From 574c8ec13c89056f9a10c347b455ec6bfe864531 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 12 Oct 2017 11:11:32 +0200 Subject: Doc: State that qDebug and friends are thread-safe There's a common misconception that qDebug and friends are not thread-safe, so let's explicitly state this. Change-Id: I48d4ab8983017a9f2e7c9932a49ed573baa22929 Reviewed-by: Leena Miettinen Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 4 ++++ src/corelib/io/qloggingcategory.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b5cc88534e..8d614b4f91 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -4298,6 +4298,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qDebug(const char *message, ...) \relates + \threadsafe Calls the message handler with the debug message \a message. If no message handler has been installed, the message is printed to @@ -4334,6 +4335,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qInfo(const char *message, ...) \relates + \threadsafe \since 5.5 Calls the message handler with the informational message \a message. If no @@ -4371,6 +4373,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qWarning(const char *message, ...) \relates + \threadsafe Calls the message handler with the warning message \a message. If no message handler has been installed, the message is printed to @@ -4405,6 +4408,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qCritical(const char *message, ...) \relates + \threadsafe Calls the message handler with the critical message \a message. If no message handler has been installed, the message is printed to diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 4256d4b6e1..b029274329 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -445,6 +445,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCDebug(category) \relates QLoggingCategory + \threadsafe \since 5.2 Returns an output stream for debug messages in the logging category @@ -469,6 +470,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCDebug(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.3 Logs a debug message \a message in the logging category \a category. @@ -490,6 +492,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCInfo(category) \relates QLoggingCategory + \threadsafe \since 5.5 Returns an output stream for informational messages in the logging category @@ -514,6 +517,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCInfo(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.5 Logs an informational message \a message in the logging category \a category. @@ -535,6 +539,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCWarning(category) \relates QLoggingCategory + \threadsafe \since 5.2 Returns an output stream for warning messages in the logging category @@ -559,6 +564,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCWarning(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.3 Logs a warning message \a message in the logging category \a category. @@ -580,6 +586,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCCritical(category) \relates QLoggingCategory + \threadsafe \since 5.2 Returns an output stream for critical messages in the logging category @@ -604,6 +611,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCCritical(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.3 Logs a critical message \a message in the logging category \a category. -- cgit v1.2.3 From db333d6dba7703a67834a49e42e64c1e04b9ed3a Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 16 Oct 2017 12:32:02 +0200 Subject: QNAM (redirects) - clear 'raw' headers before sending the next request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already cleared 'cookedHeaders', which is a QHash for 'known headers' (enumerators as keys instead of strings), now do the same for 'rawHeaders'- not to end up with some weird mix of headers from all possible redirect responses and the final response. Task-number: QTBUG-61300 Change-Id: Ifd6655c4167840bb00d29446d36ce65ba2d5491a Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- src/network/access/qnetworkreplyhttpimpl.cpp | 1 + .../network/access/qnetworkreply/tst_qnetworkreply.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 8ba2b12a46..fa60eb3564 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1183,6 +1183,7 @@ void QNetworkReplyHttpImplPrivate::followRedirect() { Q_Q(QNetworkReplyHttpImpl); + rawHeaders.clear(); cookedHeaders.clear(); if (managerPrivate->thread) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 439f1cd618..97fe9e04bf 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -516,6 +516,17 @@ bool tst_QNetworkReply::seedCreated = false; QFAIL(qPrintable(errorMsg)); \ } while (0) +static bool validateRedirectedResponseHeaders(QNetworkReplyPtr reply) +{ + // QTBUG-61300: previously we were mixing 'raw' headers from all responses + // along the redirect chain. The simplest test is to check/verify we have + // no 'location' header anymore. + Q_ASSERT(reply.data()); + + return !reply->hasRawHeader("location") + && !reply->header(QNetworkRequest::LocationHeader).isValid(); +} + #ifndef QT_NO_SSL static void setupSslServer(QSslSocket* serverSocket) { @@ -8106,6 +8117,7 @@ void tst_QNetworkReply::ioHttpSingleRedirect() // Reply url is set to the redirect url QCOMPARE(reply->url(), redirectUrl); QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(validateRedirectedResponseHeaders(reply)); } void tst_QNetworkReply::ioHttpChangeMaxRedirects() @@ -8154,6 +8166,7 @@ void tst_QNetworkReply::ioHttpChangeMaxRedirects() QCOMPARE(redSpy2.count(), 2); QCOMPARE(reply2->url(), server3Url); QCOMPARE(reply2->error(), QNetworkReply::NoError); + QVERIFY(validateRedirectedResponseHeaders(reply2)); } void tst_QNetworkReply::ioHttpRedirectErrors_data() @@ -8274,6 +8287,7 @@ void tst_QNetworkReply::ioHttpRedirectPolicy() QCOMPARE(finishedSpy.count(), 1); QCOMPARE(redirectSpy.count(), redirectCount); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), statusCode); + QVERIFY(validateRedirectedResponseHeaders(reply) || statusCode != 200); } void tst_QNetworkReply::ioHttpRedirectPolicyErrors_data() @@ -8406,6 +8420,7 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect() waitForFinish(reply); QCOMPARE(finishedSpy.count(), 1); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), statusCode); + QVERIFY(validateRedirectedResponseHeaders(reply) || statusCode != 200); } void tst_QNetworkReply::ioHttpCookiesDuringRedirect() @@ -8433,6 +8448,7 @@ void tst_QNetworkReply::ioHttpCookiesDuringRedirect() QVERIFY(waitForFinish(reply) == Success); QVERIFY(target.receivedData.contains("\r\nCookie: hello=world\r\n")); + QVERIFY(validateRedirectedResponseHeaders(reply)); } void tst_QNetworkReply::ioHttpRedirect_data() @@ -8471,6 +8487,7 @@ void tst_QNetworkReply::ioHttpRedirect() QCOMPARE(waitForFinish(reply), int(Success)); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); + QVERIFY(validateRedirectedResponseHeaders(reply)); } #ifndef QT_NO_SSL -- cgit v1.2.3 From 0aba5546ef69bddeb42c3dabe22e2856f0213b19 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 7 Sep 2017 14:40:58 +0200 Subject: tests: fix and un-blacklist tst_qgraphicsview::hoverLeave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests should not use QCursor to emulate mouse move, see QCursor::setPos() docs. The flakiness of the test on XCB is not surprising when the test queries geometry even before the window has been shown. With the re-factored version I could not reproduce flakiness anymore. Removed Q_OS_MAC and closed QTBUG-26274 as test passes on macOS from which I assume that the underlying issue has been fixed. Removed Q_OS_QNX ifdef as test does not rely on QCursor anymore. This patch also fixes the issues on minimal / offscreen platform plugins. QCursor::setPos() is evil for auto test purposes. Note: We intentionally use QTest::mouseMove(QWindow *window, ..), not the QWidget overload. The QWindow version gets routed through QWSI, which ensures that all necessary events are generated as expect. In QWidget code path this is currently disabled by QTEST_QPA_MOUSE_HANDLING. Change-Id: I285c26cff09e3f2750f8c2abbb1f46c8f7be984a Reviewed-by: Tor Arne Vestbø (cherry picked from commit 1af927976ac953f922e35d71a16a32d328bb2efd) Reviewed-by: Tony Sarajärvi Reviewed-by: Friedemann Kleint Reviewed-by: Liang Qi --- .../widgets/graphicsview/qgraphicsview/BLACKLIST | 2 - .../qgraphicsview/tst_qgraphicsview.cpp | 48 +++++++++------------- 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST index 3cba8bad7e..40d106e3ba 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST @@ -12,7 +12,5 @@ xcb xcb [forwardMousePress] xcb -[hoverLeave] -xcb [resizeAnchor] xcb diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 121836234d..5900c85627 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -4777,8 +4777,6 @@ class GraphicsItemWithHover : public QGraphicsRectItem { public: GraphicsItemWithHover() - : receivedEnterEvent(false), receivedLeaveEvent(false), - enterWidget(0), leaveWidget(0) { setRect(0, 0, 100, 100); setAcceptHoverEvents(true); @@ -4786,6 +4784,9 @@ public: bool sceneEvent(QEvent *event) { + if (!checkEvents) // ensures that we don't look at stray events before we are ready + return QGraphicsRectItem::sceneEvent(event); + if (event->type() == QEvent::GraphicsSceneHoverEnter) { receivedEnterEvent = true; enterWidget = static_cast(event)->widget(); @@ -4796,50 +4797,39 @@ public: return QGraphicsRectItem::sceneEvent(event); } - bool receivedEnterEvent; - bool receivedLeaveEvent; - QWidget *enterWidget; - QWidget *leaveWidget; + bool receivedEnterEvent = false; + bool receivedLeaveEvent = false; + QWidget *enterWidget = nullptr; + QWidget *leaveWidget = nullptr; + bool checkEvents = false; }; void tst_QGraphicsView::hoverLeave() { - if (platformName == QStringLiteral("cocoa")) { - QSKIP("Insignificant on OSX"); - } else if (platformName == QStringLiteral("minimal") - || (platformName == QStringLiteral("offscreen"))) { - QSKIP("Fails in minimal/offscreen platforms if forwardMouseDoubleClick has been run"); - } - const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); QGraphicsScene scene; QGraphicsView view(&scene); view.resize(160, 160); - view.move(availableGeometry.center() - QPoint(80, 80)); GraphicsItemWithHover *item = new GraphicsItemWithHover; scene.addItem(item); - // move the cursor out of the way - const QPoint outOfWindow = view.geometry().topRight() + QPoint(50, 0); - QCursor::setPos(outOfWindow); - view.showNormal(); qApp->setActiveWindow(&view); - QVERIFY(QTest::qWaitForWindowActive(&view)); - - QPoint pos = view.viewport()->mapToGlobal(view.mapFromScene(item->mapToScene(10, 10))); - QCursor::setPos(pos); + QVERIFY(QTest::qWaitForWindowExposed(&view)); -#if defined(Q_OS_QNX) - QEXPECT_FAIL("", "QCursor does not set native cursor on QNX", Abort); -#endif + QWindow *viewWindow = view.window()->windowHandle(); + QPoint posOutsideItem = view.mapFromScene(item->mapToScene(0, 0)) - QPoint(5, 0); + QPoint posOutsideItemGlobal = view.mapToGlobal(posOutsideItem); + QPoint posOutsideItemInWindow = viewWindow->mapFromGlobal(posOutsideItemGlobal); + QTest::mouseMove(viewWindow, posOutsideItemInWindow); + item->checkEvents = true; + QPoint posInItemGlobal = view.mapToGlobal(view.mapFromScene(item->mapToScene(10, 10))); + QTest::mouseMove(viewWindow, viewWindow->mapFromGlobal(posInItemGlobal)); QTRY_VERIFY(item->receivedEnterEvent); QCOMPARE(item->enterWidget, view.viewport()); - QCursor::setPos(outOfWindow); -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "QTBUG-26274 - behaviour regression", Abort); -#endif + QTest::mouseMove(viewWindow, posOutsideItemInWindow); + QTRY_VERIFY(item->receivedLeaveEvent); QCOMPARE(item->leaveWidget, view.viewport()); } -- cgit v1.2.3 From 377d2502e3d3116c4cbe7398c2aa6f4afbe32851 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 26 Sep 2017 12:20:30 +0200 Subject: tests: make exposeEventOnShrink_QTBUG54040 not flakey on xcb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: https://tronche.com/gui/x/xlib/events/exposure/expose.html "The circumstances in which the X server generates Expose events are not as definite as those for other events." On windows with XCB_GRAVITY_NORTH_WEST flag set we should not get expose events according to e2665600c09358854bb0b29389cc873a2684f77b, but as stated earlier this might not always be true. Nevertheless, sometimes we get expose event from X server when shrinking window, but most of the time we don't. Make the test not flakey by checking that we get at least 1 expose event, instead of exactly 1. Now running test 500 times in a loop does not fail. Task-number: QTBUG-63424 Change-Id: I8004e622020cc09e11b7d592faf6d9ee1b9cfee2 Reviewed-by: Tor Arne Vestbø (cherry picked from commit 542e11ab2bd4a607fda8f559cc7efc32371b4e0e) Reviewed-by: Tony Sarajärvi Reviewed-by: Friedemann Kleint Reviewed-by: Liang Qi --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index e1366ce2eb..6452b9ecd0 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -394,13 +394,17 @@ void tst_QWindow::exposeEventOnShrink_QTBUG54040() QVERIFY(QTest::qWaitForWindowExposed(&window)); - const int initialExposeCount = window.received(QEvent::Expose); + int exposeCount = window.received(QEvent::Expose); window.resize(window.width(), window.height() - 5); - QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 1); + QTRY_VERIFY(window.received(QEvent::Expose) > exposeCount); + + exposeCount = window.received(QEvent::Expose); window.resize(window.width() - 5, window.height()); - QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 2); + QTRY_VERIFY(window.received(QEvent::Expose) > exposeCount); + + exposeCount = window.received(QEvent::Expose); window.resize(window.width() - 5, window.height() - 5); - QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 3); + QTRY_VERIFY(window.received(QEvent::Expose) > exposeCount); } void tst_QWindow::positioning_data() -- cgit v1.2.3 From 8a39384e907e830c907f73009f498c486b22bd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 10 Oct 2017 15:54:04 +0200 Subject: Open a session during redirects when needed In some cases when a session isn't needed (i.e. for localhost), the session is not opened at all. If a program (e.g. our tests) redirects from localhost to a different system (e.g. the qt network test servers, or the internet) it will wait for a session forever. So, we need to check if a session is needed for the redirect-target and then open one. It is usually opened in QNetworkReplyHttpImplPrivate::_q_startOperation Change-Id: Id3b78182a3fb3f63f0235ecb1fb665df8bd0c4ca Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 78 ++++++++++++++++------ src/network/access/qnetworkreplyhttpimpl_p.h | 2 + .../access/qnetworkreply/tst_qnetworkreply.cpp | 28 ++++++++ 3 files changed, 87 insertions(+), 21 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index fa60eb3564..9756b43108 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -165,6 +165,16 @@ static QHash parseHttpOptionHeader(const QByteArray &hea } } +#if QT_CONFIG(bearermanagement) +static bool isSessionNeeded(const QUrl &url) +{ + // Connections to the local machine does not require a session + QString host = url.host().toLower(); + return !QHostAddress(host).isLoopback() && host != QLatin1String("localhost") + && host != QSysInfo::machineHostName().toLower(); +} +#endif // bearer management + QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manager, const QNetworkRequest& request, QNetworkAccessManager::Operation& operation, @@ -1189,6 +1199,24 @@ void QNetworkReplyHttpImplPrivate::followRedirect() if (managerPrivate->thread) managerPrivate->thread->disconnect(); +#if QT_CONFIG(bearermanagement) + // If the original request didn't need a session (i.e. it was to localhost) + // then we might not have a session open, to which to redirect, if the + // new URL is remote. When this happens, we need to open the session now: + if (managerPrivate && isSessionNeeded(url)) { + if (auto session = managerPrivate->getNetworkSession()) { + if (session->state() != QNetworkSession::State::Connected || !session->isOpen()) { + startWaitForSession(session); + // Need to set 'request' to the redirectRequest so that when QNAM restarts + // the request after the session starts it will not repeat the previous request. + request = redirectRequest; + // Return now, QNAM will start the request when the session has started. + return; + } + } + } +#endif // bearer management + QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection, Q_ARG(QNetworkRequest, redirectRequest)); } @@ -1770,10 +1798,8 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) } // This is not ideal. - const QString host = url.host(); - if (host == QLatin1String("localhost") || - QHostAddress(host).isLoopback()) { - // Don't need an open session for localhost access. + if (!isSessionNeeded(url)) { + // Don't need to check for an open session if we don't need one. postRequest(newHttpRequest); return true; } @@ -1797,6 +1823,32 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) #endif } +bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer &session) +{ + Q_Q(QNetworkReplyHttpImpl); + state = WaitingForSession; + + if (session) { + QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)), + q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection); + + if (!session->isOpen()) { + QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, + QVariant::fromValue(false)); + session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground); + session->open(); + } + return true; + } + const Qt::ConnectionType connection = synchronous ? Qt::DirectConnection : Qt::QueuedConnection; + qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); + QMetaObject::invokeMethod(q, "_q_error", connection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError), + Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error."))); + QMetaObject::invokeMethod(q, "_q_finished", connection); + return false; +} + void QNetworkReplyHttpImplPrivate::_q_startOperation() { Q_Q(QNetworkReplyHttpImpl); @@ -1824,24 +1876,8 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. - state = WaitingForSession; - - if (session) { - QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)), - q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection); - - if (!session->isOpen()) { - session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground); - session->open(); - } - } else { - qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); - QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError), - Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error."))); - QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); + if (!startWaitForSession(session)) return; - } } else if (session) { QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h index 9383149124..1b702bd2ec 100644 --- a/src/network/access/qnetworkreplyhttpimpl_p.h +++ b/src/network/access/qnetworkreplyhttpimpl_p.h @@ -160,6 +160,8 @@ signals: class QNetworkReplyHttpImplPrivate: public QNetworkReplyPrivate { + bool startWaitForSession(QSharedPointer &session); + public: static QHttpNetworkRequest::Priority convert(const QNetworkRequest::Priority& prio); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 97fe9e04bf..d236ef0490 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -490,6 +490,7 @@ private Q_SLOTS: void ioHttpCookiesDuringRedirect(); void ioHttpRedirect_data(); void ioHttpRedirect(); + void ioHttpRedirectFromLocalToRemote(); #ifndef QT_NO_SSL void putWithServerClosingConnectionImmediately(); #endif @@ -8490,6 +8491,33 @@ void tst_QNetworkReply::ioHttpRedirect() QVERIFY(validateRedirectedResponseHeaders(reply)); } +void tst_QNetworkReply::ioHttpRedirectFromLocalToRemote() +{ + QUrl targetUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"); + + QString redirectReply = tempRedirectReplyStr().arg(targetUrl.toString()); + MiniHttpServer redirectServer(redirectReply.toLatin1(), false); + QUrl url("http://localhost/"); + url.setPort(redirectServer.serverPort()); + + QFile reference(testDataDir + "/rfc3252.txt"); + QVERIFY(reference.open(QIODevice::ReadOnly)); + QNetworkRequest request(url); + + auto oldRedirectPolicy = manager.redirectPolicy(); + manager.setRedirectPolicy(QNetworkRequest::RedirectPolicy::NoLessSafeRedirectPolicy); + QNetworkReplyPtr reply(manager.get(request)); + // Restore previous policy + manager.setRedirectPolicy(oldRedirectPolicy); + + QCOMPARE(waitForFinish(reply), int(Success)); + + QCOMPARE(reply->url(), targetUrl); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size()); + QCOMPARE(reply->readAll(), reference.readAll()); +} + #ifndef QT_NO_SSL class PutWithServerClosingConnectionImmediatelyHandler: public QObject -- cgit v1.2.3 From c4cf90b1f739c47383672de3d66b1d9d5427f5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 9 Oct 2017 14:57:46 +0200 Subject: Fix redirecting POST for HTTP 307 and 308 All POST requests that were redirected would previously turn into GET requests. This does not follow the standard for HTTP codes 307 and 308. Task-number: QTBUG-63142 Change-Id: Ibd25a9566066e589670a9bc34e5dc5111f8139d5 Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- src/network/access/qhttpmultipart.cpp | 2 + .../access/qhttpnetworkconnectionchannel.cpp | 8 +- src/network/access/qnetworkreplyhttpimpl.cpp | 7 +- .../access/qnetworkreply/tst_qnetworkreply.cpp | 152 ++++++++++++++++++++- 4 files changed, 164 insertions(+), 5 deletions(-) diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp index 5c704efeef..870e71ba1e 100644 --- a/src/network/access/qhttpmultipart.cpp +++ b/src/network/access/qhttpmultipart.cpp @@ -483,6 +483,8 @@ bool QHttpMultiPartIODevice::isSequential() const bool QHttpMultiPartIODevice::reset() { + // Reset QIODevice's data + QIODevice::reset(); for (int a = 0; a < multiPart->parts.count(); a++) if (!multiPart->parts[a].d->reset()) return false; diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index e7bb8e6619..17520d0f4c 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -560,8 +560,14 @@ void QHttpNetworkConnectionChannel::handleStatus() if (redirectUrl.isValid()) reply->setRedirectUrl(redirectUrl); - if (qobject_cast(connection)) + if ((statusCode == 307 || statusCode == 308) && !resetUploadData()) { + // Couldn't reset the upload data, which means it will be unable to POST the data - + // this would lead to a long wait until it eventually failed and then retried. + // Instead of doing that we fail here instead, resetUploadData will already have emitted + // a ContentReSendError, so we're done. + } else if (qobject_cast(connection)) { QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + } break; } case 401: // auth required diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 9756b43108..89d552f431 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1115,10 +1115,15 @@ QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperat switch (currentOp) { case QNetworkAccessManager::HeadOperation: return QNetworkAccessManager::HeadOperation; + case QNetworkAccessManager::PostOperation: + // We MUST keep using POST when being redirected with 307 or 308. + if (statusCode == 307 || statusCode == 308) + return QNetworkAccessManager::PostOperation; + break; default: break; } - // For now, we're always returning GET for anything other than HEAD + // Use GET for everything else. return QNetworkAccessManager::GetOperation; } diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index d236ef0490..d22850ba4e 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -491,6 +491,10 @@ private Q_SLOTS: void ioHttpRedirect_data(); void ioHttpRedirect(); void ioHttpRedirectFromLocalToRemote(); + void ioHttpRedirectPost_data(); + void ioHttpRedirectPost(); + void ioHttpRedirectMultipartPost_data(); + void ioHttpRedirectMultipartPost(); #ifndef QT_NO_SSL void putWithServerClosingConnectionImmediately(); #endif @@ -542,7 +546,7 @@ static void setupSslServer(QSslSocket* serverSocket) } #endif -// Does not work for POST/PUT! +// Does not work for PUT! Limited support for POST. class MiniHttpServer: public QTcpServer { Q_OBJECT @@ -557,6 +561,10 @@ public: bool multiple; int totalConnections; + bool hasContent = false; + int contentRead = 0; + int contentLength = 0; + MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false) : dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), multiple(false), totalConnections(0) @@ -633,6 +641,18 @@ private: this, SLOT(slotError(QAbstractSocket::SocketError))); } + void parseContentLength() + { + int index = receivedData.indexOf("Content-Length:"); + index += sizeof("Content-Length:") - 1; + const auto end = std::find(receivedData.cbegin() + index, receivedData.cend(), '\r'); + auto num = receivedData.mid(index, std::distance(receivedData.cbegin() + index, end)); + bool ok; + contentLength = num.toInt(&ok); + if (!ok) + contentLength = -1; + } + private slots: #ifndef QT_NO_SSL void slotSslErrors(const QList& errors) @@ -654,12 +674,20 @@ public slots: { Q_ASSERT(!client.isNull()); receivedData += client->readAll(); - int doubleEndlPos = receivedData.indexOf("\r\n\r\n"); + const int doubleEndlPos = receivedData.indexOf("\r\n\r\n"); if (doubleEndlPos != -1) { + const int endOfHeader = doubleEndlPos + 4; + hasContent = receivedData.startsWith("POST"); + if (hasContent && contentLength == 0) + parseContentLength(); + contentRead = receivedData.length() - endOfHeader; + if (hasContent && contentRead < contentLength) + return; + // multiple requests incoming. remove the bytes of the current one if (multiple) - receivedData.remove(0, doubleEndlPos+4); + receivedData.remove(0, endOfHeader); reply(); } @@ -8518,6 +8546,124 @@ void tst_QNetworkReply::ioHttpRedirectFromLocalToRemote() QCOMPARE(reply->readAll(), reference.readAll()); } +void tst_QNetworkReply::ioHttpRedirectPost_data() +{ + QTest::addColumn("status"); + QTest::addColumn("data"); + QTest::addColumn("contentType"); + + QByteArray data; + data = "hello world"; + QTest::addRow("307") << "307 Temporary Redirect" << data << "text/plain"; + QString permanentRedirect = "308 Permanent Redirect"; + QTest::addRow("308") << permanentRedirect << data << "text/plain"; + + // Some data from ::putToFile_data + data = ""; + QTest::newRow("empty") << permanentRedirect << data << "application/octet-stream"; + + data = QByteArray("abcd\0\1\2\abcd",12); + QTest::newRow("with-nul") << permanentRedirect << data << "application/octet-stream"; + + data = QByteArray(4097, '\4'); + QTest::newRow("4k+1") << permanentRedirect << data << "application/octet-stream"; + + data = QByteArray(128*1024+1, '\177'); + QTest::newRow("128k+1") << permanentRedirect << data << "application/octet-stream"; + + data = QByteArray(2*1024*1024+1, '\177'); + QTest::newRow("2MB+1") << permanentRedirect << data << "application/octet-stream"; +} + +void tst_QNetworkReply::ioHttpRedirectPost() +{ + QFETCH(QString, status); + QFETCH(QByteArray, data); + QFETCH(QString, contentType); + + QUrl targetUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi"); + + QString redirectReply = QStringLiteral("HTTP/1.1 %1\r\n" + "Content-Type: text/plain\r\n" + "location: %2\r\n" + "\r\n").arg(status, targetUrl.toString()); + MiniHttpServer redirectServer(redirectReply.toLatin1()); + QUrl url("http://localhost/"); + url.setPort(redirectServer.serverPort()); + QNetworkRequest request(url); + request.setHeader(QNetworkRequest::KnownHeaders::ContentTypeHeader, contentType); + auto oldRedirectPolicy = manager.redirectPolicy(); + manager.setRedirectPolicy(QNetworkRequest::RedirectPolicy::NoLessSafeRedirectPolicy); + + QNetworkReplyPtr reply(manager.post(request, data)); + // Restore previous policy: + manager.setRedirectPolicy(oldRedirectPolicy); + + QCOMPARE(waitForFinish(reply), int(Success)); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + +void tst_QNetworkReply::ioHttpRedirectMultipartPost_data() +{ + postToHttpMultipart_data(); +} + +void tst_QNetworkReply::ioHttpRedirectMultipartPost() +{ + // Note: This code is heavily based on postToHttpMultipart + QFETCH(QUrl, url); + + static QSet boundaries; + + QNetworkReplyPtr reply; + + QFETCH(QHttpMultiPart *, multiPart); + QFETCH(QByteArray, expectedReplyData); + QFETCH(QByteArray, contentType); + + QString redirectReply = tempRedirectReplyStr().arg(url.toString()); + MiniHttpServer redirectServer(redirectReply.toLatin1()); + QUrl redirectUrl("http://localhost/"); + redirectUrl.setPort(redirectServer.serverPort()); + QNetworkRequest request(redirectUrl); + + // Restore policy when we leave this scope: + struct PolicyRestorer + { + QNetworkAccessManager &qnam; + QNetworkRequest::RedirectPolicy policy; + PolicyRestorer(QNetworkAccessManager &qnam) + : qnam(qnam), policy(qnam.redirectPolicy()) + { qnam.setRedirectPolicy(QNetworkRequest::RedirectPolicy::NoLessSafeRedirectPolicy); } + ~PolicyRestorer() { qnam.setRedirectPolicy(policy); } + } policyRestorer(manager); + + // hack for testing the setting of the content-type header by hand: + if (contentType == "custom") { + QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + "\""); + request.setHeader(QNetworkRequest::ContentTypeHeader, contentType); + } + + QVERIFY2(! boundaries.contains(multiPart->boundary()), "boundary '" + multiPart->boundary() + "' has been created twice"); + boundaries.insert(multiPart->boundary()); + + RUN_REQUEST(runMultipartRequest(request, reply, multiPart, "POST")); + multiPart->deleteLater(); + + QCOMPARE(reply->url(), url); + QCOMPARE(reply->error(), QNetworkReply::NoError); + + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); // 200 OK + + QVERIFY(multiPart->boundary().count() > 20); // check that there is randomness after the "boundary_.oOo._" string + QVERIFY(multiPart->boundary().count() < 70); + QByteArray replyData = reply->readAll(); + + expectedReplyData.prepend("content type: multipart/" + contentType + "; boundary=\"" + multiPart->boundary() + "\"\n"); +// QEXPECT_FAIL("nested", "the server does not understand nested multipart messages", Continue); // see above + QCOMPARE(replyData, expectedReplyData); +} + #ifndef QT_NO_SSL class PutWithServerClosingConnectionImmediatelyHandler: public QObject -- cgit v1.2.3 From 3fd641c3141b49b334dcbdb1a25649525445b724 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 18 Oct 2017 08:22:45 +0200 Subject: network: add a QT_CONFIG(bearermanagement) guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for QNetworkReplyHttpImplPrivate::startWaitForSession(). This amends 8a39384e907e830c907f73009f498c486b22bd20. Task-number: QTBUG-63847 Change-Id: Ic20a4ac3ab97ed25010e0679810ef64c3ff42c05 Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 2 ++ src/network/access/qnetworkreplyhttpimpl_p.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 89d552f431..fa49c8e05b 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1828,6 +1828,7 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) #endif } +#if QT_CONFIG(bearermanagement) bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer &session) { Q_Q(QNetworkReplyHttpImpl); @@ -1853,6 +1854,7 @@ bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer &session); +#endif public: -- cgit v1.2.3 From 05219136761ddf69b0b26599ce35866c98e26010 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 16 Oct 2017 15:48:41 +0200 Subject: QTabletEvent: Add doc note about Windows drivers Recent drivers no longer contain wintab32.dll, point out a version that still has it. Change-Id: I4125a0af3c11ab739f8006b91f58899aeed54458 Reviewed-by: Andre de la Rocha Reviewed-by: Gabriel de Dietrich Reviewed-by: Shawn Rutledge --- src/gui/kernel/qevent.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a7848b5485..06d52aa78d 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2330,6 +2330,13 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const cursor and touchpad. Qt recognizes these by their names. Otherwise, if the tablet is configured to use the evdev driver, there will be only one device and applications may not be able to distinguish the stylus from the eraser. + + \section1 Notes for Windows Users + + Tablet support currently requires the WACOM windows driver providing the DLL + \c{wintab32.dll} to be installed. It is contained in older packages, + for example \c{pentablet_5.3.5-3.exe}. + */ /*! -- cgit v1.2.3 From 37afba28b152b9c5cb1dfaa9a89df1e8103cde26 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 17 Oct 2017 12:01:12 +0200 Subject: QTableGenerator: Fix handling of illegal characters in fromBase8 again Change-Id: Iaee19f71e5b74b0d43b628739039ca3c2be60cd0 Reviewed-by: Lars Knoll --- src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 809aa68365..b5a0a5bbeb 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -520,7 +520,7 @@ static inline int fromBase8(const char *s, const char *end) { int result = 0; while (*s && s != end) { - if (*s <= '0' || *s >= '7') + if (*s < '0' || *s > '7') return 0; result *= 8; result += *s - '0'; -- cgit v1.2.3 From f13e75345d035ec906846aaa3540454787edbd3f Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 19 Oct 2017 11:55:32 +0700 Subject: Cocoa QPA: Remove usage of OBJECTIVE_SOURCES Change-Id: I5924ab0ddb442624f5aeeef023428be228348707 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/cocoa.pro | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 13e59906ca..5a00e1b7ec 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -1,6 +1,6 @@ TARGET = qcocoa -OBJECTIVE_SOURCES += main.mm \ +SOURCES += main.mm \ qcocoaintegration.mm \ qcocoatheme.mm \ qcocoabackingstore.mm \ @@ -30,9 +30,8 @@ OBJECTIVE_SOURCES += main.mm \ qcocoasystemtrayicon.mm \ qcocoaintrospection.mm \ qcocoakeymapper.mm \ - qcocoamimetypes.mm - -SOURCES += messages.cpp + qcocoamimetypes.mm \ + messages.cpp HEADERS += qcocoaintegration.h \ qcocoatheme.h \ @@ -66,7 +65,7 @@ HEADERS += qcocoaintegration.h \ qcocoamimetypes.h qtConfig(opengl.*) { - OBJECTIVE_SOURCES += qcocoaglcontext.mm + SOURCES += qcocoaglcontext.mm HEADERS += qcocoaglcontext.h } @@ -85,7 +84,7 @@ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { QT_FOR_CONFIG += widgets - OBJECTIVE_SOURCES += \ + SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ qcocoaprintersupport.mm \ -- cgit v1.2.3 From fc988786588bf86ebc46fdd12629efbec8ae1841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 17 Oct 2017 15:16:40 +0200 Subject: Fix cookie path matching for empty url path The path wouldn't match if the cookie's path was root ('/') and the URLs path was empty. Change-Id: I6dcd10f1fdf4f48f14e50f1b169cbdfda7005849 Reviewed-by: Thiago Macieira Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- src/network/access/qnetworkcookiejar.cpp | 2 +- .../access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 232c2b47a5..f62a03b11d 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -140,7 +140,7 @@ void QNetworkCookieJar::setAllCookies(const QList &cookieList) static inline bool isParentPath(const QString &path, const QString &reference) { - if (path.startsWith(reference)) { + if ((path.isEmpty() && reference == QLatin1String("/")) || path.startsWith(reference)) { //The cookie-path and the request-path are identical. if (path.length() == reference.length()) return true; diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index a0459021be..ed5d0c69a0 100644 --- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -340,6 +340,17 @@ void tst_QNetworkCookieJar::cookiesForUrl_data() QTest::newRow("no-match-domain-dot") << allCookies << "http://example.com" << result; result += cookieDot; QTest::newRow("match-domain-dot") << allCookies << "http://example.com." << result; + + // Root path in cookie, empty url path + allCookies.clear(); + QNetworkCookie rootCookie; + rootCookie.setName("a"); + rootCookie.setPath("/"); + rootCookie.setDomain("qt-project.org"); + allCookies += rootCookie; + result.clear(); + result += rootCookie; + QTest::newRow("root-path-match") << allCookies << "http://qt-project.org" << result; } void tst_QNetworkCookieJar::cookiesForUrl() -- cgit v1.2.3 From 6c1a2224f31be51b26634f02fc2b2cb3247a4668 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 31 Mar 2017 14:08:28 +0200 Subject: iOS: add support for adding mimetypes other than text on the clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A QVariant can only be converted to a QByteArray if it has user type QMetaType::QByteArray or QMetaType::QString. The way it stood, we always tried to convert the mime data to a QByteArray, and then put the result into a QVariant. This would fail if the mime data contained e.g a QPixmap. This patch will inspect what kind of data the QMimeData contains, and convert it to a QVariant using the expected API. Backport of 6d3c483 Task-number: QTBUG-57428 Task-number: QTBUG-63660 Change-Id: I09b4a94aef7b52773e1a79c468ead71b36dfbfc5 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosclipboard.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm index ef3b453bbf..6a585c9052 100644 --- a/src/plugins/platforms/ios/qiosclipboard.mm +++ b/src/plugins/platforms/ios/qiosclipboard.mm @@ -227,7 +227,19 @@ void QIOSClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) if (uti.isEmpty() || !converter->canConvert(mimeType, uti)) continue; - QByteArray byteArray = converter->convertFromMime(mimeType, mimeData->data(mimeType), uti).first(); + QVariant mimeDataAsVariant; + if (mimeData->hasImage()) { + mimeDataAsVariant = mimeData->imageData(); + } else if (mimeData->hasUrls()) { + QVariantList urlList; + for (const QUrl &url : mimeData->urls()) + urlList << url; + mimeDataAsVariant = QVariant(urlList); + } else { + mimeDataAsVariant = QVariant(mimeData->data(mimeType)); + } + + QByteArray byteArray = converter->convertFromMime(mimeType, mimeDataAsVariant, uti).first(); NSData *nsData = [NSData dataWithBytes:byteArray.constData() length:byteArray.size()]; [pbItem setValue:nsData forKey:uti.toNSString()]; break; -- cgit v1.2.3 From c99d8532c892f72f897c9e686be75d1ebba67618 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 18 Oct 2017 14:13:18 +0700 Subject: QCocoaSystemTrayIcon: Remove unused classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both QNSMenu and QSystemTrayIconQMenu aren't referenced anywhere else, including within qcocoasystemtrayicon.mm, since the QPA backend was added. Change-Id: I632c1b230226b2d08afce7f0f0019e9f7c030ba5 Reviewed-by: Morten Johan Sørvig --- .../platforms/cocoa/qcocoasystemtrayicon.mm | 31 ---------------------- 1 file changed, 31 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 6af22facf9..13e9d8809e 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -92,7 +92,6 @@ QT_USE_NAMESPACE -@class QT_MANGLE_NAMESPACE(QNSMenu); @class QT_MANGLE_NAMESPACE(QNSImageView); @interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject @@ -123,16 +122,8 @@ QT_USE_NAMESPACE -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; @end -@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu { - QPlatformMenu *qmenu; -} --(QPlatformMenu*)menu; --(id)initWithQMenu:(QPlatformMenu*)qmenu; -@end - QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem); QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView); -QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSMenu); QT_BEGIN_NAMESPACE class QSystemTrayIconSys @@ -447,26 +438,4 @@ QT_END_NAMESPACE @end -class QSystemTrayIconQMenu : public QPlatformMenu -{ -public: - void doAboutToShow() { emit aboutToShow(); } -private: - QSystemTrayIconQMenu(); -}; - -@implementation QNSMenu --(id)initWithQMenu:(QPlatformMenu*)qm { - self = [super init]; - if (self) { - self->qmenu = qm; - [self setDelegate:self]; - } - return self; -} --(QPlatformMenu*)menu { - return qmenu; -} -@end - #endif // QT_NO_SYSTEMTRAYICON -- cgit v1.2.3 From c05268222c654fec92dc904554797c0d17997bd6 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 19 Oct 2017 14:32:09 +0200 Subject: winrt: Fully initialize CREATEFILE2_EXTENDED_PARAMETERS struct Not properly initializing all members of the extended parameter struct will cause an "invalid handle specified" exception on use. Task-number: QTBUG-63883 Change-Id: Ic3a58df864c9e29ccbadc04bd71c18c8ef34374c Reviewed-by: Maurice Kalinowski --- src/corelib/io/qfilesystemengine_win.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 79407afefc..b01aa55756 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -628,6 +628,9 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) params.dwSize = sizeof(params); params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; params.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS; + params.dwSecurityQosFlags = SECURITY_ANONYMOUS; + params.lpSecurityAttributes = NULL; + params.hTemplateFile = NULL; const HANDLE handle = CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), 0, FILE_SHARE_READ, OPEN_EXISTING, ¶ms); -- cgit v1.2.3 From dcc8aa8f4e664283bf7b900bbd07d6b570797eac Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Oct 2017 13:22:36 +0200 Subject: Windows/Direct2D QPA: Fix build with -no-accessibility Task-number: QTBUG-63876 Change-Id: Ib9216977dd495e05d032e679c2f23ffe6a6953a6 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/direct2d/direct2d.pro | 4 +++- src/plugins/platforms/windows/windows.pro | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro index 224f122fc4..3fe0d5e660 100644 --- a/src/plugins/platforms/direct2d/direct2d.pro +++ b/src/plugins/platforms/direct2d/direct2d.pro @@ -2,9 +2,11 @@ TARGET = qdirect2d QT += \ core-private gui-private \ - eventdispatcher_support-private accessibility_support-private \ + eventdispatcher_support-private \ fontdatabase_support-private theme_support-private +qtConfig(accessibility): QT += accessibility_support-private + LIBS += -ldwmapi -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32 include(../windows/windows.pri) diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 23168c10dc..c5d76c5d1d 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -2,9 +2,11 @@ TARGET = qwindows QT += \ core-private gui-private \ - eventdispatcher_support-private accessibility_support-private \ + eventdispatcher_support-private \ fontdatabase_support-private theme_support-private +qtConfig(accessibility): QT += accessibility_support-private + LIBS += -lgdi32 -ldwmapi include(windows.pri) -- cgit v1.2.3 From 571b11d41c9dadd5ef11e4e954c16c5ca39d718e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Oct 2017 13:10:28 +0200 Subject: Windows QPA: Fix build with -no-feature-tabletevent Guard #include by QT_CONFIG. Task-number: QTBUG-63874 Change-Id: I33f4a4c4fbdae3d25874ee9cdc3f1c7e1ab783e3 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index f108be96e7..cda6c99ad0 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -46,7 +46,9 @@ #include "qtwindowsglobal.h" #include "qwindowsmime.h" #include "qwindowsinputcontext.h" -#include "qwindowstabletsupport.h" +#if QT_CONFIG(tabletevent) +# include "qwindowstabletsupport.h" +#endif #include "qwindowstheme.h" #include #ifndef QT_NO_ACCESSIBILITY -- cgit v1.2.3 From 8aadfbc6572b0cbb8d435ceb7cd288c9d5cb909c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Thu, 19 Oct 2017 00:00:39 +0200 Subject: xcb: Convert synthetic mouse enter event position to native pixels Mouse position is converted from native pixels later, so we must provide native pixels for "QWindowSystemInterface::handleEnterEvent". Amends 7091be1b7999d93fe2126042161dcd1d8fd20026 Task-number: QTBUG-63865 Change-Id: I813c171f2fc1d321af702ac30eb5f2e4232e97c4 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 4acc827bf6..c4649ac818 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -907,7 +907,9 @@ void QXcbWindow::hide() if (QWindow *childWindow = childWindowAt(enterWindow, cursorPos)) enterWindow = childWindow; const QPoint localPos = enterWindow->mapFromGlobal(cursorPos); - QWindowSystemInterface::handleEnterEvent(enterWindow, localPos, cursorPos); + QWindowSystemInterface::handleEnterEvent(enterWindow, + localPos * QHighDpiScaling::factor(enterWindow), + nativePos); } } } -- cgit v1.2.3 From 9c58dd15885d813aeb5d83d2869c0f3a3ee5fcfe Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Fri, 20 Oct 2017 16:09:29 +0300 Subject: Blacklist and skip failing tests for Boot2Qt / 64 bit arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-60263 Change-Id: I05978915b5bb7ae31069e8e9ae1dc273e483ddb0 Reviewed-by: Tony Sarajärvi --- tests/auto/auto.pro | 5 +++++ tests/auto/corelib/global/qlogging/BLACKLIST | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 tests/auto/corelib/global/qlogging/BLACKLIST diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 0f8129cb74..3caa6a3b65 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -43,3 +43,8 @@ else:!qtConfig(process): SUBDIRS -= tools SUBDIRS -= dbus } } + +# QTBUG-63915 +boot2qt: { + contains(QT_ARCH, arm64): SUBDIRS -= dbus +} diff --git a/tests/auto/corelib/global/qlogging/BLACKLIST b/tests/auto/corelib/global/qlogging/BLACKLIST new file mode 100644 index 0000000000..1dcee92361 --- /dev/null +++ b/tests/auto/corelib/global/qlogging/BLACKLIST @@ -0,0 +1,3 @@ +[qMessagePattern:backtrace depth,separator] +# QTBUG-63915 +b2qt 64bit -- cgit v1.2.3