From f72152381b37740e65f174e175306d21c7616549 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 13 Oct 2015 21:48:08 +0200 Subject: tst_QStringBuilder: add a check for self-assignment Change-Id: I78094146bf534163af12d6e265276d987d5ce994 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp index e3b25c4c81..777fd5392c 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp @@ -93,6 +93,11 @@ void runScenario() r = special + string; QCOMPARE(r, QString(special P string)); + // self-assignment: + r = stringref.toString(); + r = achar + r; + QCOMPARE(r, QString(achar P stringref)); + #ifdef Q_COMPILER_UNICODE_STRINGS r = QStringLiteral(UNICODE_LITERAL); r = r Q QStringLiteral(UNICODE_LITERAL); -- cgit v1.2.3 From 2b09d371eb7d9f3e903603a94efdafa1e650a85b Mon Sep 17 00:00:00 2001 From: Rolland Dudemaine Date: Thu, 24 Mar 2016 11:02:27 +0100 Subject: Resolve build failure in network stress tests. strncmp() needs 3 arguments, not 2. Change-Id: Ia7077108a533321d5218cc35fd78ada8863f8200 Reviewed-by: Oswald Buddenhagen --- .../manual/network_remote_stresstest/tst_network_remote_stresstest.cpp | 2 +- tests/manual/network_stresstest/tst_network_stresstest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp index 486c5179b7..6767c8b153 100644 --- a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp +++ b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp @@ -144,7 +144,7 @@ void tst_NetworkRemoteStressTest::init() { // clear the internal cache #ifndef QT_BUILD_INTERNAL - if (strncmp(QTest::currentTestFunction(), "nam") == 0) + if (strncmp(QTest::currentTestFunction(), "nam", 3) == 0) QSKIP("QNetworkAccessManager tests disabled"); #endif } diff --git a/tests/manual/network_stresstest/tst_network_stresstest.cpp b/tests/manual/network_stresstest/tst_network_stresstest.cpp index 72233bf938..ab9481534e 100644 --- a/tests/manual/network_stresstest/tst_network_stresstest.cpp +++ b/tests/manual/network_stresstest/tst_network_stresstest.cpp @@ -135,7 +135,7 @@ void tst_NetworkStressTest::init() { // clear the internal cache #ifndef QT_BUILD_INTERNAL - if (strncmp(QTest::currentTestFunction(), "nam") == 0) + if (strncmp(QTest::currentTestFunction(), "nam", 3) == 0) QSKIP("QNetworkAccessManager tests disabled"); #endif } -- cgit v1.2.3 From 5b17fb14282822de36efd924abff8e3555e2491f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 17 Mar 2016 10:01:25 +0100 Subject: Doc: Make the replacement functions for obsoleted functions explicit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3a4bd3b4fcfd253b63fe342da6e398a4aeaf6825 Reviewed-by: Topi Reiniö --- src/corelib/tools/qstring.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index cdf37cca07..10d3441d2c 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -5820,7 +5820,9 @@ QString QString::toUpper_helper(QString &str) } /*! - \obsolete Use asprintf(), arg() or QTextStream instead. + \obsolete + + Use asprintf(), arg() or QTextStream instead. */ QString &QString::sprintf(const char *cformat, ...) { @@ -5876,7 +5878,9 @@ QString QString::asprintf(const char *cformat, ...) } /*! - \obsolete Use vasprintf(), arg() or QTextStream instead. + \obsolete + + Use vasprintf(), arg() or QTextStream instead. */ QString &QString::vsprintf(const char *cformat, va_list ap) { @@ -10487,7 +10491,7 @@ float QStringRef::toFloat(bool *ok) const \obsolete \fn QString Qt::escape(const QString &plain) - \sa QString::toHtmlEscaped() + Use QString::toHtmlEscaped() instead. */ /*! -- cgit v1.2.3 From 7d1e6ca1998f6fd26795b1f9e408ccd7c7c0b558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20L=C3=B6sch?= Date: Thu, 31 Mar 2016 15:09:20 +0200 Subject: Limit URLs for proxy auto config to 2083 chars On Windows only URLs up to 2083 characters are supported, so longer URLs are truncated. Task-number: QTBUG-52271 Change-Id: I625e4d089df4d977d39e61e5831611e04260e729 Reviewed-by: Markus Goetz (Woboq GmbH) --- src/network/kernel/qnetworkproxy_win.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 9e571bfe7f..15ef7d7cee 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -590,8 +591,16 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro url.setScheme(QLatin1String("https")); } + QString urlQueryString = url.toString(); + if (urlQueryString.size() > 2083) { + // calls to WinHttpGetProxyForUrl with urls longer than 2083 characters + // fail with error code ERROR_INVALID_PARAMETER(87), so we truncate it + qWarning("Proxy query URL too long for windows API, try with truncated URL"); + urlQueryString = url.toString().left(2083); + } + bool getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, - (LPCWSTR)url.toString().utf16(), + (LPCWSTR)urlQueryString.utf16(), &sp->autoProxyOptions, &proxyInfo); DWORD getProxyError = GetLastError(); @@ -608,7 +617,7 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro sp->autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; sp->autoProxyOptions.lpszAutoConfigUrl = (LPCWSTR)sp->autoConfigUrl.utf16(); getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, - (LPCWSTR)url.toString().utf16(), + (LPCWSTR)urlQueryString.utf16(), &sp->autoProxyOptions, &proxyInfo); getProxyError = GetLastError(); @@ -621,7 +630,7 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro // But now we've to enable it (http://msdn.microsoft.com/en-us/library/aa383153%28v=VS.85%29.aspx) sp->autoProxyOptions.fAutoLogonIfChallenged = TRUE; getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, - (LPCWSTR)url.toString().utf16(), + (LPCWSTR)urlQueryString.utf16(), &sp->autoProxyOptions, &proxyInfo); getProxyError = GetLastError(); -- cgit v1.2.3 From 684ae5f7fecf005b4086e512332028eea737fa64 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Thu, 7 Apr 2016 08:02:52 +0300 Subject: Fix compiling examples with -no-sm There is access to session manager functions which are not present when building with -no-sm. Change-Id: I1c92b4a70f7adb56816877930fb9f55b04ff8940 Reviewed-by: Andy Shaw --- examples/widgets/mainwindows/application/mainwindow.cpp | 5 ++++- examples/widgets/mainwindows/application/mainwindow.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/widgets/mainwindows/application/mainwindow.cpp b/examples/widgets/mainwindows/application/mainwindow.cpp index 861b908189..7d97cfd7f0 100644 --- a/examples/widgets/mainwindows/application/mainwindow.cpp +++ b/examples/widgets/mainwindows/application/mainwindow.cpp @@ -59,9 +59,11 @@ MainWindow::MainWindow() connect(textEdit->document(), &QTextDocument::contentsChanged, this, &MainWindow::documentWasModified); +#ifndef QT_NO_SESSIONMANAGER QGuiApplication::setFallbackSessionManagementEnabled(false); connect(qApp, &QGuiApplication::commitDataRequest, this, &MainWindow::commitData); +#endif setCurrentFile(QString()); setUnifiedTitleAndToolBarOnMac(true); @@ -387,7 +389,7 @@ QString MainWindow::strippedName(const QString &fullFileName) return QFileInfo(fullFileName).fileName(); } //! [49] - +#ifndef QT_NO_SESSIONMANAGER void MainWindow::commitData(QSessionManager &manager) { if (manager.allowsInteraction()) { @@ -399,3 +401,4 @@ void MainWindow::commitData(QSessionManager &manager) save(); } } +#endif diff --git a/examples/widgets/mainwindows/application/mainwindow.h b/examples/widgets/mainwindows/application/mainwindow.h index 9712604125..690e8ebc32 100644 --- a/examples/widgets/mainwindows/application/mainwindow.h +++ b/examples/widgets/mainwindows/application/mainwindow.h @@ -70,7 +70,9 @@ private slots: bool saveAs(); void about(); void documentWasModified(); +#ifndef QT_NO_SESSIONMANAGER void commitData(QSessionManager &); +#endif private: void createActions(); -- cgit v1.2.3 From 34e0e908c896126138a95abdeba7456499d0fb68 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 17 Mar 2016 10:29:43 +0100 Subject: winrt: Add capabilities as specified by modules So far no capabilities (but internetClient for Windows 10) were added by default, which forced developers to always manually edit the WINRT_MANIFEST.capabilities(_device) property. This allowed to leave out non-required capabilities and keep the created manifest clean, examples being microphone for multimedia. However, this also breaks first user experience as deeper knowledge about this topic is required. Furthermore this is inconsistent with other platforms like Android, where all capabilities are set by default and developers need to edit the manifest manually in any case. With this change, modules can define the capability set to enable all features in the module. If developers want to disable some again, they need to adapt the generated manifest. From our experience this needs to be done in any case, latest at publishing stage when the store manipulates the manifest. Task-number: QTBUG-38802 Change-Id: I6d522268ee0afbfa00a30dbdd5e6ec9f415bebf3 Reviewed-by: Oswald Buddenhagen --- mkspecs/common/winrt_winphone/qmake.conf | 5 ++++- mkspecs/features/qt.prf | 9 +++++++++ mkspecs/features/qt_module_pris.prf | 4 ++++ mkspecs/features/winrt/package_manifest.prf | 11 ++++++++++- src/network/network.pro | 4 ++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/mkspecs/common/winrt_winphone/qmake.conf b/mkspecs/common/winrt_winphone/qmake.conf index a9450b0c32..b5e0c7cc71 100644 --- a/mkspecs/common/winrt_winphone/qmake.conf +++ b/mkspecs/common/winrt_winphone/qmake.conf @@ -9,7 +9,7 @@ include(../angle.conf) MAKEFILE_GENERATOR = MSBUILD QMAKE_COMPILER = msvc QMAKE_PLATFORM = winrt win32 -CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target package_manifest rtti +CONFIG = package_manifest $$CONFIG incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target rtti DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN \ QT_NO_PRINTER QT_NO_PRINTDIALOG # TODO: Remove when printing is re-enabled @@ -95,6 +95,9 @@ VCSOLUTION_EXTENSION = .sln VCPROJ_KEYWORD = Qt4VSv1.0 WINRT_ASSETS_PATH = $$PWD/assets +WINRT_MANIFEST.capabilities = defaults +WINRT_MANIFEST.capabilities_device = defaults + include(../msvc-base.conf) unset(MSC_VER) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 5cc176c2ae..75b84ff6aa 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -141,6 +141,15 @@ for(ever) { } } } + # Add capabilities as defined by modules used in the project + winrt { + MODULE_WINRT_CAPABILITIES = $$eval(QT.$${QTLIB}.winrt_capabilities) + !isEmpty(MODULE_WINRT_CAPABILITIES): \ + WINRT_MANIFEST.capabilities_default += $$MODULE_WINRT_CAPABILITIES + MODULE_WINRT_CAPABILITIES_DEVICE = $$eval(QT.$${QTLIB}.winrt_capabilities_device) + !isEmpty(MODULE_WINRT_CAPABILITIES_DEVICE): \ + WINRT_MANIFEST.capabilities_device_default += $$MODULE_WINRT_CAPABILITIES_DEVICE + } } !isEmpty(BAD_QT):error("Unknown module(s) in QT$$var_sfx: $$replace(BAD_QT, _private$, -private)") diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 9c45350543..4dd9e25f9f 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -104,6 +104,9 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri "QT.$${MODULE_ID}.DEFINES = $$val_escape(MODULE_DEFINES)" \ "" \ "QT_MODULES += $$MODULE" + winrt: MODULE_PRI_CONT += \ + "QT.$${MODULE_ID}.winrt_capabilities =$$join(MODULE_WINRT_CAPABILITIES, " ", " ")" \ + "QT.$${MODULE_ID}.winrt_capabilities_device =$$join(MODULE_WINRT_CAPABILITIES_DEVICE, " ", " ")" write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") !internal_module:!no_private_module { module_build_type += internal_module @@ -186,6 +189,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ name module depends run_depends plugin_types module_config CONFIG DEFINES \ priority includes bins libs frameworks libexecs plugins imports qml \ + winrt_capabilities winrt_capabilities_device \ )):defined(QT.$${mod}.$$var, var):cache(QT.$${mod}.$$var, transient) } cache(QT_MODULES, transient) diff --git a/mkspecs/features/winrt/package_manifest.prf b/mkspecs/features/winrt/package_manifest.prf index 3520fcdf93..291ebec6e9 100644 --- a/mkspecs/features/winrt/package_manifest.prf +++ b/mkspecs/features/winrt/package_manifest.prf @@ -112,10 +112,19 @@ # capability anymore and is assumed to be standard. *-msvc2015: WINRT_MANIFEST.capabilities += internetClient + contains(WINRT_MANIFEST.capabilities, defaults) { + WINRT_MANIFEST.capabilities -= defaults + WINRT_MANIFEST.capabilities += $$WINRT_MANIFEST.capabilities_default + } + + contains(WINRT_MANIFEST.capabilities_device, defaults) { + WINRT_MANIFEST.capabilities_device -= defaults + WINRT_MANIFEST.capabilities_device += $$WINRT_MANIFEST.capabilities_device_default + } + # Capabilities are given as a string list and may change with the configuration (network, sensors, etc.) WINRT_MANIFEST.capabilities = $$unique(WINRT_MANIFEST.capabilities) WINRT_MANIFEST.capabilities_device = $$unique(WINRT_MANIFEST.capabilities_device) - !isEmpty(WINRT_MANIFEST.capabilities)|!isEmpty(WINRT_MANIFEST.capabilities_device) { MANIFEST_CAPABILITIES += "" for(CAPABILITY, WINRT_MANIFEST.capabilities): \ diff --git a/src/network/network.pro b/src/network/network.pro index cdea190222..fed14616af 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -32,6 +32,10 @@ MODULE_PLUGIN_TYPES = \ ANDROID_PERMISSIONS += \ android.permission.ACCESS_NETWORK_STATE +MODULE_WINRT_CAPABILITIES = \ + internetClient \ + internetClientServer + MODULE_PLUGIN_TYPES = \ bearer load(qt_module) -- cgit v1.2.3 From fe4fad790ed187bf1d8c5bf61066fe00823fbe7e Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 22 Mar 2016 15:50:44 +0100 Subject: winrt: Fix QKeyEvent::isAutoRepeat When keeping a key pressed CorePhysicalKeyStatus' RepeatCount stays 1 while WasKeyDown changes from false to true. Thus WasKeyDown should be used to determine the auto repeat status of the key event. Task-number: QTBUG-52055 Change-Id: I7cde6b92473bd5335e85418c2b92cfe8f338975c Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 47e68ae0af..e4f7709146 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -885,7 +885,7 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind virtualKey, 0, QString(), - status.RepeatCount > 1, + status.WasKeyDown, !status.RepeatCount ? 1 : status.RepeatCount, false); return S_OK; @@ -912,7 +912,7 @@ HRESULT QWinRTScreen::onKeyUp(ABI::Windows::UI::Core::ICoreWindow *, ABI::Window virtualKey, 0, info.text, - status.RepeatCount > 1, + status.WasKeyDown, !status.RepeatCount ? 1 : status.RepeatCount, false); return S_OK; @@ -945,7 +945,7 @@ HRESULT QWinRTScreen::onCharacterReceived(ICoreWindow *, ICharacterReceivedEvent virtualKey, 0, text, - status.RepeatCount > 1, + status.WasKeyDown, !status.RepeatCount ? 1 : status.RepeatCount, false); d->activeKeys.insert(key, KeyInfo(text, virtualKey)); -- cgit v1.2.3 From a064bcf883f4552af3c81756dceda7c53cb8b061 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 23 Mar 2016 10:25:17 +0100 Subject: winrt: mimic desktop Window's "QKeyEvent::isAutoRepeat" behavior We should mimic desktop Qt's behavior as close as possible. That means, that a key release event is triggered between auto generated press events for most keys. For some keys like modifiers, caps lock, scroll lock etc. there are no auto repeated events if the key is held down. The "last" release event after having held the key and several events are triggered does not have the isAutoRepeat flag set so we should not have that flag in this case either. Task-number: QTBUG-52055 Change-Id: I001a73416c4b2072d307ee5d87c7cb8406c9575f Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 46 +++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index e4f7709146..fbf6393d90 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -416,6 +416,23 @@ static inline Qt::Key qKeyFromVirtual(VirtualKey key) } } +// Some keys like modifiers, caps lock etc. should not be automatically repeated if the key is held down +static inline bool shouldAutoRepeat(Qt::Key key) +{ + switch (key) { + case Qt::Key_Shift: + case Qt::Key_Control: + case Qt::Key_Alt: + case Qt::Key_Meta: + case Qt::Key_CapsLock: + case Qt::Key_NumLock: + case Qt::Key_ScrollLock: + return false; + default: + return true; + } +} + static inline Qt::Key qKeyFromCode(quint32 code, int mods) { if (code >= 'a' && code <= 'z') @@ -870,12 +887,33 @@ HRESULT QWinRTScreen::onKeyDown(ABI::Windows::UI::Core::ICoreWindow *, ABI::Wind Q_ASSERT_SUCCEEDED(hr); Qt::Key key = qKeyFromVirtual(virtualKey); - // Defer character key presses to onCharacterReceived - if (key == Qt::Key_unknown || (key >= Qt::Key_Space && key <= Qt::Key_ydiaeresis)) { + + const bool wasPressed = d->activeKeys.contains(key); + if (wasPressed) { + if (!shouldAutoRepeat(key)) + return S_OK; + + // If the key was pressed before trigger a key release before the next key press + QWindowSystemInterface::handleExtendedKeyEvent( + topWindow(), + QEvent::KeyRelease, + key, + keyboardModifiers(), + !status.ScanCode ? -1 : status.ScanCode, + virtualKey, + 0, + QString(), + status.WasKeyDown, + !status.RepeatCount ? 1 : status.RepeatCount, + false); + } else { d->activeKeys.insert(key, KeyInfo(virtualKey)); - return S_OK; } + // Defer character key presses to onCharacterReceived + if (key == Qt::Key_unknown || (key >= Qt::Key_Space && key <= Qt::Key_ydiaeresis)) + return S_OK; + QWindowSystemInterface::handleExtendedKeyEvent( topWindow(), QEvent::KeyPress, @@ -912,7 +950,7 @@ HRESULT QWinRTScreen::onKeyUp(ABI::Windows::UI::Core::ICoreWindow *, ABI::Window virtualKey, 0, info.text, - status.WasKeyDown, + false, // The final key release does not have autoRepeat set on Windows !status.RepeatCount ? 1 : status.RepeatCount, false); return S_OK; -- cgit v1.2.3 From f6eadcd60178b1a16224d557b8945020164eba7d Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 1 Apr 2016 09:36:49 +0300 Subject: Hide the navigation bar only on Android API-19+ Hiding navigation bar only on Android pre API-19 is useless because the navigation bar appears every time when the user touches the application window. [ChangeLog][Android] Hide the navigation bar only on Android API-19+ Change-Id: I085d691a0170cf10dd9970e009c34c6afc961bc6 Reviewed-by: Christian Stromme --- .../org/qtproject/qt5/android/QtActivityDelegate.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 4cce86e8bb..21a9d498df 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -139,17 +139,13 @@ public class QtActivityDelegate m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); try { - if (Build.VERSION.SDK_INT >= 14) { + if (Build.VERSION.SDK_INT >= 19) { int flags = View.class.getDeclaredField("SYSTEM_UI_FLAG_HIDE_NAVIGATION").getInt(null); - if (Build.VERSION.SDK_INT >= 16) { - flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_STABLE").getInt(null); - flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION").getInt(null); - flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN").getInt(null); - flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_FULLSCREEN").getInt(null); - - if (Build.VERSION.SDK_INT >= 19) - flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null); - } + flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_STABLE").getInt(null); + flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION").getInt(null); + flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN").getInt(null); + flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_FULLSCREEN").getInt(null); + flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null); Method m = View.class.getMethod("setSystemUiVisibility", int.class); m.invoke(m_activity.getWindow().getDecorView(), flags | View.INVISIBLE); } -- cgit v1.2.3 From 24914b1acbfc5e45768dd1465b9e3f3e61185829 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 18 Mar 2016 15:49:58 +0100 Subject: Qt Quick: Fix bug for selections with line wraps and breaks This fixes yet another bug where the selection spans both line wraps and explicit line breaks. Offsetting the log clusters by the text position in 342c909b340cb1bfbb95480fc79dcea21a470c83 was not entirely correct, because in some cases the script item will refer to a specific part of the string, as indicated by si.position, while iterator.itemStart is in the context of the full string. In this case, the log cluster array pointer we use refers to the script item's part of the array, i.e. it is already offset by si.position. Therefore, we must offset the logClusters pointer by the text position *relative* to the current script item. Previously we would actually offset by si.position twice in cases where si.position != 0. We want the text range to refer to the full string, though, so it can be compared to other text ranges later. However, in some cases when we are requesting only part of a script item, then iterator.itemStart does not correspond to relativeFrom, so in order for the text range search to work, we must pass in the text positions we are using [relativeFrom, relativeTo], though offset by si.position so that it refers to the full string and not just the part addressed by the script item. Task-number: QTBUG-51759 Change-Id: Ib69856d6d3bc1dd501db94c9d295623f436d122c Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/gui/text/qtextlayout.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index bc9c452ff7..aca475a581 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2141,7 +2141,6 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, QGlyphRunPrivate *d = QGlyphRunPrivate::get(glyphRun); int rangeStart = textPosition; - logClusters += textPosition; while (*logClusters != glyphsStart && rangeStart < textPosition + textLength) { ++logClusters; ++rangeStart; @@ -2350,9 +2349,9 @@ QList QTextLine::glyphRuns(int from, int length) const width, glyphsStart + start, glyphsStart + end, - logClusters, - iterator.itemStart, - iterator.itemLength)); + logClusters + relativeFrom, + relativeFrom + si.position, + relativeTo - relativeFrom + 1)); for (int i = 0; i < subLayout.numGlyphs; ++i) { QFixed justification = QFixed::fromFixed(subLayout.justifications[i].space_18d6); pos.rx() += (subLayout.advances[i] + justification).toReal(); @@ -2380,9 +2379,9 @@ QList QTextLine::glyphRuns(int from, int length) const width, glyphsStart + start, glyphsStart + end, - logClusters, - iterator.itemStart, - iterator.itemLength); + logClusters + relativeFrom, + relativeFrom + si.position, + relativeTo - relativeFrom + 1); if (!glyphRun.isEmpty()) glyphRuns.append(glyphRun); } else { @@ -2396,9 +2395,9 @@ QList QTextLine::glyphRuns(int from, int length) const width, glyphsStart, glyphsEnd, - logClusters, - iterator.itemStart, - iterator.itemLength); + logClusters + relativeFrom, + relativeFrom + si.position, + relativeTo - relativeFrom + 1); if (!glyphRun.isEmpty()) glyphRuns.append(glyphRun); } -- cgit v1.2.3 From 161fbfda70700c593dc4ce9952a572ae914c7398 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 7 Apr 2016 12:49:17 +0200 Subject: Improve gdb backtrace handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Long backtraces would get cut off in the terminal, this is especially bothersome when having lots of threads. Make sure that the output is complet by setting height=0 for gdb. The gdb manual states: "If you specify a height of either unlimited or zero lines, gdb does not pause during output no matter how long the output is. This is useful if output is to a file or to an editor buffer." Change-Id: I282054bc9e205d67d3076e37d5c928475803b22d Reviewed-by: Simon Hausmann Reviewed-by: Friedemann Kleint Reviewed-by: Jędrzej Nowacki --- src/testlib/qtestcase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 339db2246e..8de631094d 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -114,6 +114,7 @@ static void stackTrace() char cmd[512]; qsnprintf(cmd, 512, "gdb --pid %d 2>/dev/null < Date: Mon, 4 Apr 2016 18:36:53 +0200 Subject: remove bogus no_cxx_module conditional this flag specifies that the plugin does not track a qt module. this is entirely unrelated to whether the plugin should be versioned. amends f54a3d783. Change-Id: Ibd3e9bedf488dc58e6354ccf7dd33d974e5f52c2 Reviewed-by: Joerg Bornemann --- mkspecs/features/qml_plugin.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf index daedeca3a0..20b8eb4d53 100644 --- a/mkspecs/features/qml_plugin.prf +++ b/mkspecs/features/qml_plugin.prf @@ -27,7 +27,7 @@ CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable } isEmpty(TARGETPATH): TARGETPATH = $$eval(QT.$${CXX_MODULE}.name) -!no_cxx_module:win32:CONFIG(shared, static|shared) { +win32:CONFIG(shared, static|shared) { # Embed a VERSIONINFO resource into the plugin's DLL. isEmpty(VERSION): VERSION = $$MODULE_VERSION CONFIG += skip_target_version_ext -- cgit v1.2.3 From b2c0e5af186201979f47a306e017eb8979248f00 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 28 Mar 2016 13:37:22 +0300 Subject: By default use native menu bar Task-number: QTBUG-52010 Change-Id: I8f5feacc41719b1c084ec5a8763e597c1dab716c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidplatformtheme.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index d53d678bcf..9350a15721 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -362,6 +362,9 @@ QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *an // default in case the style has not set a font m_systemFont = QFont(QLatin1String("Roboto"), 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi + + // by default use native menu bar + QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false); } QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const -- cgit v1.2.3 From ee22fe13cda74c5ef5ee7b6db1b75d2837e43672 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 13:00:32 +0100 Subject: QDateTimeParser::parse(): improve readability A switch (was inconsistent about whether enum members need casts and) made it less obvious, rather than more, what was going on; so changed it to a nested if. Change-Id: I9af322d9dd17aa08cac5003eff2c8eaa73b50d45 Reviewed-by: Marc Mutz --- src/corelib/tools/qdatetimeparser.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 8e3eaf7074..cc09992b88 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -977,22 +977,17 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos if (state != Invalid) { if (parserType != QVariant::Time) { - if (year % 100 != year2digits) { - switch (isSet & (YearSection2Digits|YearSection)) { - case YearSection2Digits: + if (year % 100 != year2digits && (isSet & YearSection2Digits)) { + if (!(isSet & YearSection)) { year = (year / 100) * 100; year += year2digits; - break; - case ((uint)YearSection2Digits|(uint)YearSection): { + } else { conflicts = true; const SectionNode &sn = sectionNode(currentSectionIndex); if (sn.type == YearSection2Digits) { year = (year / 100) * 100; year += year2digits; } - break; } - default: - break; } } -- cgit v1.2.3 From c671e66802b75b511ad85347c70f6193134d81ca Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 17:14:17 +0100 Subject: QDateTimeParser: mediate QLocale's meddling via a setter. The former has (for now) nothing private, so QLocale got away with setting its .defaultLocale explicitly; provide a setter method by which it can do that, to allow scope for later encapsulation. Change-Id: I77fc5fc8f868fc7cf8d51eb1c5d18926c61cbf78 Reviewed-by: Marc Mutz --- src/corelib/tools/qdatetimeparser_p.h | 1 + src/corelib/tools/qlocale.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 257cb6e2cc..d6c4d615db 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -218,6 +218,7 @@ public: FieldInfo fieldInfo(int index) const; + void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } virtual QDateTime getMinimum() const; virtual QDateTime getMaximum() const; virtual int cursorPosition() const { return -1; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 890a8fb95d..72a6668bd3 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1834,7 +1834,7 @@ QTime QLocale::toTime(const QString &string, const QString &format) const QTime time; #ifndef QT_BOOTSTRAPPED QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString); - dt.defaultLocale = *this; + dt.setDefaultLocale(*this); if (dt.parseFormat(format)) dt.fromString(string, 0, &time); #else @@ -1865,7 +1865,7 @@ QDate QLocale::toDate(const QString &string, const QString &format) const QDate date; #ifndef QT_BOOTSTRAPPED QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString); - dt.defaultLocale = *this; + dt.setDefaultLocale(*this); if (dt.parseFormat(format)) dt.fromString(string, &date, 0); #else @@ -1898,7 +1898,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons QDate date; QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString); - dt.defaultLocale = *this; + dt.setDefaultLocale(*this); if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) return QDateTime(date, time); #else -- cgit v1.2.3 From fd5720af2cb1e641c433c73fd977c8ba9d278305 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 20 Jan 2016 09:42:34 +0100 Subject: QDateTimeParser: new Section mask values simplify code. Various |s of existing section flags were used repeatedly; naming these masks makes the relevant code easier to read. In QDateTimeEdit, add a comment to make clear that its Section enum is based on QDTP's. Change-Id: Ifd8364cd396a6d0d5ed7ae7dc4d31690f77edd30 Reviewed-by: Marc Mutz --- src/corelib/tools/qdatetimeparser.cpp | 18 +++++++++++------- src/corelib/tools/qdatetimeparser_p.h | 12 +++++++++--- src/widgets/widgets/qdatetimeedit.cpp | 12 ++++++------ src/widgets/widgets/qdatetimeedit.h | 2 +- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index cc09992b88..180f76bcc1 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -159,7 +159,7 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const break; } - if (!(node.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong))) { + if (!(node.type & DaySectionMask)) { if (day < cachedDay) day = cachedDay; const int max = QDate(year, month, 1).daysInMonth(); @@ -625,6 +625,10 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const case Internal: case TimeSectionMask: case DateSectionMask: + case HourSectionMask: + case YearSectionMask: + case DayOfWeekSectionMask: + case DaySectionMask: qWarning("QDateTimeParser::sectionMaxSize: Invalid section %s", SectionNode::name(s).toLatin1().constData()); @@ -993,12 +997,11 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos const QDate date(year, month, day); const int diff = dayofweek - date.dayOfWeek(); - if (diff != 0 && state == Acceptable - && isSet & (DayOfWeekSectionShort | DayOfWeekSectionLong)) { + if (diff != 0 && state == Acceptable && isSet & DayOfWeekSectionMask) { if (isSet & DaySection) conflicts = true; const SectionNode &sn = sectionNode(currentSectionIndex); - if (sn.type & (DayOfWeekSectionShort|DayOfWeekSectionLong) || currentSectionIndex == -1) { + if (sn.type & DayOfWeekSectionMask || currentSectionIndex == -1) { // dayofweek should be preferred day += diff; if (day <= 0) { @@ -1010,8 +1013,9 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos << diff << QDate(year, month, day).dayOfWeek(); } } + bool needfixday = false; - if (sectionType(currentSectionIndex) & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) { + if (sectionType(currentSectionIndex) & DaySectionMask) { cachedDay = day; } else if (cachedDay > day) { day = cachedDay; @@ -1039,7 +1043,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos const SectionNode sn = sectionNode(i); if (sn.type & DaySection) { input.replace(sectionPos(sn), sectionSize(i), loc.toString(day)); - } else if (sn.type & (DayOfWeekSectionShort | DayOfWeekSectionLong)) { + } else if (sn.type & DayOfWeekSectionMask) { const int dayOfWeek = QDate(year, month, day).dayOfWeek(); const QLocale::FormatType dayFormat = (sn.type == DayOfWeekSectionShort @@ -1296,7 +1300,7 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex int bestCount = 0; if (!str1.isEmpty()) { const SectionNode &sn = sectionNode(sectionIndex); - if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong))) { + if (!(sn.type & DaySectionMask)) { qWarning("QDateTimeParser::findDay Internal error"); return -1; } diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index d6c4d615db..90c6a8acba 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -114,14 +114,20 @@ public: MinuteSection = 0x00008, Hour12Section = 0x00010, Hour24Section = 0x00020, - TimeSectionMask = (AmPmSection|MSecSection|SecondSection|MinuteSection|Hour12Section|Hour24Section), + HourSectionMask = (Hour12Section | Hour24Section), + TimeSectionMask = (MSecSection | SecondSection | MinuteSection | + HourSectionMask | AmPmSection), + DaySection = 0x00100, MonthSection = 0x00200, YearSection = 0x00400, YearSection2Digits = 0x00800, + YearSectionMask = YearSection | YearSection2Digits, DayOfWeekSectionShort = 0x01000, DayOfWeekSectionLong = 0x02000, - DateSectionMask = (DaySection|MonthSection|YearSection|YearSection2Digits|DayOfWeekSectionShort|DayOfWeekSectionLong), + DayOfWeekSectionMask = DayOfWeekSectionShort | DayOfWeekSectionLong, + DaySectionMask = DaySection | DayOfWeekSectionMask, + DateSectionMask = DaySectionMask | MonthSection | YearSectionMask, Internal = 0x10000, FirstSection = 0x20000 | Internal, @@ -132,7 +138,7 @@ public: FirstSectionIndex = -2, LastSectionIndex = -3, CalendarPopupIndex = -4 - }; // duplicated from qdatetimeedit.h + }; // extending qdatetimeedit.h's equivalent Q_DECLARE_FLAGS(Sections, Section) struct Q_CORE_EXPORT SectionNode { diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 8ee32a2a8b..eb001bade4 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -2047,7 +2047,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c // doesn't mean that we hit the floor in the other if (steps > 0) { setDigit(v, sectionIndex, min); - if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) && sections & DateSectionMask) { + if (!(sn.type & DaySectionMask) && sections & DateSectionMask) { const int daysInMonth = v.date().daysInMonth(); if (v.date().day() < oldDay && v.date().day() < daysInMonth) { const int adds = qMin(oldDay, daysInMonth); @@ -2062,7 +2062,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c } } else { setDigit(v, sectionIndex, max); - if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) && sections & DateSectionMask) { + if (!(sn.type & DaySectionMask) && sections & DateSectionMask) { const int daysInMonth = v.date().daysInMonth(); if (v.date().day() < oldDay && v.date().day() < daysInMonth) { const int adds = qMin(oldDay, daysInMonth); @@ -2080,7 +2080,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c setDigit(v, sectionIndex, (steps > 0 ? localmax : localmin)); } } - if (!test && oldDay != v.date().day() && !(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong))) { + if (!test && oldDay != v.date().day() && !(sn.type & DaySectionMask)) { // this should not happen when called from stepEnabled cachedDay = qMax(oldDay, cachedDay); } @@ -2272,15 +2272,15 @@ QDateTimeEdit::Sections QDateTimeEditPrivate::convertSections(QDateTimeParser::S ret |= QDateTimeEdit::SecondSection; if (s & QDateTimeParser::MinuteSection) ret |= QDateTimeEdit::MinuteSection; - if (s & (QDateTimeParser::Hour24Section|QDateTimeParser::Hour12Section)) + if (s & (QDateTimeParser::HourSectionMask)) ret |= QDateTimeEdit::HourSection; if (s & QDateTimeParser::AmPmSection) ret |= QDateTimeEdit::AmPmSection; - if (s & (QDateTimeParser::DaySection|QDateTimeParser::DayOfWeekSectionShort|QDateTimeParser::DayOfWeekSectionLong)) + if (s & (QDateTimeParser::DaySectionMask)) ret |= QDateTimeEdit::DaySection; if (s & QDateTimeParser::MonthSection) ret |= QDateTimeEdit::MonthSection; - if (s & (QDateTimeParser::YearSection|QDateTimeParser::YearSection2Digits)) + if (s & (QDateTimeParser::YearSectionMask)) ret |= QDateTimeEdit::YearSection; return ret; diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index 829ce205be..031cc0bbb4 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -69,7 +69,7 @@ class Q_WIDGETS_EXPORT QDateTimeEdit : public QAbstractSpinBox Q_PROPERTY(int sectionCount READ sectionCount) Q_PROPERTY(Qt::TimeSpec timeSpec READ timeSpec WRITE setTimeSpec) public: - enum Section { + enum Section { // a sub-type of QDateTimeParser's like-named enum. NoSection = 0x0000, AmPmSection = 0x0001, MSecSection = 0x0002, -- cgit v1.2.3 From 2996560bf80d037b7bb6d541cdabd7816a8d3325 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 6 Apr 2016 17:53:58 +0200 Subject: QDateTimeEditPrivate: make clear which overrides are for which base. The class does multiple inheritance and over-rides virtuals from both bases; it also declared the over-rides virtual rather than declaring them to be over-rides; so deploy Q_DECL_OVERRIDE and, while changing those lines, move them all together and document which belong to which base. Change-Id: Ica3958d6d24124a537983e7e94fce642284f1f24 Reviewed-by: Marc Mutz --- src/widgets/widgets/qdatetimeedit_p.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index 4a6014000b..5772647a1a 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -75,14 +75,25 @@ public: void emitSignals(EmitPolicy ep, const QVariant &old); QString textFromValue(const QVariant &f) const; QVariant valueFromText(const QString &f) const; - virtual void _q_editorCursorPositionChanged(int oldpos, int newpos); - virtual void interpret(EmitPolicy ep); - virtual void clearCache() const; QDateTime validateAndInterpret(QString &input, int &, QValidator::State &state, bool fixup = false) const; void clearSection(int index); - virtual QString displayText() const { return edit->text(); } // this is from QDateTimeParser + + // Override QAbstractSpinBoxPrivate: + void _q_editorCursorPositionChanged(int oldpos, int newpos) Q_DECL_OVERRIDE; + void interpret(EmitPolicy ep) Q_DECL_OVERRIDE; + void clearCache() const Q_DECL_OVERRIDE; + QStyle::SubControl newHoverControl(const QPoint &pos) Q_DECL_OVERRIDE; + void updateEditFieldGeometry() Q_DECL_OVERRIDE; + QVariant getZeroVariant() const Q_DECL_OVERRIDE; + void setRange(const QVariant &min, const QVariant &max) Q_DECL_OVERRIDE; + + // Override QDateTimePraser: + QString displayText() const Q_DECL_OVERRIDE { return edit->text(); } + QDateTime getMinimum() const Q_DECL_OVERRIDE { return minimum.toDateTime(); } + QDateTime getMaximum() const Q_DECL_OVERRIDE { return maximum.toDateTime(); } + QLocale locale() const Q_DECL_OVERRIDE { return q_func()->locale(); } int absoluteIndex(QDateTimeEdit::Section s, int index) const; int absoluteIndex(const SectionNode &s) const; @@ -96,18 +107,10 @@ public: void updateCache(const QVariant &val, const QString &str) const; void updateTimeSpec(); - virtual QDateTime getMinimum() const { return minimum.toDateTime(); } - virtual QDateTime getMaximum() const { return maximum.toDateTime(); } - virtual QLocale locale() const { return q_func()->locale(); } QString valueToText(const QVariant &var) const { return textFromValue(var); } QString getAmPmText(AmPm ap, Case cs) const; int cursorPosition() const { return edit ? edit->cursorPosition() : -1; } - virtual QStyle::SubControl newHoverControl(const QPoint &pos); - virtual void updateEditFieldGeometry(); - virtual QVariant getZeroVariant() const; - virtual void setRange(const QVariant &min, const QVariant &max); - void _q_resetButton(); void updateArrow(QStyle::StateFlag state); bool calendarPopupEnabled() const; -- cgit v1.2.3 From 4ac0686a6ba0d7512585dedd0561ed56240a8ccc Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Jan 2016 14:31:37 +0100 Subject: Remove QDateTimeEditPrivate's duplication of QDateTimeParser code. Both constructors set up the first, last and none members. QDateTimeEditPrivate wants first.pos = 0, different to its base, so keep that, but the rest merely duplicated. Change-Id: Ice22e0495112dc3427eb35b5b73420f42d7dafc1 Reviewed-by: Marc Mutz --- src/widgets/widgets/qdatetimeedit.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index eb001bade4..960f84c13a 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1668,12 +1668,7 @@ QDateTimeEditPrivate::QDateTimeEditPrivate() cachedDay = -1; currentSectionIndex = FirstSectionIndex; - first.type = FirstSection; - last.type = LastSection; - none.type = NoSection; first.pos = 0; - last.pos = -1; - none.pos = -1; sections = 0; calendarPopup = false; minimum = QDATETIMEEDIT_COMPAT_DATETIME_MIN; -- cgit v1.2.3 From 3c08035b7b29e48e749a92cbdf05432a57f4108d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 6 Jan 2016 14:47:00 +0100 Subject: QScreen manual test: add MouseMonitor to test multi-screen scenarios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QMouseEvent::screenPos() should be global desktop position - QDesktopWidget::screenNumber() should tell the correct screen - QGuiApplication::topLevelAt(screenPos) should find the window where the mouse is clicked Change-Id: I9a63ab3ee1944b7246551d0f3d5e37f0d2aa5457 Reviewed-by: Błażej Szczygieł Reviewed-by: Friedemann Kleint --- tests/manual/qscreen/main.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/manual/qscreen/main.cpp b/tests/manual/qscreen/main.cpp index 298996a59b..13d4145a68 100644 --- a/tests/manual/qscreen/main.cpp +++ b/tests/manual/qscreen/main.cpp @@ -45,6 +45,61 @@ #include #include #include +#include +#include +#include + + +class MouseMonitor : public QLabel { + Q_OBJECT +public: + MouseMonitor() : m_grabbed(false) { + setMinimumSize(540, 240); + setAlignment(Qt::AlignCenter); + setMouseTracking(true); + setWindowTitle(QLatin1String("Mouse Monitor")); + updateText(); + } + + void updateText() { + QString txt = m_grabbed ? + QLatin1String("Left-click to test QGuiApplication::topLevelAt(click pos)\nRight-click to ungrab\n") : + QLatin1String("Left-click to grab mouse\n"); + if (!m_cursorPos.isNull()) { + txt += QString(QLatin1String("Current mouse position: %1, %2 on screen %3\n")) + .arg(m_cursorPos.x()).arg(m_cursorPos.y()).arg(QApplication::desktop()->screenNumber(m_cursorPos)); + if (QGuiApplication::mouseButtons() & Qt::LeftButton) { + QWindow *win = QGuiApplication::topLevelAt(m_cursorPos); + txt += QString(QLatin1String("Top-level window found? %1\n")) + .arg(win ? (win->title().isEmpty() ? "no title" : win->title()) : "none"); + } + } + setText(txt); + } + +protected: + void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE { + m_cursorPos = ev->screenPos().toPoint(); + updateText(); + } + + void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE { + m_cursorPos = ev->screenPos().toPoint(); + qDebug() << "top level @" << m_cursorPos << ":" << QGuiApplication::topLevelAt(m_cursorPos); + updateText(); + if (!m_grabbed) { + grabMouse(Qt::CrossCursor); + m_grabbed = true; + } else if (ev->button() == Qt::RightButton) { + setVisible(false); + deleteLater(); + } + } + +private: + QPoint m_cursorPos; + bool m_grabbed; +}; class ScreenPropertyWatcher : public PropertyWatcher { @@ -101,6 +156,7 @@ public: protected: bool event(QEvent *event) Q_DECL_OVERRIDE; + void startMouseMonitor(); private: const QString m_annotation; @@ -124,6 +180,11 @@ ScreenWatcherMainWindow::ScreenWatcherMainWindow(QScreen *screen) a = fileMenu->addAction(QLatin1String("Quit")); a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); connect(a, SIGNAL(triggered()), qApp, SLOT(quit())); + + QMenu *toolsMenu = menuBar()->addMenu(QLatin1String("&Tools")); + a = toolsMenu->addAction(QLatin1String("Mouse Monitor")); + a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + connect(a, &QAction::triggered, this, &ScreenWatcherMainWindow::startMouseMonitor); } static inline QString msgScreenChange(const QWidget *w, const QScreen *oldScreen, const QScreen *newScreen) @@ -159,6 +220,12 @@ bool ScreenWatcherMainWindow::event(QEvent *event) return QMainWindow::event(event); } +void ScreenWatcherMainWindow::startMouseMonitor() +{ + MouseMonitor *mm = new MouseMonitor(); + mm->show(); +} + void screenAdded(QScreen* screen) { screen->setOrientationUpdateMask((Qt::ScreenOrientations)0x0F); -- cgit v1.2.3 From 8e103902def83af0a074b81c9d527d8147def162 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 6 Apr 2016 14:29:15 +0200 Subject: tests: fix tst_QFontComboBox on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After 909d3f5c7, private families will not be shown in user interface. Task-number: QTBUG-41318 Change-Id: I15ae77cacd2a27c9db4b1a8ffbb582416258988c Reviewed-by: Morten Johan Sørvig --- tests/auto/widgets/widgets/qfontcombobox/BLACKLIST | 6 ------ .../widgets/qfontcombobox/tst_qfontcombobox.cpp | 20 +++++++++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 tests/auto/widgets/widgets/qfontcombobox/BLACKLIST diff --git a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST b/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST deleted file mode 100644 index 8bd4caad31..0000000000 --- a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST +++ /dev/null @@ -1,6 +0,0 @@ -[currentFont] -osx -[fontFilters] -osx -[writingSystem] -osx diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp index 5d6fdf2851..10e447c417 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp @@ -113,18 +113,21 @@ void tst_QFontComboBox::qfontcombobox() void tst_QFontComboBox::currentFont_data() { QTest::addColumn("currentFont"); + QFontDatabase db; // Normalize the names QFont defaultFont; QFontInfo fi(defaultFont); defaultFont = QFont(fi.family()); // make sure we have a real font name and not something like 'Sans Serif'. - QTest::newRow("default") << defaultFont; + if (!db.isPrivateFamily(defaultFont.family())) + QTest::newRow("default") << defaultFont; defaultFont.setPointSize(defaultFont.pointSize() + 10); - QTest::newRow("default2") << defaultFont; - QFontDatabase db; + if (!db.isPrivateFamily(defaultFont.family())) + QTest::newRow("default2") << defaultFont; QStringList list = db.families(); for (int i = 0; i < list.count(); ++i) { QFont f = QFont(QFontInfo(QFont(list.at(i))).family()); - QTest::newRow(qPrintable(list.at(i))) << f; + if (!db.isPrivateFamily(f.family())) + QTest::newRow(qPrintable(list.at(i))) << f; } } @@ -201,6 +204,8 @@ void tst_QFontComboBox::fontFilters() fontFilters &= ~spacingMask; for (int i = 0; i < list.count(); ++i) { + if (db.isPrivateFamily(list[i])) + continue; if (fontFilters & QFontComboBox::ScalableFonts) { if (!db.isSmoothlyScalable(list[i])) continue; @@ -265,7 +270,12 @@ void tst_QFontComboBox::writingSystem() QFontDatabase db; QStringList list = db.families(writingSystem); - QCOMPARE(box.model()->rowCount(), list.count()); + int c = list.count(); + for (int i = 0; i < list.count(); ++i) { + if (db.isPrivateFamily(list[i])) + c--; + } + QCOMPARE(box.model()->rowCount(), c); if (list.count() == 0) QCOMPARE(box.currentFont(), QFont()); -- cgit v1.2.3 From f39e542eb859f5f88c65a1b97bdf2f4256c68ec0 Mon Sep 17 00:00:00 2001 From: Alexander Grishkov Date: Tue, 15 Mar 2016 22:54:20 +0300 Subject: Fix parsing of IPv4 addresses with certain symbols Add some extra checks to the parser to make sure that addresses like "300-05" aren't interpreted as valid IPv4 addresses. Change-Id: I12475eebc9452e060779bb05e2b4ad9512a28281 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qipaddress.cpp | 3 +++ tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/corelib/io/qipaddress.cpp b/src/corelib/io/qipaddress.cpp index ef0ca0269e..47cbbe066a 100644 --- a/src/corelib/io/qipaddress.cpp +++ b/src/corelib/io/qipaddress.cpp @@ -111,6 +111,9 @@ static bool parseIp4Internal(IPv4Address &address, const char *ptr, bool acceptL return false; else if (dotCount == 3 || *endptr == '\0') return true; + if (*endptr != '.') + return false; + ++dotCount; ptr = endptr + 1; } diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp index 3e16d3b871..0addd89ebf 100644 --- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp +++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp @@ -186,6 +186,7 @@ void tst_QIpAddress::invalidParseIp4_data() QTest::newRow("..") << ".."; QTest::newRow("...") << "..."; QTest::newRow("....") << "...."; + QTest::newRow(".1.2.3") << ".1.2.3"; QTest::newRow("1.") << "1."; QTest::newRow("1.2.") << "1.2."; QTest::newRow("1.2.3.") << "1.2.3."; @@ -214,9 +215,15 @@ void tst_QIpAddress::invalidParseIp4_data() QTest::newRow("-1.1") << "-1.1"; QTest::newRow("1.-1") << "1.-1"; QTest::newRow("1.1.1.-1") << "1.1.1.-1"; + QTest::newRow("300-05") << "300-05"; + QTest::newRow("127.-1") << "127.-1"; + QTest::newRow("-127-10") << "-127-10"; + QTest::newRow("198.-16") << "198-16"; + QTest::newRow("-127.-0.") << "-127.-0."; // letters QTest::newRow("abc") << "abc"; + QTest::newRow("localhost") << "localhost"; QTest::newRow("1.2.3a.4") << "1.2.3a.4"; QTest::newRow("a.2.3.4") << "a.2.3.4"; QTest::newRow("1.2.3.4a") << "1.2.3.4a"; @@ -249,6 +256,7 @@ void tst_QIpAddress::ip4ToString_data() QTest::newRow("0.0.0.0") << 0u << "0.0.0.0"; QTest::newRow("1.2.3.4") << 0x01020304u << "1.2.3.4"; + QTest::newRow("127.0.0.1") << 0x7f000001u << "127.0.0.1"; QTest::newRow("111.222.33.44") << 0x6fde212cu << "111.222.33.44"; QTest::newRow("255.255.255.255") << 0xffffffffu << "255.255.255.255"; } -- cgit v1.2.3 From b0bfe8de68a27de34b9493e7d5263cad1e5823c9 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Tue, 29 Mar 2016 15:24:01 -0700 Subject: Delete the dangling generic engine object. Change-Id: I7d7531f1a678bf186e3a992091344fff64721dec Reviewed-by: Marc Mutz Reviewed-by: Lorn Potter --- src/network/bearer/qnetworkconfigmanager_p.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 71e435b771..ccda9dd509 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -418,6 +418,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (generic) { if (!envOK || skipGeneric <= 0) sessionEngines.append(generic); + else + delete generic; } #endif // QT_NO_LIBRARY } -- cgit v1.2.3 From b77ef8a7e6e4104067d52824e29eadc8c66f5929 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sat, 5 Mar 2016 12:23:21 -0800 Subject: QtDBus: clean up signal hooks and object tree in closeConnection If a QObject is added or passed as receiver to QDBusConnection::connect() and it is managed by Q_GLOBAL_STATIC or similar mechanism, it is possible that when that its destructor is called after the dbus daemon thread ends. In that case, QObject::destroyed connected via Qt::BlockingQueuedConnection to QDBusConnectionPrivate will cause dead lock since the thread is no longer processing events. Task-number: QTBUG-51648 Change-Id: I1a1810a6d6d0234af0269d5f3fc1f54101bf1547 Reviewed-by: Thiago Macieira --- src/dbus/qdbusconnection_p.h | 1 + src/dbus/qdbusintegrator.cpp | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index c77daf7ee1..565eb832f2 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -254,6 +254,7 @@ private: const QVector &metaTypes, int slotIdx); SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it); + void disconnectObjectTree(ObjectTreeNode &node); bool isServiceRegisteredByThread(const QString &serviceName); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 478a2c4a05..3be775db82 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1050,7 +1050,6 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() qPrintable(name)); closeConnection(); - rootNode.children.clear(); // free resources qDeleteAll(cachedMetaObjects); if (mode == ClientMode || mode == PeerMode) { @@ -1072,6 +1071,19 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() } } +void QDBusConnectionPrivate::disconnectObjectTree(QDBusConnectionPrivate::ObjectTreeNode &haystack) +{ + QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin(); + + while (it != haystack.children.end()) { + disconnectObjectTree(*it); + it++; + } + + if (haystack.obj) + haystack.obj->disconnect(this); +} + void QDBusConnectionPrivate::closeConnection() { QDBusWriteLocker locker(CloseConnectionAction, this); @@ -1095,6 +1107,18 @@ void QDBusConnectionPrivate::closeConnection() } qDeleteAll(pendingCalls); + + // Disconnect all signals from signal hooks and from the object tree to + // avoid QObject::destroyed being sent to dbus daemon thread which has + // already quit. + SignalHookHash::iterator sit = signalHooks.begin(); + while (sit != signalHooks.end()) { + sit.value().obj->disconnect(this); + sit++; + } + + disconnectObjectTree(rootNode); + rootNode.children.clear(); // free resources } void QDBusConnectionPrivate::checkThread() -- cgit v1.2.3 From 53d5811b0c432b845e453dfbef3f4237a1a71877 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 26 Oct 2015 14:19:23 +0100 Subject: rcc compiler with -list on Windows (newline symbols) Suppress '\n' -> '\r\n' replacement done by QIODevice, on Windows fwrite to stdout will end up in such replacement, no need in \r\r\n (reported as a bug in QtQuickCompiler originally).) Task-number: QTRD-3497 Change-Id: I61010831b49e41b3e4fa6626054f9fb53c63bb8a Reviewed-by: hjk --- src/tools/rcc/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index d8d5728414..30975cc17e 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -255,6 +255,11 @@ int runRcc(int argc, char *argv[]) // Make sure fwrite to stdout doesn't do LF->CRLF if (library.format() == RCCResourceLibrary::Binary) _setmode(_fileno(stdout), _O_BINARY); + // Make sure QIODevice does not do LF->CRLF, + // otherwise we'll end up in CRCRLF instead of + // CRLF. + if (list) + mode &= ~QIODevice::Text; #endif // Q_OS_WIN // using this overload close() only flushes. out.open(stdout, mode); -- cgit v1.2.3 From a8f98959ef6881d571fa35201cd6721067a3204b Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Thu, 24 Mar 2016 18:37:57 -0700 Subject: Make CFLAGS/CXXFLAGS behave consistently in config.tests The journald test was failing as sysroot was not being passed to the compiler in the compile test. This is due to the fact we were explicitly defining sysroot in the CXXFLAGS and not in CFLAGS. Change-Id: I4b4bda71f9aabc8e420e0e89ff3cc8fa3bbca201 Reviewed-by: Oswald Buddenhagen --- config.tests/unix/compile.test | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 65bc874617..b94e3d7ab0 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -13,6 +13,7 @@ DESCRIPTION=$7 shift 7 LFLAGS="$SYSROOT_FLAG" INCLUDEPATH="" +CFLAGS="$SYSROOT_FLAG" CXXFLAGS="$SYSROOT_FLAG" MAC_ARCH_CXXFLAGS="" MAC_ARCH_LFLAGS="" @@ -28,12 +29,14 @@ while [ "$#" -gt 0 ]; do shift ;; -arch) + MAC_ARCH_CFLAGS="$MAC_ARCH_CFLAGS -arch $2" MAC_ARCH_CXXFLAGS="$MAC_ARCH_CXXFLAGS -arch $2" MAC_ARCH_LFLAGS="$MAC_ARCH_LFLAGS -arch $2" shift ;; -F*|-m*|-x*) LFLAGS="$LFLAGS \"$PARAM\"" + CFLAGS="$CFLAGS \"$PARAM\"" CXXFLAGS="$CXXFLAGS \"$PARAM\"" ;; -L*|-l*|-pthread) @@ -44,10 +47,12 @@ while [ "$#" -gt 0 ]; do INCLUDEPATH="$INCLUDEPATH \"$INC\"" ;; -f*|-D*) + CFLAGS="$CFLAGS \"$PARAM\"" CXXFLAGS="$CXXFLAGS \"$PARAM\"" ;; -Qoption) # Two-argument form for the Sun Compiler + CFLAGS="$CFLAGS $PARAM \"$2\"" CXXFLAGS="$CXXFLAGS $PARAM \"$2\"" shift ;; @@ -67,7 +72,7 @@ test -r Makefile && $MAKE distclean >/dev/null 2>&1 # Make sure output from possible previous tests is gone rm -f "$EXE" "${EXE}.exe" -set -- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG+=android_app" "CONFIG-=debug_and_release app_bundle lib_bundle" "LIBS+=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +set -- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG+=android_app" "CONFIG-=debug_and_release app_bundle lib_bundle" "LIBS+=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CFLAGS*=$CFLAGS" "QMAKE_CFLAGS+=$MAC_ARCH_CFLAGS" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes else -- cgit v1.2.3 From 2693ca59e197651c05934daaf2b29e7386746140 Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Wed, 30 Mar 2016 10:35:51 -0700 Subject: Adjust egl config.test to pass sysrooted libs We should really start using -L=/foo and -I=/foo inside of sysroots, this test was preventing us from doing so (while arguably buying us nothing). Change-Id: If6e67631c585493871231e5d8a9354fa72e07343 Reviewed-by: Laszlo Agocs Reviewed-by: Oswald Buddenhagen --- config.tests/qpa/egl-x11/egl-x11.pro | 2 +- config.tests/qpa/egl/egl.pro | 2 +- config.tests/qpa/eglfs-brcm/eglfs-brcm.pro | 2 +- config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro | 2 +- config.tests/unix/opengles2/opengles2.pro | 2 +- config.tests/unix/opengles3/opengles3.pro | 2 +- config.tests/unix/opengles31/opengles31.pro | 2 +- mkspecs/features/egl.prf | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config.tests/qpa/egl-x11/egl-x11.pro b/config.tests/qpa/egl-x11/egl-x11.pro index c4e94ca40c..aceb03dd78 100644 --- a/config.tests/qpa/egl-x11/egl-x11.pro +++ b/config.tests/qpa/egl-x11/egl-x11.pro @@ -1,7 +1,7 @@ SOURCES = egl-x11.cpp for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL diff --git a/config.tests/qpa/egl/egl.pro b/config.tests/qpa/egl/egl.pro index f04d053543..b5396dab15 100644 --- a/config.tests/qpa/egl/egl.pro +++ b/config.tests/qpa/egl/egl.pro @@ -1,7 +1,7 @@ SOURCES = egl.cpp for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL diff --git a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro index ce16a3a391..d8b1c3ec7e 100644 --- a/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro +++ b/config.tests/qpa/eglfs-brcm/eglfs-brcm.pro @@ -5,7 +5,7 @@ CONFIG -= qt INCLUDEPATH += $$QMAKE_INCDIR_EGL for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } LIBS += -lEGL -lGLESv2 -lbcm_host diff --git a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro index 87214abc7a..521a911219 100644 --- a/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro +++ b/config.tests/qpa/eglfs-egldevice/eglfs-egldevice.pro @@ -1,7 +1,7 @@ SOURCES = eglfs-egldevice.cpp for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } INCLUDEPATH += $$QMAKE_INCDIR_EGL diff --git a/config.tests/unix/opengles2/opengles2.pro b/config.tests/unix/opengles2/opengles2.pro index c4d76895a8..da30b453c6 100644 --- a/config.tests/unix/opengles2/opengles2.pro +++ b/config.tests/unix/opengles2/opengles2.pro @@ -2,7 +2,7 @@ SOURCES = opengles2.cpp INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 for(p, QMAKE_LIBDIR_OPENGL_ES2) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } CONFIG -= qt diff --git a/config.tests/unix/opengles3/opengles3.pro b/config.tests/unix/opengles3/opengles3.pro index 6942b57327..720985f14d 100644 --- a/config.tests/unix/opengles3/opengles3.pro +++ b/config.tests/unix/opengles3/opengles3.pro @@ -6,7 +6,7 @@ SOURCES = opengles3.cpp INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 for(p, QMAKE_LIBDIR_OPENGL_ES2) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } CONFIG -= qt diff --git a/config.tests/unix/opengles31/opengles31.pro b/config.tests/unix/opengles31/opengles31.pro index 1df9cedfcd..225180e1c6 100644 --- a/config.tests/unix/opengles31/opengles31.pro +++ b/config.tests/unix/opengles31/opengles31.pro @@ -6,7 +6,7 @@ SOURCES = opengles31.cpp INCLUDEPATH += $$QMAKE_INCDIR_OPENGL_ES2 for(p, QMAKE_LIBDIR_OPENGL_ES2) { - exists($$p):LIBS += -L$$p + LIBS += -L$$p } CONFIG -= qt diff --git a/mkspecs/features/egl.prf b/mkspecs/features/egl.prf index c3bdd9fdf4..9fa0c9e219 100644 --- a/mkspecs/features/egl.prf +++ b/mkspecs/features/egl.prf @@ -4,5 +4,5 @@ QMAKE_CFLAGS += $$QMAKE_CFLAGS_EGL QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_EGL LIBS += $$QMAKE_LFLAGS_EGL for(p, QMAKE_LIBDIR_EGL) { - exists($$p): LIBS_PRIVATE += -L$$p + LIBS_PRIVATE += -L$$p } -- cgit v1.2.3 From 01d43cece85456ae69810ea3bdaf4b0e164e1542 Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Thu, 31 Mar 2016 09:54:55 -0700 Subject: Introduce RPI3 aarch32 mkspec Change-Id: Ia76f7f5b1793a16ac17285d19429f70d722675cf Reviewed-by: Laszlo Agocs --- mkspecs/devices/linux-rpi3-g++/qmake.conf | 41 ++++++++++++++++++++++++++ mkspecs/devices/linux-rpi3-g++/qplatformdefs.h | 34 +++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 mkspecs/devices/linux-rpi3-g++/qmake.conf create mode 100644 mkspecs/devices/linux-rpi3-g++/qplatformdefs.h diff --git a/mkspecs/devices/linux-rpi3-g++/qmake.conf b/mkspecs/devices/linux-rpi3-g++/qmake.conf new file mode 100644 index 0000000000..600d3e7dc1 --- /dev/null +++ b/mkspecs/devices/linux-rpi3-g++/qmake.conf @@ -0,0 +1,41 @@ +# qmake configuration for the Raspberry Pi 3 + +include(../common/linux_device_pre.conf) + +# I consider it a bug that this is required, but our EGL config.test _requires_ it +QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib + +VC_LIBRARY_PATH = /opt/vc/lib +VC_INCLUDE_PATH = =/opt/vc/include + +# terrible, they do not appear to resolve "=" in rpath! +VC_LINK_LINE = -L=$${VC_LIBRARY_PATH} -Wl,-rpath-link,$$[QT_SYSROOT]$${VC_LIBRARY_PATH} + +QMAKE_LIBDIR_OPENGL_ES2 = =$${VC_LIBRARY_PATH} +QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 +QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2 + +QMAKE_INCDIR_EGL = \ + $${VC_INCLUDE_PATH} \ + $${VC_INCLUDE_PATH}/interface/vcos/pthreads \ + $${VC_INCLUDE_PATH}/interface/vmcs_host/linux + +QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} + +QMAKE_LIBS_OPENGL_ES2 = $${VC_LINK_LINE} -lGLESv2 + +# The official opt vc EGL references GLESv2 symbols: need to link it +QMAKE_LIBS_EGL = $${VC_LINK_LINE} -lEGL -lGLESv2 + +# We deliberately override the existing Qt CFLAGS as they might be problematic +QMAKE_CFLAGS = -march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -pipe -Os -mthumb +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=c++1z + +DISTRO_OPTS += hard-float +DISTRO_OPTS += deb-multi-arch + +EGLFS_DEVICE_INTEGRATION= eglfs_brcm + +include(../common/linux_arm_device_post.conf) + +load(qt_config) diff --git a/mkspecs/devices/linux-rpi3-g++/qplatformdefs.h b/mkspecs/devices/linux-rpi3-g++/qplatformdefs.h new file mode 100644 index 0000000000..5ae49b35dd --- /dev/null +++ b/mkspecs/devices/linux-rpi3-g++/qplatformdefs.h @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../linux-g++/qplatformdefs.h" -- cgit v1.2.3 From 57ecc00978115ec919d78be622c08d95f141032e Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 7 Apr 2016 11:43:00 -0700 Subject: Note the introductory version of network redirection related enums. These were missed in d815de8c26ccee33713e37a0fec2982755dcfe1f which originally added these values. Change-Id: I69618c90e71f7cc01eef3db477427759e62f626b Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Mandeep Sandhu --- src/network/access/qnetworkreply.cpp | 2 ++ src/network/access/qnetworkrequest.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 26f7034c09..a7565560ac 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -135,10 +135,12 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() \value TooManyRedirectsError while following redirects, the maximum limit was reached. The limit is by default set to 50 or as set by QNetworkRequest::setMaxRedirectsAllowed(). + (This value was introduced in 5.6.) \value InsecureRedirectError while following redirects, the network access API detected a redirect from a encrypted protocol (https) to an unencrypted one (http). + (This value was introduced in 5.6.) \value ProxyConnectionRefusedError the connection to the proxy server was refused (the proxy server is not accepting requests) diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index f5010198f3..2a62cb5f39 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -263,6 +263,7 @@ QT_BEGIN_NAMESPACE Indicates whether the Network Access API should automatically follow a HTTP redirect response or not. Currently redirects that are insecure, that is redirecting from "https" to "http" protocol, are not allowed. + (This value was introduced in 5.6.) \value User Special type. Additional information can be passed in -- cgit v1.2.3 From 8c427e5bdfcb54e19d10646d9ff45674077253c9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 23 Feb 2016 16:18:05 -0800 Subject: Autotest: confirm that QHostAddress obeys RFC 5952 recommendations Change-Id: I0c94a5c2846b48c8aea7ffff1435b8a7ccbd4d9e Reviewed-by: Richard J. Moore Reviewed-by: Edward Welbourne --- .../network/kernel/qhostaddress/tst_qhostaddress.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index 8069865d93..4d2d5fc67d 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -159,8 +159,16 @@ void tst_QHostAddress::setAddress_QString_data() QTest::newRow("ip4_06") << QString("123.0.0") << true << QString("123.0.0.0") << 4; // for the format of IPv6 addresses see also RFC 5952 - QTest::newRow("ip6_00") << QString("FEDC:BA98:7654:3210:FEDC:BA98:7654:3210") << true << QString("fedc:ba98:7654:3210:fedc:ba98:7654:3210") << 6; - QTest::newRow("ip6_01") << QString("1080:0000:0000:0000:0008:0800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; + // rule 4.1: Leading zeros MUST be suppressed + // rule 4.2.1: Shorten as Much as Possible + // rule 4.2.2: The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field. + // rule 4.2.3: the longest run of consecutive 16-bit 0 fields MUST be shortened + // When the length of the consecutive 16-bit 0 fields, the first sequence + // of zero bits MUST be shortened + // rule 4.3: The characters "a", "b", "c", "d", "e", and "f" in an IPv6 address + // MUST be represented in lowercase + QTest::newRow("ip6_00") << QString("FEDC:BA98:7654:3210:FEDC:BA98:7654:3210") << true << QString("fedc:ba98:7654:3210:fedc:ba98:7654:3210") << 6; // 4.3 + QTest::newRow("ip6_01") << QString("1080:0000:0000:0000:0008:0800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; // 4.1, 4.2.1 QTest::newRow("ip6_02") << QString("1080:0:0:0:8:800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; QTest::newRow("ip6_03") << QString("1080::8:800:200C:417A") << true << QString("1080::8:800:200c:417a") << 6; QTest::newRow("ip6_04") << QString("FF01::43") << true << QString("ff01::43") << 6; @@ -173,10 +181,11 @@ void tst_QHostAddress::setAddress_QString_data() QTest::newRow("ip6_11") << QString("::FFFF:129.144.52.38") << true << QString("::ffff:129.144.52.38") << 6; QTest::newRow("ip6_12") << QString("1::FFFF:129.144.52.38") << true << QString("1::ffff:8190:3426") << 6; QTest::newRow("ip6_13") << QString("A:B::D:E") << true << QString("a:b::d:e") << 6; - QTest::newRow("ip6_14") << QString("1080:0:1:0:8:800:200C:417A") << true << QString("1080:0:1:0:8:800:200c:417a") << 6; + QTest::newRow("ip6_14") << QString("1080:0:1:0:8:800:200C:417A") << true << QString("1080:0:1:0:8:800:200c:417a") << 6; // 4.2.2 QTest::newRow("ip6_15") << QString("1080:0:1:0:8:800:200C:0") << true << QString("1080:0:1:0:8:800:200c:0") << 6; QTest::newRow("ip6_16") << QString("1080:0:1:0:8:800:0:0") << true << QString("1080:0:1:0:8:800::") << 6; - QTest::newRow("ip6_17") << QString("1080:0:0:0:8:800:0:0") << true << QString("1080::8:800:0:0") << 6; + QTest::newRow("ip6_17a") << QString("1080:0:0:8:800:0:0:0") << true << QString("1080:0:0:8:800::") << 6; // 4.2.3a + QTest::newRow("ip6_17b") << QString("1080:0:0:0:8:0:0:0") << true << QString("1080::8:0:0:0") << 6; // 4.2.3b QTest::newRow("ip6_18") << QString("0:1:1:1:8:800:0:0") << true << QString("0:1:1:1:8:800::") << 6; QTest::newRow("ip6_19") << QString("0:1:1:1:8:800:0:1") << true << QString("0:1:1:1:8:800:0:1") << 6; -- cgit v1.2.3 From b6eea89b67e0d3bb4f8f888fff21257eff0b65a5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 3 Apr 2016 18:36:52 +0200 Subject: Fix crash when using QLockFile in a global destructor (for instance any global object which writes out to a config file in the destructor). If the global cache isn't available anymore, don't use it. Change-Id: I851a6e394d0b073aebf3ffd88b1966d424bfb92e Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/io/qlockfile_unix.cpp | 2 ++ tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 623968b869..bcef84206e 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -136,6 +136,8 @@ static QBasicMutex fcntlLock; static bool fcntlWorksAfterFlock(const QString &fn) { QMutexLocker lock(&fcntlLock); + if (fcntlOK.isDestroyed()) + return QLockFilePrivate::checkFcntlWorksAfterFlock(fn); bool *worksPtr = fcntlOK->object(fn); if (!worksPtr) { worksPtr = new bool(QLockFilePrivate::checkFcntlWorksAfterFlock(fn)); diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 21c5696d1d..4884c126d4 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -546,5 +546,15 @@ bool tst_QLockFile::overwritePidInLockFile(const QString &filePath, qint64 pid) return f.write(buf) == buf.size(); } +struct LockFileUsageInGlobalDtor +{ + ~LockFileUsageInGlobalDtor() { + QLockFile lockFile(QDir::currentPath() + "/lastlock"); + QVERIFY(lockFile.lock()); + QVERIFY(lockFile.isLocked()); + } +}; +LockFileUsageInGlobalDtor s_instance; + QTEST_MAIN(tst_QLockFile) #include "tst_qlockfile.moc" -- cgit v1.2.3 From 8686ff0d9c09af255a16d03a1f5a2f794c631424 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 27 Mar 2016 22:32:19 +0200 Subject: Doc: clarify redirection handling in QNetworkRequest The text for RedirectionTargetAttribute said the app has to handle redirections, and only said that this attribute wouldn't be set if FollowRedirectsAttribute is set, which was a bit confusing to read, before reading what exactly FollowRedirectsAttribute does. It does more than removing the other attribute, it actually follows the redirection... Change-Id: Idc634996e7b521ba05c05ca52438e47f1a411c85 Reviewed-by: Mandeep Sandhu Reviewed-by: Allan Sandfeld Jensen --- src/network/access/qnetworkrequest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 2a62cb5f39..29a7c2c46d 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -138,11 +138,12 @@ QT_BEGIN_NAMESPACE Replies only, type: QMetaType::QUrl (no default) If present, it indicates that the server is redirecting the request to a different URL. The Network Access API does not by - default follow redirections: it's up to the application to + default follow redirections: the application can determine if the requested redirection should be allowed, - according to its security policies. However, if - QNetworkRequest::FollowRedirectsAttribute is set, then this attribute - will not be present in the reply. + according to its security policies, or it can set + QNetworkRequest::FollowRedirectsAttribute to true (in which case + the redirection will be followed and this attribute will not + be present in the reply). The returned URL might be relative. Use QUrl::resolved() to create an absolute URL out of it. -- cgit v1.2.3 From 093eec6fedd46d4065056376c5d9b56deb249fae Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Thu, 24 Mar 2016 16:22:33 +0100 Subject: wince: Fix intrinsics for X86 platforms when SSE2 is enabled SSE2 can use intrinsics, which are supported by WEC2013, but for WEC7 they need to be defined. Change-Id: I261f3db4db7abcb0b59598cef9cbad404635c3ec Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Roth Reviewed-by: Kevin Funk Reviewed-by: Lars Knoll --- src/corelib/tools/qsimd_p.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 8171184ad2..ca53908cf5 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -432,7 +432,13 @@ static inline quint64 qCpuFeatures() #ifdef Q_PROCESSOR_X86 // Bit scan functions for x86 -# if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) +# if defined(Q_CC_MSVC) +# if defined _WIN32_WCE && _WIN32_WCE < 0x800 +extern "C" unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask); +extern "C" unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask); +# pragma intrinsic(_BitScanForward) +# pragma intrinsic(_BitScanReverse) +# endif // MSVC calls it _BitScanReverse and returns the carry flag, which we don't need static __forceinline unsigned long _bit_scan_reverse(uint val) { -- cgit v1.2.3 From 0328eec6a4efd52a8b75fa25b65e4cb3c28b96b3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Sun, 10 Apr 2016 12:11:53 +0200 Subject: Improve grammar in QUndoStack::beginMacro() documentation Change-Id: I4e27014a9a39abc03cee25f9753a46225efa43b9 Reviewed-by: Venugopal Shivashankar --- src/widgets/util/qundostack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 5163783b0b..5bcfa57b37 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -924,7 +924,7 @@ QAction *QUndoStack::createRedoAction(QObject *parent, const QString &prefix) co Calls to beginMacro() and endMacro() may be nested, but every call to beginMacro() must have a matching call to endMacro(). - While a macro is composed, the stack is disabled. This means that: + While a macro is being composed, the stack is disabled. This means that: \list \li indexChanged() and cleanChanged() are not emitted, \li canUndo() and canRedo() return false, -- cgit v1.2.3 From 7b4c02d527c448a3c8b3e9fa771e42f8bd7778ff Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 8 Apr 2016 17:21:07 +0200 Subject: Fix finding a helper executable in tst_QLocalSocket Use QFINDTESTDATA to find the socketprocess helper executable. Now tst_QLocalSocket::processConnection() passes when started from Qt Creator without adjusting the working directory. Change-Id: I97ca3334a381b3cd646647487529bcd90b969528 Reviewed-by: Thiago Macieira --- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index a96c88874e..99f40ca215 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -847,7 +847,8 @@ void tst_QLocalSocket::processConnection() const QString exeSuffix; #endif - QString socketProcess = QStringLiteral("socketprocess/socketprocess") + exeSuffix; + const QString socketProcess + = QFINDTESTDATA(QStringLiteral("socketprocess/socketprocess") + exeSuffix); QVERIFY(QFile::exists(socketProcess)); QFETCH(int, processes); -- cgit v1.2.3 From 045e417eff0a0efabd15d22361af7e6dff5f44f4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 3 Apr 2016 13:02:47 +0200 Subject: [doc] QElapsedTimer: mention more clearly which functions cause undefined behavior Change-Id: Ic7ab0d81689e2cc78f39f5f32beaea74ca10ce38 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- src/corelib/tools/qelapsedtimer_generic.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index 210d372e15..8679aec810 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -79,7 +79,8 @@ void QElapsedTimer::start() Q_DECL_NOTHROW and then starting the timer again with start(), but it does so in one single operation, avoiding the need to obtain the clock value twice. - Restarting the timer makes it valid again. + Calling this function on a QElapsedTimer that is invalid + results in undefined behavior. The following example illustrates how to use this function to calibrate a parameter to a slow operation (for example, an iteration count) so that @@ -87,7 +88,7 @@ void QElapsedTimer::start() Q_DECL_NOTHROW \snippet qelapsedtimer/main.cpp 3 - \sa start(), invalidate(), elapsed() + \sa start(), invalidate(), elapsed(), isValid() */ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW { @@ -100,8 +101,10 @@ qint64 QElapsedTimer::restart() Q_DECL_NOTHROW /*! \since 4.8 Returns the number of nanoseconds since this QElapsedTimer was last - started. Calling this function in a QElapsedTimer that was invalidated - will result in undefined results. + started. + + Calling this function on a QElapsedTimer that is invalid + results in undefined behavior. On platforms that do not provide nanosecond resolution, the value returned will be the best estimate available. @@ -115,10 +118,12 @@ qint64 QElapsedTimer::nsecsElapsed() const Q_DECL_NOTHROW /*! Returns the number of milliseconds since this QElapsedTimer was last - started. Calling this function in a QElapsedTimer that was invalidated - will result in undefined results. + started. - \sa start(), restart(), hasExpired(), invalidate() + Calling this function on a QElapsedTimer that is invalid + results in undefined behavior. + + \sa start(), restart(), hasExpired(), isValid(), invalidate() */ qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW { @@ -166,7 +171,8 @@ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const Q_DECL_NOTHROW \a other was started before this object, the returned value will be negative. If it was started later, the returned value will be positive. - The return value is undefined if this object or \a other were invalidated. + Calling this function on or with a QElapsedTimer that is invalid + results in undefined behavior. \sa msecsTo(), elapsed() */ -- cgit v1.2.3 From af32319803847dd97a4df7a6fc6100e193403fb2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 11 Apr 2016 10:09:21 +0200 Subject: QTreeView: re-use cached values in rowsInserted() The parentRowCount and the delta were already calculated a few lines up, so don't recalculate them here. This improves performance (rowCount() is a virtual function), as well as readability (delta is more readable than end - begin + 1). Change-Id: Iabe88852a61f7ef52139e1ba446e9d3f87d6bd04 Reviewed-by: Friedemann Kleint --- src/widgets/itemviews/qtreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index e6a6b2a447..135c417f15 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2568,7 +2568,7 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) if (((parentItem != -1) && d->viewItems.at(parentItem).expanded) || (parent == d->root)) { d->doDelayedItemsLayout(); - } else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) { + } else if (parentItem != -1 && parentRowCount == delta) { // the parent just went from 0 children to more. update to re-paint the decoration d->viewItems[parentItem].hasChildren = true; viewport()->update(); -- cgit v1.2.3 From 09487deeaea584b2abcc2b1049df2a8542bc113e Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Fri, 1 Apr 2016 13:42:32 +0200 Subject: WinRT: Enable broadcasts The CanBroadcast flag for QNetworkInterface indicates the ability to work in broadcast mode. As WinRT natively supports udp broadcasts and they work out of the box this flag should be set there. Task-number: QTBUG-49026 Change-Id: I6623014287fe63dc1c353a6de265ebdf9114d013 Reviewed-by: Maurice Kalinowski --- src/network/kernel/qnetworkinterface_winrt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/network/kernel/qnetworkinterface_winrt.cpp b/src/network/kernel/qnetworkinterface_winrt.cpp index 1945b2427f..d0a22e9a16 100644 --- a/src/network/kernel/qnetworkinterface_winrt.cpp +++ b/src/network/kernel/qnetworkinterface_winrt.cpp @@ -73,6 +73,7 @@ static QNetworkInterfacePrivate *interfaceFromProfile(IConnectionProfile *profil Q_ASSERT_SUCCEEDED(hr); if (connectivityLevel != NetworkConnectivityLevel_None) iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning; + iface->flags |= QNetworkInterface::CanBroadcast; ComPtr adapter; hr = profile->get_NetworkAdapter(&adapter); -- cgit v1.2.3 From 14399b427cdb7662cbca6aa89443521301507b41 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 6 Apr 2016 10:42:05 +0200 Subject: winrt: fix callbacks by moving them to the xaml thread Change-Id: I7b4f007107e21c02646140acd5ebe5745ca79bce Reviewed-by: Maurice Kalinowski --- src/network/socket/qnativesocketengine_winrt.cpp | 118 +++++++++++++---------- 1 file changed, 67 insertions(+), 51 deletions(-) diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 35b7d5474b..d1ebd19cca 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -298,8 +298,10 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) Q_ASSERT_SUCCEEDED(hr); d->socketState = QAbstractSocket::ConnectingState; - hr = d->connectOp->put_Completed(Callback( + hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + return d->connectOp->put_Completed(Callback( d, &QNativeSocketEnginePrivate::handleConnectToHost).Get()); + }); Q_ASSERT_SUCCEEDED(hr); return d->socketState == QAbstractSocket::ConnectedState; @@ -309,50 +311,53 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) { Q_D(QNativeSocketEngine); HRESULT hr; - ComPtr hostAddress; + hr = QEventDispatcherWinRT::runOnXamlThread([address, d, port, this]() { + HRESULT hr; + ComPtr hostAddress; - if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) { - ComPtr hostNameFactory; - hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), - &hostNameFactory); - Q_ASSERT_SUCCEEDED(hr); - const QString addressString = address.toString(); - HStringReference addressRef(reinterpret_cast(addressString.utf16())); - hr = hostNameFactory->CreateHostName(addressRef.Get(), &hostAddress); - RETURN_FALSE_IF_FAILED("QNativeSocketEngine::bind: Could not create hostname."); - } + if (address != QHostAddress::Any && address != QHostAddress::AnyIPv4 && address != QHostAddress::AnyIPv6) { + ComPtr hostNameFactory; + hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_HostName).Get(), + &hostNameFactory); + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not obtain hostname factory"); + const QString addressString = address.toString(); + HStringReference addressRef(reinterpret_cast(addressString.utf16())); + hr = hostNameFactory->CreateHostName(addressRef.Get(), &hostAddress); + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not create hostname."); + } - QString portQString = port ? QString::number(port) : QString(); - HStringReference portString(reinterpret_cast(portQString.utf16())); + QString portQString = port ? QString::number(port) : QString(); + HStringReference portString(reinterpret_cast(portQString.utf16())); - ComPtr op; - if (d->socketType == QAbstractSocket::TcpSocket) { - if (!d->tcpListener) { - hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(), - &d->tcpListener); - Q_ASSERT_SUCCEEDED(hr); - } + ComPtr op; + if (d->socketType == QAbstractSocket::TcpSocket) { + if (!d->tcpListener) { + hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_StreamSocketListener).Get(), + &d->tcpListener); + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not create tcp listener"); + } - hr = QEventDispatcherWinRT::runOnXamlThread([d]() { - return d->tcpListener->add_ConnectionReceived( + hr = d->tcpListener->add_ConnectionReceived( Callback(d, &QNativeSocketEnginePrivate::handleClientConnection).Get(), &d->connectionToken); - }); - Q_ASSERT_SUCCEEDED(hr); - hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); - } else if (d->socketType == QAbstractSocket::UdpSocket) { - hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); - } - if (hr == E_ACCESSDENIED) { - qErrnoWarning(hr, "Unable to bind socket (%s:%hu/%s). Please check your manifest capabilities.", - qPrintable(address.toString()), port, socketDescription(this).constData()); - return false; - } - Q_ASSERT_SUCCEEDED(hr); + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not register client connection callback"); + hr = d->tcpListener->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); + } else if (d->socketType == QAbstractSocket::UdpSocket) { + hr = d->udpSocket()->BindEndpointAsync(hostAddress.Get(), portString.Get(), &op); + } + if (hr == E_ACCESSDENIED) { + qErrnoWarning(hr, "Unable to bind socket (%s:%hu/%s). Please check your manifest capabilities.", + qPrintable(address.toString()), port, socketDescription(this).constData()); + return hr; + } + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Unable to bind socket"); - hr = op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleBindCompleted).Get()); - Q_ASSERT_SUCCEEDED(hr); - hr = QWinRTFunctions::await(op); + hr = op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleBindCompleted).Get()); + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not register bind callback"); + hr = QWinRTFunctions::await(op); + RETURN_HR_IF_FAILED("QNativeSocketEngine::bind: Could not wait for bind to finish"); + return S_OK; + }); Q_ASSERT_SUCCEEDED(hr); d->socketState = QAbstractSocket::BoundState; @@ -404,7 +409,9 @@ int QNativeSocketEngine::accept() socketDescription(this).constData()); return -1; } - hr = op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); + hr = QEventDispatcherWinRT::runOnXamlThread([d, op]() { + return op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); + }); if (FAILED(hr)) { qErrnoWarning(hr, "accept(): Failed to set socket read callback (%s).", socketDescription(this).constData()); @@ -774,18 +781,22 @@ void QNativeSocketEngine::establishRead() Q_D(QNativeSocketEngine); HRESULT hr; - ComPtr stream; - hr = d->tcpSocket()->get_InputStream(&stream); - RETURN_VOID_IF_FAILED("Failed to get socket input stream"); + hr = QEventDispatcherWinRT::runOnXamlThread([d]() { + ComPtr stream; + HRESULT hr = d->tcpSocket()->get_InputStream(&stream); + RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to get socket input stream"); - ComPtr buffer; - hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer); - Q_ASSERT_SUCCEEDED(hr); + ComPtr buffer; + hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer); + RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to create buffer"); - ComPtr op; - hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, &op); - RETURN_VOID_IF_FAILED("Failed to initiate socket read"); - hr = op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); + ComPtr op; + hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, &op); + RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to initiate socket read"); + hr = op->put_Completed(Callback(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); + RETURN_HR_IF_FAILED("QNativeSocketEngine::establishRead: Failed to register read callback"); + return S_OK; + }); Q_ASSERT_SUCCEEDED(hr); } @@ -807,7 +818,10 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &socket); Q_ASSERT_SUCCEEDED(hr); socketDescriptor = qintptr(socket.Detach()); - hr = udpSocket()->add_MessageReceived(Callback(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken); + hr = QEventDispatcherWinRT::runOnXamlThread([this]() { + HRESULT hr = udpSocket()->add_MessageReceived(Callback(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken); + return hr; + }); Q_ASSERT_SUCCEEDED(hr); break; } @@ -1297,7 +1311,9 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async socketDescription(q).constData()); return S_OK; } - hr = op->put_Completed(Callback(this, &QNativeSocketEnginePrivate::handleReadyRead).Get()); + hr = QEventDispatcherWinRT::runOnXamlThread([op, this]() { + return op->put_Completed(Callback(this, &QNativeSocketEnginePrivate::handleReadyRead).Get()); + }); if (FAILED(hr)) { qErrnoWarning(hr, "handleReadyRead(): Failed to set socket read callback (%s).", socketDescription(q).constData()); -- cgit v1.2.3 From cd17321213917607fe8804f90698ff94301aa3fc Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Wed, 6 Apr 2016 10:46:00 +0200 Subject: winrt: Use correct socket error on socket close Change-Id: I6d39b091e48a911534cb79d42d33d16041261cfb Reviewed-by: Maurice Kalinowski --- src/network/socket/qnativesocketengine_winrt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index d1ebd19cca..0ff76adecf 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -1246,7 +1246,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async // that the connection was closed. The socket cannot be closed here, as the subsequent read // might fail then. if (status == Error || status == Canceled) { - setError(QAbstractSocket::NetworkError, RemoteHostClosedErrorString); + setError(QAbstractSocket::RemoteHostClosedError, RemoteHostClosedErrorString); socketState = QAbstractSocket::UnconnectedState; if (notifyOnRead) emit q->readReady(); @@ -1265,7 +1265,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async // the closing of the socket won't be communicated to the caller. So only the error is set. The // actual socket close happens inside of read. if (!bufferLength) { - setError(QAbstractSocket::NetworkError, RemoteHostClosedErrorString); + setError(QAbstractSocket::RemoteHostClosedError, RemoteHostClosedErrorString); socketState = QAbstractSocket::UnconnectedState; if (notifyOnRead) emit q->readReady(); -- cgit v1.2.3 From e108db5a9ae9ef4495f09630b8d2f0feb1534550 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 11 Apr 2016 13:30:42 +0200 Subject: QTestlib: Document newly added enumeration value KeyAction:Shortcut. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends change 0e342fce4c665d72a50147c4f4b30ea08cc6c87b, fixing a qdoc warning: qtbase/src/testlib/qtestcase.qdoc:524: warning: Undocumented enum item 'Shortcut' in QTest::KeyAction Change-Id: I7a7116bd5ff160c4a13f2fb0f9512f0d71385a4b Reviewed-by: Leena Miettinen Reviewed-by: Tor Arne Vestbø --- src/testlib/qtestcase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 8de631094d..4643013371 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -645,6 +645,7 @@ static void stackTrace() \value Press The key is pressed. \value Release The key is released. \value Click The key is clicked (pressed and released). + \value Shortcut A shortcut is activated. This value has been added in Qt 5.6. */ /*! \enum QTest::MouseAction -- cgit v1.2.3 From f156c33c2739d84b97cdedf6ae9568b9cea728d5 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Fri, 1 Apr 2016 21:28:00 +0200 Subject: dbustray: Implement better detection of indicator-application We need to do the icon cache trick all desktops using indicator-application, these are not limited to Unity. For example, the default Xubuntu and Lubuntu desktops use indicator-application too. Without this, tray icons will be improperly shown on these desktops. Change-Id: Id397bbe9b594152d7c3a29c36c853e928af7dde4 Reviewed-by: Shawn Rutledge --- src/corelib/io/qlockfile_p.h | 3 ++- src/platformsupport/dbustray/qdbustrayicon.cpp | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h index 48b642abd0..468b4c0d29 100644 --- a/src/corelib/io/qlockfile_p.h +++ b/src/corelib/io/qlockfile_p.h @@ -75,7 +75,8 @@ public: // Returns \c true if the lock belongs to dead PID, or is old. // The attempt to delete it will tell us if it was really stale or not, though. bool isApparentlyStale() const; - static QString processNameByPid(qint64 pid); + // used in dbusmenu + Q_CORE_EXPORT static QString processNameByPid(qint64 pid); #ifdef Q_OS_UNIX static int checkFcntlWorksAfterFlock(const QString &fn); diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp index 87083c8a55..7dbdb3a35b 100644 --- a/src/platformsupport/dbustray/qdbustrayicon.cpp +++ b/src/platformsupport/dbustray/qdbustrayicon.cpp @@ -47,13 +47,19 @@ #include #include #include +#include +#include #include +// Defined in Windows headers which get included by qlockfile_p.h +#undef interface + QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray") static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2"); +static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher"); static const QString TempFileTemplate = QDir::tempPath() + QStringLiteral("/qt-trayicon-XXXXXX.png"); static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications"); static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications"); @@ -136,9 +142,17 @@ void QDBusTrayIcon::setStatus(const QString &status) QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon) { - // Hack for Unity, which doesn't handle icons sent across D-Bus: + // Hack for indicator-application, which doesn't handle icons sent across D-Bus: // save the icon to a temp file and set the icon name to that filename. - static bool necessary = (QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment().split(':').contains("UNITY")); + static bool necessity_checked = false; + static bool necessary = false; + if (!necessity_checked) { + QDBusConnection session = QDBusConnection::sessionBus(); + uint pid = session.interface()->servicePid(KDEWatcherService).value(); + QString processName = QLockFilePrivate::processNameByPid(pid); + necessary = processName.endsWith(QStringLiteral("indicator-application-service")); + necessity_checked = true; + } if (!necessary) return Q_NULLPTR; QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this); -- cgit v1.2.3 From 3f73ecd59aea46d6ddd8d5dc1e7d4ace6307bafa Mon Sep 17 00:00:00 2001 From: Elena Zaretskaya Date: Sat, 9 Apr 2016 00:36:34 +0400 Subject: Fix 2 cursors under EGLFS_KMS Don't create hwcursor if it is disabled in QT_QPA_EGLFS_KMS_CONFIG. Task-number: QTBUG-52403 Change-Id: I4e6f45d5b773dc2d50cd012179cd23452d910537 Reviewed-by: Laszlo Agocs --- .../platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp index c29d64c06d..8ba0a5cdd0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsdevice.cpp @@ -417,7 +417,7 @@ void QEglFSKmsDevice::createScreens() Q_FOREACH (QPlatformScreen *screen, siblings) static_cast(screen)->setVirtualSiblings(siblings); - if (primaryScreen) + if (primaryScreen && m_integration->hwCursor()) m_globalCursor = new QEglFSKmsCursor(primaryScreen); } } -- cgit v1.2.3 From 838fd4039e6ac48761cf1064d94b735902b014ac Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 6 Apr 2016 20:36:45 -0700 Subject: Fix bugs in accuracy of target path calculation in resolve_target. Incidentally, this introduces QMAKE_RESOLVED_BUNDLE, which can be used to determine the path of the bundle wrapper itself as well as the executable target. This is necessary for a subsequent patch adding support for -separate-debug-info on Apple platforms. Change-Id: Ia11430026b8e3f171e5db6677b190b8356832805 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/resolve_target.prf | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/resolve_target.prf b/mkspecs/features/resolve_target.prf index d6460c1d9d..5c3a46e117 100644 --- a/mkspecs/features/resolve_target.prf +++ b/mkspecs/features/resolve_target.prf @@ -33,7 +33,18 @@ win32 { mac { equals(TEMPLATE, lib) { lib_bundle { - QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET}.framework/$${TARGET} + !isEmpty(QMAKE_FRAMEWORK_BUNDLE_NAME): \ + framework_target = $$QMAKE_FRAMEWORK_BUNDLE_NAME + else: \ + framework_target = $$TARGET + QMAKE_RESOLVED_BUNDLE = $${QMAKE_RESOLVED_TARGET}$${framework_target}.framework + !shallow_bundle { + TEMP_VERSION = $$section(VERSION, ., 0, 0) + isEmpty(TEMP_VERSION):TEMP_VERSION = A + QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_BUNDLE}/Versions/$${TEMP_VERSION}/$${TARGET} + } else { + QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_BUNDLE}/$${TARGET} + } } else { QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET} !plugin { @@ -46,7 +57,15 @@ win32 { } } else { app_bundle { - QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET}.app/Contents/MacOS/$${TARGET} + !isEmpty(QMAKE_APPLICATION_BUNDLE_NAME): \ + app_target = $$QMAKE_APPLICATION_BUNDLE_NAME + else: \ + app_target = $$TARGET + QMAKE_RESOLVED_BUNDLE = $${QMAKE_RESOLVED_TARGET}$${app_target}.app + !shallow_bundle: \ + QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_BUNDLE}/Contents/MacOS/$${TARGET} + else: \ + QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_BUNDLE}/$${TARGET} } else { QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET} } -- cgit v1.2.3 From 7fb740f5186e90d9470c4245c9e9072cea3fd3d8 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Fri, 8 Apr 2016 16:50:29 -0700 Subject: Don't indicate which versions of OS X are supported in QSysInfo docs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is not done for other platforms (iOS or Windows) and eliminates a maintenance burden and potential of inconsistencies with other parts of the documentation (as illustrated by the fact that this page indicates the wrong minimum supported version). The Supported Platforms page will be the authoritative (and only) source of which particular versions of a given operating system are supported. Change-Id: I5a31f68965265f2dcd6515b1fa9385a9e9078274 Reviewed-by: Topi Reiniö Reviewed-by: Morten Johan Sørvig --- src/corelib/global/qglobal.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index e8c50dff2b..461b0f383d 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1121,13 +1121,13 @@ bool qSharedBuild() Q_DECL_NOTHROW QSysInfo::MacintoshVersion variable gives the version of the system on which the application is run. - \value MV_9 Mac OS 9 (unsupported) - \value MV_10_0 Mac OS X 10.0 (unsupported) - \value MV_10_1 Mac OS X 10.1 (unsupported) - \value MV_10_2 Mac OS X 10.2 (unsupported) - \value MV_10_3 Mac OS X 10.3 (unsupported) - \value MV_10_4 Mac OS X 10.4 (unsupported) - \value MV_10_5 Mac OS X 10.5 (unsupported) + \value MV_9 Mac OS 9 + \value MV_10_0 Mac OS X 10.0 + \value MV_10_1 Mac OS X 10.1 + \value MV_10_2 Mac OS X 10.2 + \value MV_10_3 Mac OS X 10.3 + \value MV_10_4 Mac OS X 10.4 + \value MV_10_5 Mac OS X 10.5 \value MV_10_6 Mac OS X 10.6 \value MV_10_7 Mac OS X 10.7 \value MV_10_8 OS X 10.8 -- cgit v1.2.3 From 5f41d344e9d66434be13a9644b4da08dd01974a9 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 6 Apr 2016 16:09:25 -0700 Subject: QNSView: Disable focus ring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not only we don't need Cocoa to display it for us, but it also seems to take a lot of time after the call to -[NSView setNeedsDisplayInRect:]. While resizing a large and busy widgets window, we can decrease the relative time spent in -[QNSView flushBackingStore:region: offset:] from over 15% down to around 3%. Change-Id: I2a8d51be28b77c4c3da2588d9a14e461e7910167 Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 90a7004938..7e9b9aa839 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -164,6 +164,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; } m_isMenuView = false; + self.focusRingType = NSFocusRingTypeNone; } return self; } -- cgit v1.2.3 From 0f7171f290f0d137b4034c617d4c1fd169079209 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Mon, 11 Apr 2016 10:55:30 +0200 Subject: Better error message when trying to load an invalid resource Before this change QFile::errorString function was returning an "Unknown error". Now it will return the typical ENOENT string. Task-number: QTBUG-45259 Change-Id: Ib7634f1aa5d91f77151cf92c58d3956e20a4cc6b Reviewed-by: hjk --- src/corelib/io/qresource.cpp | 6 ++++-- tests/auto/corelib/io/qfile/tst_qfile.cpp | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 0674ef34e0..c584933b97 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1252,8 +1252,10 @@ bool QResourceFileEngine::open(QIODevice::OpenMode flags) } if(flags & QIODevice::WriteOnly) return false; - if(!d->resource.isValid()) - return false; + if (!d->resource.isValid()) { + d->errorString = qt_error_string(ENOENT); + return false; + } return true; } diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 1c695a1113..b1e383dda1 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -543,6 +543,10 @@ void tst_QFile::open_data() << false << QFile::OpenError; QTest::newRow("noreadfile") << QString::fromLatin1(noReadFile) << int(QIODevice::ReadOnly) << false << QFile::OpenError; + QTest::newRow("resource_file") << QString::fromLatin1(":/does/not/exist") + << int(QIODevice::ReadOnly) + << false + << QFile::OpenError; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //opening devices requires administrative privileges (and elevation). HANDLE hTest = CreateFile(_T("\\\\.\\PhysicalDrive0"), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); -- cgit v1.2.3 From 51f040866b3a50e2e8de180a157f51f261531eb0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Apr 2016 13:47:08 +0200 Subject: remove empty dylib.prf it doesn't appear to be referenced in any way, either. Change-Id: Ifd30b435e3e628cd5e48ae24e9aef01c662d6d61 Reviewed-by: Joerg Bornemann --- mkspecs/features/unix/dylib.prf | 1 - 1 file changed, 1 deletion(-) delete mode 100644 mkspecs/features/unix/dylib.prf diff --git a/mkspecs/features/unix/dylib.prf b/mkspecs/features/unix/dylib.prf deleted file mode 100644 index 8b13789179..0000000000 --- a/mkspecs/features/unix/dylib.prf +++ /dev/null @@ -1 +0,0 @@ - -- cgit v1.2.3 From 949aaffb4fda892f39ae488496db2270a65cb1c1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Mar 2016 15:50:37 +0100 Subject: tst_QNetworkReply: fix mis-guided use of QSKIP(). QSKIP() causes the whole test to be skipped, where this work-around for a known quirk of the test server only requires skipping a single Q_COMPARE(); the rest of the test passes fine without it. Change-Id: Ie4612bd428f4cb4b342fad908cc2784fbadf069c Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index ce56dcacba..088b721a89 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6814,9 +6814,9 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); - if (reply->error() == QNetworkReply::HostNotFoundError) - QSKIP("skip because of quirk in the old test server"); - QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); + // Work round known quirk in the old test server: + if (reply->error() != QNetworkReply::HostNotFoundError) + QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); QCOMPARE(authSpy.count(), 0); QVERIFY(proxyAuthSpy.count() > 0); proxyAuthSpy.clear(); -- cgit v1.2.3 From 541c9d4d2acd045459c3e75eee80c63b36af9ed0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Mar 2016 17:00:29 +0100 Subject: tst_QNetworkReply: Commentary fixes on test server workarounds. Follow-up to commit 6fd205d5: document which version of danted shall make one work-around redundant, document that another work-around is still needed even with that v1.1.19; and remove a comment that referred back to an XFAIL that commit 6fd205d5 removed. Change-Id: I270b662528127c82184bff20b3cecea4f0c41b41 Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 088b721a89..02aca3d6c1 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6814,19 +6814,19 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); - // Work round known quirk in the old test server: + // Work round known quirk in the old test server (danted -v < v1.1.19): if (reply->error() != QNetworkReply::HostNotFoundError) QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); QCOMPARE(authSpy.count(), 0); QVERIFY(proxyAuthSpy.count() > 0); proxyAuthSpy.clear(); - //QTBUG-23136 workaround + // QTBUG-23136 workaround (needed even with danted v1.1.19): if (proxy.port() == 1081) { #ifdef QT_BUILD_INTERNAL QNetworkAccessManagerPrivate::clearCache(&manager); #else - return; //XFAIL result above + return; #endif } -- cgit v1.2.3