From be6921e8605ef3951ff8e8f2528c4c2e4f8d9b71 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 26 Jun 2016 15:36:15 +0200 Subject: [PATCH 01/28] Doc: fix app type notes for QDirModel and QFileSystemModel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "GUI application" is quite confusing, because in fact, these models are part of QtWidgets and thus require QApplication instead of QGuiApplication. Change-Id: I35ccc8bfeb74c75a84b2ffbe1cab0c0839495980 Reviewed-by: Sze Howe Koh Reviewed-by: Topi Reiniö Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfilesystemmodel.cpp | 2 +- src/widgets/itemviews/qdirmodel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 0e2eee3b473..441a54bd7d4 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE about the underlying files and directories related to items in the model. Directories can be created and removed using mkdir(), rmdir(). - \note QFileSystemModel requires an instance of a GUI application. + \note QFileSystemModel requires an instance of \l QApplication. \section1 Example Usage diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index ac23e22ef71..b2d2a981fc9 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -202,7 +202,7 @@ void QDirModelPrivate::invalidate() Directories can be created and removed using mkdir(), rmdir(), and the model will be automatically updated to take the changes into account. - \note QDirModel requires an instance of a GUI application. + \note QDirModel requires an instance of \l QApplication. \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel, {Dir View Example}, {Model Classes} From 596ce989b5efff9d062540544e9c024dabe14e05 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Jun 2016 08:35:58 +0200 Subject: [PATCH 02/28] Windows QPA: Improve warning about SetProcessDpiAwareness() failure Silence warning in case DPI awareness was set externally unless debug is enabled. Task-number: QTBUG-54416 Change-Id: Id48769e3d4be3047f582e331633905c640930f21 Reviewed-by: Kai Koehne --- src/plugins/platforms/windows/qwindowscontext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 09c2f7df2eb..39054b6a64a 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -409,7 +409,9 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); - if (FAILED(hr)) { + // E_ACCESSDENIED means set externally (MSVC manifest or external app loading Qt plugin). + // Silence warning in that case unless debug is enabled. + if (FAILED(hr) && (hr != E_ACCESSDENIED || lcQpaWindows().isDebugEnabled())) { qWarning().noquote().nospace() << "SetProcessDpiAwareness(" << dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr) << ", using " << QWindowsContext::processDpiAwareness(); @@ -843,6 +845,9 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr) case E_UNEXPECTED: result += QByteArrayLiteral("E_UNEXPECTED"); break; + case E_ACCESSDENIED: + result += QByteArrayLiteral("E_ACCESSDENIED"); + break; case CO_E_ALREADYINITIALIZED: result += QByteArrayLiteral("CO_E_ALREADYINITIALIZED"); break; From df9aee21504b18decbd5637ca4ce86c559fa3cc3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Jun 2016 15:02:58 +0200 Subject: [PATCH 03/28] Fix URL to ANGLE Point to the README.md of the project; the old URL http://code.google.com/p/angleproject is now redirected to the bugtracker. Change-Id: I293fc150d5b6c08f16effe8921010050faa264b5 Reviewed-by: Maurice Kalinowski --- doc/global/externalsites/external-resources.qdoc | 2 +- src/angle/README.qt | 2 +- src/plugins/platforms/windows/qwindowseglcontext.cpp | 2 +- tools/configure/configureapp.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/global/externalsites/external-resources.qdoc b/doc/global/externalsites/external-resources.qdoc index 3e82dfe814c..a7b34af50c5 100644 --- a/doc/global/externalsites/external-resources.qdoc +++ b/doc/global/externalsites/external-resources.qdoc @@ -174,7 +174,7 @@ */ /*! - \externalpage http://code.google.com/p/angleproject/ + \externalpage https://chromium.googlesource.com/angle/angle/+/master/README.md \title ANGLE */ diff --git a/src/angle/README.qt b/src/angle/README.qt index ce5b6332bc8..2d484a02802 100644 --- a/src/angle/README.qt +++ b/src/angle/README.qt @@ -1,6 +1,6 @@ This is the ANGLE project from: -http://code.google.com/p/angleproject/ +https://chromium.googlesource.com/angle/angle/+/master/README.md The upstream version used here can be found in: diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 9ae1ca8acbe..82ac47e99f7 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -513,7 +513,7 @@ QSurfaceFormat QWindowsEGLStaticContext::formatFromConfig(EGLDisplay display, EG \list \o Install the Direct X SDK \o Checkout and build ANGLE (SVN repository) as explained here: - \l{http://code.google.com/p/angleproject/wiki/DevSetup}{ANGLE-Project}. + \l{https://chromium.googlesource.com/angle/angle/+/master/README.md} When building for 64bit, de-activate the "WarnAsError" option in every project file (as otherwise integer conversion warnings will break the build). diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 0909ff8aabf..f2b54f57f29 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2009,7 +2009,7 @@ bool Configure::displayHelp() } desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0."); - desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee http://code.google.com/p/angleproject/\n"); + desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee https://chromium.googlesource.com/angle/angle/+/master/README.md\n"); // Qt\Windows only options go below here -------------------------------------------------------------------------------- desc("\nQt for Windows only:\n\n"); From 2714d94ff4652e863f2e6005a138a2563d836f07 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Jun 2016 16:19:04 +0200 Subject: [PATCH 04/28] Fix tst_QNetworkReply::qtbug45581WrongReplyStatusCode() on Windows The file is read using CRLF line convention on Windows. Task-number: QTBUG-24226 Change-Id: Ie08fa603e29c80a42de4bfbfd1f4237f53c22b98 Reviewed-by: Timur Pocheptsov --- .../auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 02aca3d6c1e..0f2d0873a78 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -7295,7 +7295,11 @@ void tst_QNetworkReply::qtbug45581WrongReplyStatusCode() const QByteArray expectedContent = "" - "\n"; + "" +#ifdef Q_OS_WIN + "\r" +#endif + "\n"; QCOMPARE(reply->readAll(), expectedContent); From db1a6ac357eaaa09690a8310bcb799c678836320 Mon Sep 17 00:00:00 2001 From: Bernhard Scheirle Date: Sat, 18 Jun 2016 14:30:15 +0200 Subject: [PATCH 05/28] Fix shortcut handling for level three and above shortcuts Calling `xkb_state_update_mask` with correctly set `depressed_mods` allows xkb to return keys on level three or above (and not the equivalent level one key). To preserve level two shortcuts (return equivalent level one key) `depressed_mods` gets only set, if the pressed key is on level three or above. Example shortcuts which now will work: Shortcut German Layout (de) [AltGr is a level three switch] Ctrl+@ Ctrl+AltGr+Q Shift+1 Shift+1 (as before) Shortcut German Neo Layout (de neo) [1] [AltGr is a level five switch] Left AltGr+S [1] http://neo-layout.org Task-number: QTBUG-53121 Change-Id: I637a01edc9f2f92a5d3e7a24f5051fb1d3ac2f7f Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 1eeb59a6657..28de86b8ba2 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -973,10 +973,21 @@ QList QXcbKeyboard::possibleKeys(const QKeyEvent *event) const xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED); xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED); xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED); + xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED); - xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout); - + xkb_state_update_mask(kb_state, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout); quint32 keycode = event->nativeScanCode(); + // handle shortcuts for level three and above + xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(kb_state, keycode); + xkb_level_index_t levelIndex = 0; + if (layoutIndex != XKB_LAYOUT_INVALID) { + levelIndex = xkb_state_key_get_level(kb_state, keycode, layoutIndex); + if (levelIndex == XKB_LEVEL_INVALID) + levelIndex = 0; + } + if (levelIndex <= 1) + xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout); + xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, keycode); if (sym == XKB_KEY_NoSymbol) { xkb_state_unref(kb_state); From 7a8330ddf7601608346036e2f120a4497e016ee8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Jun 2016 14:18:33 +0200 Subject: [PATCH 06/28] Fix QDockWidget losing decoration on undocking when GroupedDragging is enabled We should not remember the wrong undocked geometry. If the dockwidget is not floating, the geometry is not relative to the global coordinate, it makes no sense to store it. Task-number: QTBUG-53808 Change-Id: I242467d8da62d7c787eca2c784aeec646236cb44 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qdockwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index a7e04d3bfc9..20f35cb2112 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -805,7 +805,8 @@ void QDockWidgetPrivate::endDrag(bool abort) } else { setResizerActive(false); } - undockedGeometry = q->geometry(); + if (q->isFloating()) // Might not be floating when dragging a QDockWidgetGroupWindow + undockedGeometry = q->geometry(); q->activateWindow(); } else { // The tab was not plugged back in the QMainWindow but the QDockWidget cannot From faeaddc1b92f1000a5a1d9d7cdea9276bdfefe26 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 15 Jun 2016 10:01:14 +0200 Subject: [PATCH 07/28] QSslSocket::transmit (macOS/iOS) - do not use invalid context 1. QSslSocketBackendPrivate::transmit can invalidate SSL context causing subsequent SSLWrite or SSLRead calls to fail; these report errSecParam (as null context is an invalid parameter) spuriously, when we should rather report the cause of invalidation. The OpenSSL backend can trigger this when it aborts connection during an SSL handshake, on an sslErrors signal. As transmit() emits readReady(), a directly connected slot can trigger the same problem if it aborts or closes. 2. If during peer verification (and in checkSslErrors) we disconnect on sslErrors signal, peer verification must be considered failed and should not continue handshake/set connectionEncrypted. Task-number: QTBUG-52975 Task-number: QTBUG-53906 Change-Id: Iacd3b489a4156e25ef3460ace40d21f34a946bed Reviewed-by: Edward Welbourne --- src/network/ssl/qsslsocket_mac.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 4e090f96cbd..9f0359aa470 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -634,7 +634,7 @@ void QSslSocketBackendPrivate::transmit() if (connectionEncrypted && !writeBuffer.isEmpty()) { qint64 totalBytesWritten = 0; - while (writeBuffer.nextDataBlockSize() > 0) { + while (writeBuffer.nextDataBlockSize() > 0 && context) { const size_t nextDataBlockSize = writeBuffer.nextDataBlockSize(); size_t writtenBytes = 0; const OSStatus err = SSLWrite(context, writeBuffer.readPointer(), nextDataBlockSize, &writtenBytes); @@ -668,7 +668,7 @@ void QSslSocketBackendPrivate::transmit() if (connectionEncrypted) { QVarLengthArray data; - while (true) { + while (context) { size_t readBytes = 0; data.resize(4096); const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes); @@ -1305,7 +1305,10 @@ bool QSslSocketBackendPrivate::verifyPeerTrust() // report errors if (!errors.isEmpty() && !canIgnoreVerify) { sslErrors = errors; - if (!checkSslErrors()) + // checkSslErrors unconditionally emits sslErrors: + // a user's slot can abort/close/disconnect on this + // signal, so we also test the socket's state: + if (!checkSslErrors() || q->state() != QAbstractSocket::ConnectedState) return false; } else { sslErrors.clear(); From ed32af3506c42689001d9b7267897405c02d3c39 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 30 Jun 2016 10:16:35 +0200 Subject: [PATCH 08/28] winrt: fix conditional Seems the previous check was a leftover from debugging. Tests still pass and loop checks properly now. Change-Id: Ic12cd49881f6d146687e257794b3028f6c8e874c Reviewed-by: Friedemann Kleint --- src/corelib/io/qsettings_winrt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 02c3c7624e9..85ef64cbd46 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -86,7 +86,7 @@ static IApplicationDataContainer *subContainer(IApplicationDataContainer *parent if (FAILED(hr)) return 0; - while (SUCCEEDED(S_OK) && current) { + while (SUCCEEDED(hr) && current) { ComPtr item; hr = iterator->get_Current(&item); if (FAILED(hr)) From dfd62a8f36a6461c3f3cad390c8a243829bea0e4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 30 Jun 2016 10:04:07 +0200 Subject: [PATCH 09/28] winrt: Clean up function signature Change-Id: I006d4a2295103c8e4169945dfb451ee55598ec87 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/winrt/qwinrtdrag.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp index 2ef50aa4e20..055aacbf569 100644 --- a/src/plugins/platforms/winrt/qwinrtdrag.cpp +++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp @@ -504,8 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA class QtDragEventHandler##name : public IDragEventHandler \ { \ public: \ - virtual HRESULT STDMETHODCALLTYPE Invoke(IInspectable *sender, \ - ABI::Windows::UI::Xaml::IDragEventArgs *e) \ + STDMETHODIMP Invoke(IInspectable *sender, \ + ABI::Windows::UI::Xaml::IDragEventArgs *e) \ { \ return qt_##func(sender, e);\ } \ From f3df265a38b1ee7b8dab918d669d9bb721f38f74 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 14 Jun 2016 12:26:29 +0200 Subject: [PATCH 10/28] QDateTime: early return to make a Q_UNREACHABLE actually true. It could be reached when QT_BOOTSTRAPPED was defined. Change-Id: I632d6f908a3bcbde81a6ebbadcaf2800dfe1449d Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 1719d7f4708..fb679e56c53 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2698,7 +2698,7 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const case Qt::TimeZone: #ifdef QT_BOOTSTRAPPED - break; + return 0; #else return zoneMSecsToEpochMSecs(m_msecs, m_timeZone); #endif From c376e3fbf0cbeb60be9db8903f9a2998b8311ed6 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 27 Jun 2016 18:52:30 +0300 Subject: [PATCH 11/28] QDir: Remove redundant QString wrapping Change-Id: I8368b137d15509cdec575a17f5dae3c0c343400f Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qdir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index d0527282b5f..30047115710 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -686,7 +686,7 @@ QString QDir::filePath(const QString &fileName) const { const QDirPrivate* d = d_ptr.constData(); if (isAbsolutePath(fileName)) - return QString(fileName); + return fileName; QString ret = d->dirEntry.filePath(); if (!fileName.isEmpty()) { From 25db59d7723c3d05ff55104768da31b0a7ce68ee Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Jun 2016 08:48:52 +0200 Subject: [PATCH 12/28] Fix QLineEdit not showing clear button on macOS Restore code path returning the resource pixmap for platforms that do not have themes in QCommonStyle. Amends change b657496a0ba326af0688e9935069139c002849cf. Task-number: QTBUG-54425 Change-Id: I764408622b825b86afbe7ccf37e1498d3efb3850 Reviewed-by: Timur Pocheptsov --- src/widgets/styles/qcommonstyle.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7b0d8eacd5c..6bf9d20b47d 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5194,6 +5194,13 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm) return result; } +#ifndef QT_NO_IMAGEFORMAT_PNG +static inline QString clearText16IconPath() +{ + return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"); +} +#endif // !QT_NO_IMAGEFORMAT_PNG + static QIcon clearTextIcon(bool rtl) { const QString directionalThemeName = rtl @@ -5206,7 +5213,7 @@ static QIcon clearTextIcon(bool rtl) QIcon icon; #ifndef QT_NO_IMAGEFORMAT_PNG - QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png")); + QPixmap clearText16(clearText16IconPath()); Q_ASSERT(!clearText16.size().isEmpty()); icon.addPixmap(clearText16); QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png")); @@ -5521,6 +5528,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); case SP_MediaVolumeMuted: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); + case SP_LineEditClearButton: + return QPixmap(clearText16IconPath()); #endif // QT_NO_IMAGEFORMAT_PNG default: break; From d0055e9fd7825f9033b26f9aa421e218e44dadde Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 30 Jun 2016 14:13:48 +0200 Subject: [PATCH 13/28] nuke dead expandVariableReferences() overload prototype Change-Id: I0c6fceac0b984e4613932b8507a632dd83d0e79b Reviewed-by: Joerg Bornemann --- qmake/library/qmakeevaluator.h | 1 - 1 file changed, 1 deletion(-) diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index 9560f715875..312f1385fb5 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -182,7 +182,6 @@ public: void setTemplate(); ProStringList split_value_list(const QString &vals, const ProFile *source = 0); - ProStringList expandVariableReferences(const ProString &value, int *pos = 0, bool joined = false); ProStringList expandVariableReferences(const ushort *&tokPtr, int sizeHint = 0, bool joined = false); QString currentFileName() const; From 1e662ff1666f0a47eed84ae9e6bc02869aa19f9b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 1 Jul 2016 08:29:08 +0200 Subject: [PATCH 14/28] winrt: Set minimum SDK version to 10586 10586 reflects Update 1, which is the mininum supported version for many months, hence reflext this in the manifest template as well. There are additional features (like drag and drop) which require and even later SDK version. However, they do not reflect the minimum. Change-Id: I6d71dc499c928ed98c8a25283e0b53994317bb00 Reviewed-by: Friedemann Kleint --- .../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in | 2 +- 1 file changed, 1 insertion(+), 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 c25d7b77af7..fc6bfcebcfd 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,7 @@ - $${WINRT_MANIFEST.dependencies} + $${WINRT_MANIFEST.dependencies} From 890edc45d897639f0ef99a561ea033d6ae5781e7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 5 Jun 2016 20:57:38 +0200 Subject: [PATCH 15/28] QSslSocket: improve documentation of the supported protocols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) To describe a protocol version we should use an "ordinary" name, not use the values out of the QSsl::SslProtocol enum. 2) Say that we support the latest stable TLS version (1.2, not 1.0). 3) Fix a statement about which protocol is the default one. Change-Id: I18732914d55060a0c3920f7082f986c262a71ded Reviewed-by: André Klitzing Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 25a471dda8f..c4536062628 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -49,7 +49,8 @@ QSslSocket establishes a secure, encrypted TCP connection you can use for transmitting encrypted data. It can operate in both client and server mode, and it supports modern SSL protocols, including - SSLv3 and TLSv1_0. By default, QSslSocket uses TLSv1_0, but you can + SSL 3 and TLS 1.2. By default, QSslSocket uses only SSL protocols + which are considered to be secure (QSsl::SecureProtocols), but you can change the SSL protocol by calling setProtocol() as long as you do it before the handshake has started. From cc42979e4653f8fc543b6968c9ff08f4356fa724 Mon Sep 17 00:00:00 2001 From: Ralf Nolden Date: Wed, 29 Jun 2016 11:54:33 +0200 Subject: [PATCH 16/28] NetBSD: add QMAKE_RPATHDIR for standard QMAKE_LIBDIR NetBSD is heavily dependent on using rpath, so we need to add the lib dir QMAKE_LIBDIR and QMAKE_LIBDIR_X11 to QMAKE_RPATHDIR explicitly to avoid linker errors. See http://www.netbsd.org/docs/elf.html for more info. Change-Id: I225143d5e2d9a125060b14e3a8a7953927d63b33 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- mkspecs/netbsd-g++/qmake.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkspecs/netbsd-g++/qmake.conf b/mkspecs/netbsd-g++/qmake.conf index 31005d9134b..a4b26837cea 100644 --- a/mkspecs/netbsd-g++/qmake.conf +++ b/mkspecs/netbsd-g++/qmake.conf @@ -17,6 +17,9 @@ QMAKE_LIBDIR_X11 = /usr/X11R7/lib QMAKE_INCDIR_OPENGL = /usr/X11R7/include QMAKE_LIBDIR_OPENGL = /usr/X11R7/lib +# NetBSD requires rpath to be used for all lib dirs, see http://www.netbsd.org/docs/elf.html +QMAKE_RPATHDIR += $$QMAKE_LIBDIR $$QMAKE_LIBDIR_X11 + include(../common/gcc-base-unix.conf) include(../common/g++-unix.conf) load(qt_config) From c3f645a24ac743e66f4345058983ad877f723a14 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 23 Jun 2016 09:44:58 +0200 Subject: [PATCH 17/28] Windows: Add support for the PdmDevicePixelRatioScaled metric Change-Id: If65018a86e386a54f40ee12e81b5137e3412d655 Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw --- src/printsupport/kernel/qprintengine_win.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 00a8ca7c982..a9d316095c4 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -388,6 +388,9 @@ int QWin32PrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const case QPaintDevice::PdmDevicePixelRatio: val = 1; break; + case QPaintDevice::PdmDevicePixelRatioScaled: + val = 1 * QPaintDevice::devicePixelRatioFScale(); + break; default: qWarning("QPrinter::metric: Invalid metric command"); return 0; From 9964b850ad9c322ab842bbd5941976b3d613f5f6 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 30 May 2016 16:57:00 +0200 Subject: [PATCH 18/28] Doc: Improve QJsonDocument::fromJson documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be explicit on how to check whether parsing succeeds. Change-Id: I44f408cb6e5a830826b84dfb3a8af331f03e58cc Reviewed-by: Topi Reiniö --- src/corelib/json/qjsondocument.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index 5f8f807cf0b..7af7e4080c7 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -351,16 +351,14 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const #endif /*! - Parses a UTF-8 encoded JSON document and creates a QJsonDocument + Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it. - \a json contains the json document to be parsed. + Returns a valid (non-null) QJsonDocument if the parsing succeeds. If it fails, + the returned document will be null, and the optional \a error variable will contain + further details about the error. - The optional \a error variable can be used to pass in a QJsonParseError data - structure that will contain information about possible errors encountered during - parsing. - - \sa toJson(), QJsonParseError + \sa toJson(), QJsonParseError, isNull() */ QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) { From 1af4916e11c1251b2957a909f819678e9fd32feb Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 1 Jul 2016 13:49:46 +0200 Subject: [PATCH 19/28] QTime: restore Qt3 compatibility in the QDataStream operators A Qt5 program writing a null QTime() using setVersion(QDataStream::Qt_3_3), and then a Qt3 program reading that, would lead to a weird QTime, with isNull=false, isValid=false, hour=1193, minute=2, second=47, ms=295. This commit restores interoperability, by writing out the expected value (0) for a null QTime rather than the -1 value used by Qt4 and Qt5. Change-Id: Icde468a8f6fc9434ef7018296725819b44d672af Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.cpp | 14 ++++++++-- .../io/qdatastream/tst_qdatastream.cpp | 27 ++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index fb679e56c53..e6d0b978361 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4759,7 +4759,12 @@ QDataStream &operator>>(QDataStream &in, QDate &date) QDataStream &operator<<(QDataStream &out, const QTime &time) { - return out << quint32(time.mds); + if (out.version() >= QDataStream::Qt_4_0) { + return out << quint32(time.mds); + } else { + // Qt3 had no support for reading -1, QTime() was valid and serialized as 0 + return out << quint32(time.isNull() ? 0 : time.mds); + } } /*! @@ -4774,7 +4779,12 @@ QDataStream &operator>>(QDataStream &in, QTime &time) { quint32 ds; in >> ds; - time.mds = int(ds); + if (in.version() >= QDataStream::Qt_4_0) { + time.mds = int(ds); + } else { + // Qt3 would write 0 for a null time + time.mds = (ds == 0) ? QTime::NullTime : int(ds); + } return in; } diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index 86fd1420362..76650ea9a48 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -1203,10 +1203,11 @@ static QTime qTimeData(int index) case 57: return QTime(23, 59, 59, 99); case 58: return QTime(23, 59, 59, 100); case 59: return QTime(23, 59, 59, 999); + case 60: return QTime(); } return QTime(0, 0, 0); } -#define MAX_QTIME_DATA 60 +#define MAX_QTIME_DATA 61 void tst_QDataStream::stream_QTime_data() { @@ -3081,6 +3082,30 @@ void tst_QDataStream::compatibility_Qt3() QVERIFY(in_palette.brush(QPalette::Button).style() == Qt::NoBrush); QVERIFY(in_palette.color(QPalette::Light) == Qt::green); } + // QTime() was serialized to (0, 0, 0, 0) in Qt3, not (0xFF, 0xFF, 0xFF, 0xFF) + // This is because in Qt3 a null time was valid, and there was no support for deserializing a value of -1. + { + QByteArray stream; + { + QDataStream out(&stream, QIODevice::WriteOnly); + out.setVersion(QDataStream::Qt_3_3); + out << QTime(); + } + QTime in_time; + { + QDataStream in(stream); + in.setVersion(QDataStream::Qt_3_3); + in >> in_time; + } + QVERIFY(in_time.isNull()); + + quint32 rawValue; + QDataStream in(stream); + in.setVersion(QDataStream::Qt_3_3); + in >> rawValue; + QCOMPARE(rawValue, quint32(0)); + } + } void tst_QDataStream::compatibility_Qt2() From 3d621af54be7b34e6cc6357b48c4d15f911937ee Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Sun, 15 May 2016 16:56:40 +0200 Subject: [PATCH 20/28] xcb: Send also "text/plain" when a "text/uri-list" is dropped. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow dropping of files from Qt applications to applications like Skype, which only accept "text/plain", but not "text/uri-list" or "text/x-moz-url". Task-number: QTBUG-53238 Change-Id: I01bca5c8e20647cedfc9323f542ab07f0cc48658 Reviewed-by: Dmitry Shachnev Reviewed-by: Błażej Szczygieł Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbmime.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index 7fea0688cc7..cc90da385cd 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -125,6 +125,11 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa ret = true; } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { ret = true; + } else if (atomName == QLatin1String("text/plain") + && mimeData->hasFormat(QLatin1String("text/uri-list"))) { + // Return URLs also as plain text. + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + ret = true; } return ret; } @@ -143,8 +148,10 @@ QVector QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con } // special cases for uris - if (format == QLatin1String("text/uri-list")) + if (format == QLatin1String("text/uri-list")) { atoms.append(connection->internAtom("text/x-moz-url")); + atoms.append(connection->internAtom("text/plain")); + } //special cases for images if (format == QLatin1String("image/ppm")) From 27df6cb32d42c0a4475fc2d11b4c9d53d19fe394 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 27 Jun 2016 14:12:54 +0200 Subject: [PATCH 21/28] Fix the QMainWindow context menu when there are floating tabs If QMainWindow::GroupedDragging is enabled and there are QDockWidgetGroupWindow, we should still show actions for these QDockWidgets in the context menu Addresses point 4. of QTBUG-52108 Task-number: QTBUG-52108 Change-Id: I11ae401c4fe15e213b0f26e7579634e2062e953c Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmainwindow.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 1698ca15195..7a9a077e5f7 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1717,10 +1717,20 @@ QMenu *QMainWindow::createPopupMenu() menu = new QMenu(this); for (int i = 0; i < dockwidgets.size(); ++i) { QDockWidget *dockWidget = dockwidgets.at(i); - if (dockWidget->parentWidget() == this - && !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) { - menu->addAction(dockwidgets.at(i)->toggleViewAction()); + // filter to find out if we own this QDockWidget + if (dockWidget->parentWidget() == this) { + if (d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) + continue; + } else if (QDockWidgetGroupWindow *dwgw = + qobject_cast(dockWidget->parentWidget())) { + if (dwgw->parentWidget() != this) + continue; + if (dwgw->layoutInfo()->indexOf(dockWidget).isEmpty()) + continue; + } else { + continue; } + menu->addAction(dockwidgets.at(i)->toggleViewAction()); } menu->addSeparator(); } From 9cb8ca2b5532c7a4bfb175cbe16fd5680d913822 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 24 Jun 2016 15:49:28 +0200 Subject: [PATCH 22/28] Allow to drag a QDockWidgetGroupWindow into one of its QDockWidget This fixes the 2. of QTBUG-52108 Change-Id: Id887f470c7822f6b264d6b739e8658d9809f6609 Task-numer: QTBUG-52108 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmainwindowlayout.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 8dc12d853e8..6b247d8d110 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2366,13 +2366,10 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) QWidget *w = qobject_cast(c); if (!w) continue; - if (w == widget) - continue; - if (!w->isTopLevel() || !w->isVisible() || w->isMinimized()) - continue; if (!qobject_cast(w) && !qobject_cast(w)) continue; - candidates << w; + if (w != widget && w->isTopLevel() && w->isVisible() && !w->isMinimized()) + candidates << w; if (QDockWidgetGroupWindow *group = qobject_cast(w)) { // Sometimes, there are floating QDockWidget that have a QDockWidgetGroupWindow as a parent. foreach (QObject *c, group->children()) { From cf9b445ed471451cd581962887c6fd503cd2bf25 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 30 May 2016 10:30:35 -0300 Subject: [PATCH 23/28] Fix the naming of an LLVM tool in common/clang.conf Probably was copied from the gcc equivalent. Change-Id: I87e17314d8b24ae983b1fffd14535b9d7f616a1b Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- mkspecs/common/clang.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/clang.conf b/mkspecs/common/clang.conf index ee9c1b83715..e003b947aab 100644 --- a/mkspecs/common/clang.conf +++ b/mkspecs/common/clang.conf @@ -40,5 +40,5 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG # Wrapper tools that understand .o/.a files with LLVM bytecode instead of machine code QMAKE_AR_LTCG = llvm-ar cqs -QMAKE_NM_LTCG = gcc-nm -P +QMAKE_NM_LTCG = llvm-nm -P QMAKE_RANLIB_LTCG = true # No need to run, since llvm-ar has "s" From 4f3eb6617331ba2634206064512ae68a4fbd793e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 30 Jun 2016 15:48:52 -0700 Subject: [PATCH 24/28] QUrl: Test that we do correctly accept valid schemes ... and reject invalid ones. There was one error: we accepted schemes starting with pluses, dashes and dots. Change-Id: Ie585843cfb684bc3b6e3fffd145cfe12227ec4ad Reviewed-by: David Faure --- src/corelib/io/qurl.cpp | 10 +- tests/auto/corelib/io/qurl/tst_qurl.cpp | 156 ++++++++++++++---------- 2 files changed, 98 insertions(+), 68 deletions(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index fb2f4ba9183..2672de24f2c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -978,10 +978,12 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro needsLowercasing = i; continue; } - if (p[i] >= '0' && p[i] <= '9' && i > 0) - continue; - if (p[i] == '+' || p[i] == '-' || p[i] == '.') - continue; + if (i) { + if (p[i] >= '0' && p[i] <= '9') + continue; + if (p[i] == '+' || p[i] == '-' || p[i] == '.') + continue; + } // found something else // don't call setError needlessly: diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index ef210d4a644..eb29646053a 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -125,7 +125,8 @@ private slots: void isValid(); void schemeValidator_data(); void schemeValidator(); - void invalidSchemeValidator(); + void setScheme_data(); + void setScheme(); void strictParser_data(); void strictParser(); void tolerantParser(); @@ -2082,85 +2083,112 @@ void tst_QUrl::isValid() void tst_QUrl::schemeValidator_data() { - QTest::addColumn("encodedUrl"); + QTest::addColumn("input"); QTest::addColumn("result"); - QTest::addColumn("toString"); + QTest::addColumn("scheme"); - QTest::newRow("empty") << QByteArray() << false << QString(); + // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) - // ftp - QTest::newRow("ftp:") << QByteArray("ftp:") << true << QString("ftp:"); - QTest::newRow("ftp://ftp.qt-project.org") - << QByteArray("ftp://ftp.qt-project.org") - << true << QString("ftp://ftp.qt-project.org"); - QTest::newRow("ftp://ftp.qt-project.org/") - << QByteArray("ftp://ftp.qt-project.org/") - << true << QString("ftp://ftp.qt-project.org/"); - QTest::newRow("ftp:/index.html") - << QByteArray("ftp:/index.html") - << false << QString(); + QTest::newRow("empty") << QString() << false << QString(); - // mailto - QTest::newRow("mailto:") << QByteArray("mailto:") << true << QString("mailto:"); - QTest::newRow("mailto://smtp.trolltech.com/ole@bull.name") - << QByteArray("mailto://smtp.trolltech.com/ole@bull.name") << false << QString(); - QTest::newRow("mailto:") << QByteArray("mailto:") << true << QString("mailto:"); - QTest::newRow("mailto:ole@bull.name") - << QByteArray("mailto:ole@bull.name") << true << QString("mailto:ole@bull.name"); + // uncontroversial ones + QTest::newRow("ftp") << "ftp://ftp.example.com/" << true << "ftp"; + QTest::newRow("http") << "http://www.example.com/" << true << "http"; + QTest::newRow("mailto") << "mailto:smith@example.com" << true << "mailto"; + QTest::newRow("file-1slash") << "file:/etc/passwd" << true << "file"; + QTest::newRow("file-2slashes") << "file://server/etc/passwd" << true << "file"; + QTest::newRow("file-3slashes") << "file:///etc/passwd" << true << "file"; - // file - QTest::newRow("file:") << QByteArray("file:/etc/passwd") << true << QString("file:///etc/passwd"); + QTest::newRow("mailto+subject") << "mailto:smith@example.com?subject=Hello%20World" << true << "mailto"; + QTest::newRow("mailto+host") << "mailto://smtp.example.com/smith@example.com" << true << "mailto"; + + // valid, but unexpected + QTest::newRow("ftp-nohost") << "ftp:/etc/passwd" << true << "ftp"; + QTest::newRow("http-nohost") << "http:/etc/passwd" << true << "http"; + QTest::newRow("mailto-nomail") << "mailto://smtp.example.com" << true << "mailto"; + + // schemes with numbers + QTest::newRow("digits") << "proto2://" << true << "proto2"; + + // schemes with dots, dashes, and pluses + QTest::newRow("svn+ssh") << "svn+ssh://svn.example.com" << true << "svn+ssh"; + QTest::newRow("withdash") << "svn-ssh://svn.example.com" << true << "svn-ssh"; + QTest::newRow("withdots") << "org.qt-project://qt-project.org" << true << "org.qt-project"; + + // lowercasing + QTest::newRow("FTP") << "FTP://ftp.example.com/" << true << "ftp"; + QTest::newRow("HTTP") << "HTTP://www.example.com/" << true << "http"; + QTest::newRow("MAILTO") << "MAILTO:smith@example.com" << true << "mailto"; + QTest::newRow("FILE") << "FILE:/etc/passwd" << true << "file"; + QTest::newRow("SVN+SSH") << "SVN+SSH://svn.example.com" << true << "svn+ssh"; + QTest::newRow("WITHDASH") << "SVN-SSH://svn.example.com" << true << "svn-ssh"; + QTest::newRow("WITHDOTS") << "ORG.QT-PROJECT://qt-project.org" << true << "org.qt-project"; + + // invalid entries + QTest::newRow("start-digit") << "1http://example.com" << false << "1http"; + QTest::newRow("start-plus") << "+ssh://user@example.com" << false << "+ssh"; + QTest::newRow("start-dot") << ".org.example:///" << false << ".org.example"; + QTest::newRow("with-space") << "a b://" << false << "a b"; + QTest::newRow("with-non-ascii") << "\304\245\305\243\305\245\321\200://example.com" << false << "\304\245\305\243\305\245\321\200"; + QTest::newRow("with-control1") << "http\1://example.com" << false << "http\1"; + QTest::newRow("with-control127") << "http\177://example.com" << false << "http\177"; + QTest::newRow("with-null") << QString::fromLatin1("http\0://example.com", 19) << false << QString::fromLatin1("http\0", 5); + + QTest::newRow("percent-encoded") << "%68%74%%74%70://example.com" << false << "%68%74%%74%70"; + + static const char controls[] = "!\"$&'()*,;<=>[\\]^_`{|}~"; + for (size_t i = 0; i < sizeof(controls) - 1; ++i) + QTest::newRow(("with-" + QByteArray(1, controls[i])).constData()) + << QString("pre%1post://example.com/").arg(QLatin1Char(controls[i])) + << false << QString("pre%1post").arg(QLatin1Char(controls[i])); } void tst_QUrl::schemeValidator() { - QFETCH(QByteArray, encodedUrl); + QFETCH(QString, input); QFETCH(bool, result); - QFETCH(QString, toString); - QUrl url = QUrl::fromEncoded(encodedUrl); - QEXPECT_FAIL("ftp:/index.html", "high-level URL validation not reimplemented yet", Abort); - QEXPECT_FAIL("mailto://smtp.trolltech.com/ole@bull.name", "high-level URL validation not reimplemented yet", Abort); + QUrl url(input); QCOMPARE(url.isValid(), result); - if (!result) + if (result) { + QFETCH(QString, scheme); + QCOMPARE(url.scheme(), scheme); + + // reconstruct with just the scheme: + url.setUrl(scheme + ':'); + QVERIFY(url.isValid()); + QCOMPARE(url.scheme(), scheme); + } else { QVERIFY(url.toString().isEmpty()); + } } -void tst_QUrl::invalidSchemeValidator() +void tst_QUrl::setScheme_data() { - // test that if scheme does not start with an ALPHA, QUrl::isValid() returns false - { - QUrl url("1http://qt-project.org"); - QVERIFY(url.scheme().isEmpty()); - QVERIFY(url.path().startsWith("1http")); - } - { - QUrl url("http://qt-project.org"); - url.setScheme("111http://qt-project.org"); - QCOMPARE(url.isValid(), false); - QVERIFY(url.toString().isEmpty()); - } - // non-ALPHA character at other positions in the scheme are ok - { - QUrl url("ht111tp://qt-project.org", QUrl::StrictMode); - QVERIFY(url.isValid()); - QCOMPARE(url.scheme(), QString("ht111tp")); - QVERIFY(!url.toString().isEmpty()); - } - { - QUrl url("http://qt-project.org"); - url.setScheme("ht123tp://qt-project.org"); - QVERIFY(!url.isValid()); - QVERIFY(url.toString().isEmpty()); - url.setScheme("http"); - QVERIFY(url.isValid()); - QVERIFY(!url.toString().isEmpty()); - } - { - QUrl url = QUrl::fromEncoded("ht321tp://qt-project.org", QUrl::StrictMode); - QVERIFY(url.isValid()); - QVERIFY(!url.toString().isEmpty()); - } + schemeValidator_data(); + + // a couple more which wouldn't work in parsing a full URL + QTest::newRow("with-slash") << QString() << false << "http/"; + QTest::newRow("with-question") << QString() << false << "http?"; + QTest::newRow("with-hash") << QString() << false << "http#"; +} + +void tst_QUrl::setScheme() +{ + QFETCH(QString, scheme); + QFETCH(bool, result); + QString expectedScheme; + if (result) + expectedScheme = scheme; + + QUrl url; + url.setScheme(scheme); + QCOMPARE(url.isValid(), result); + QCOMPARE(url.scheme(), expectedScheme); + + url.setScheme(scheme.toUpper()); + QCOMPARE(url.isValid(), result); + QCOMPARE(url.scheme(), expectedScheme); } void tst_QUrl::strictParser_data() From 946c1a578a7c1e6acc95ef8095fa8a6ff026334b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 14 Jun 2016 07:49:13 -0700 Subject: [PATCH 25/28] Fix build: ftok(3) requires sys/ipc.h Task-number: QTBUG-54069 Change-Id: Ib57b52598e2f452985e9fffd1457fa9c7ad3bac0 Reviewed-by: Giuseppe D'Angelo --- src/corelib/kernel/qcore_unix_p.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 05711354ffa..07725b8cd21 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -72,6 +72,10 @@ #include #include +#if !defined(QT_POSIX_IPC) && !defined(QT_NO_SHAREDMEMORY) && !defined(Q_OS_ANDROID) +# include +#endif + #if defined(Q_OS_VXWORKS) # include #endif From 3b5db8f3a6663fd65d74da875a6d22c430c2e4f7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 1 Jul 2016 17:49:26 -0700 Subject: [PATCH 26/28] Examples: Fix stringification of the Qt version (QT_VERSION % 0xffff00) is useless for now, as QT_VERSION < 0x1000000 (for now). The author of this code probably meant to use bitwise-AND. But even that is unnecessary as the right shift discards the lower 8 bits anyway. Change-Id: Ie585843cfb684bc3b6e3fffd145d533b05288dfc Reviewed-by: Olivier Goffart (Woboq GmbH) --- examples/network/torrent/connectionmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/torrent/connectionmanager.cpp b/examples/network/torrent/connectionmanager.cpp index fa102517490..0e15c226b8e 100644 --- a/examples/network/torrent/connectionmanager.cpp +++ b/examples/network/torrent/connectionmanager.cpp @@ -78,7 +78,7 @@ QByteArray ConnectionManager::clientId() const // Generate peer id int startupTime = int(QDateTime::currentDateTime().toTime_t()); - id += QString::asprintf("-QT%04x-", (QT_VERSION % 0xffff00) >> 8).toLatin1(); + id += QString::asprintf("-QT%04x-", QT_VERSION >> 8).toLatin1(); id += QByteArray::number(startupTime, 10); id += QByteArray(20 - id.size(), '-'); } From daade9b90dd39aa844cb683af776b802b0786ba7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 16 Jun 2016 11:56:42 +0200 Subject: [PATCH 27/28] QEventLoop: better describe the exception safety of Qt 1) In general it's unsafe to let exceptions propagate through Qt code, so document that. 2) Add a note that overriding notify() makes sense only in Qt 5, in Qt 6 it's going away. 3) The advice applies also to applications not using QApplication, but just QCoreApplication. Change-Id: I4f6e74c53da757faf2eeaa9de226ceba55c52536 Reviewed-by: Thiago Macieira Reviewed-by: Martin Smith --- src/corelib/kernel/qeventloop.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp index dca25ce968a..0ee677d213f 100644 --- a/src/corelib/kernel/qeventloop.cpp +++ b/src/corelib/kernel/qeventloop.cpp @@ -182,8 +182,10 @@ int QEventLoop::exec(ProcessEventsFlags flags) { if (exceptionCaught) { qWarning("Qt has caught an exception thrown from an event handler. Throwing\n" - "exceptions from an event handler is not supported in Qt. You must\n" - "reimplement QApplication::notify() and catch all exceptions there.\n"); + "exceptions from an event handler is not supported in Qt.\n" + "You must not let any exception whatsoever propagate through Qt code.\n" + "If that is not possible, in Qt 5 you must at least reimplement\n" + "QCoreApplication::notify() and catch all exceptions there.\n"); } locker.relock(); QEventLoop *eventLoop = d->threadData->eventLoops.pop(); From b7744e0b05255fc468db2af215ba94eca4b7757b Mon Sep 17 00:00:00 2001 From: Ralf Nolden Date: Fri, 1 Jul 2016 10:33:43 +0200 Subject: [PATCH 28/28] Replace LLINDEX macro not present on all BSDs with the code FreeBSD < 10 doesn't have the LLINDEX macro either in net/if_dl.h, so besides OpenBSD yet another condition to declare the LLINDEX macro for systems where it isn't present does make it more complicated than replacing its usage with the actual code. Change-Id: I7e8ef3e265564526e05ec3115f9fa765d399f045 Reviewed-by: Thiago Macieira --- src/network/socket/qnativesocketengine_unix.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index e92123e10cc..5dfc6480da1 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -906,10 +906,7 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVIF && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sockaddr_dl))) { sockaddr_dl *sdl = reinterpret_cast(CMSG_DATA(cmsgptr)); -# if defined(Q_OS_OPENBSD) -# define LLINDEX(s) ((s)->sdl_index) -# endif - header->ifindex = LLINDEX(sdl); + header->ifindex = sdl->sdl_index; } # endif #endif