summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-20 13:46:21 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-05-23 21:09:46 +0200
commit56d6e000f7487c59172330ebd23a718268c508f1 (patch)
tree1494432583b1569816075091a8075b31d795f77c /src
parent9fd407fc6a29c94b4568dd042a05c208255179e0 (diff)
parentc276aa51303b7c6f8e4cd854aadf8344a906e50f (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: mkspecs/wince80colibri-armv7-msvc2012/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/corelib/global/qnamespace.h src/corelib/global/qnamespace.qdoc src/corelib/io/qfsfileengine_win.cpp src/corelib/tools/tools.pri src/network/ssl/qsslconfiguration_p.h src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/plugins/platforms/windows/windows.pri src/src.pro src/tools/bootstrap/bootstrap.pro src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/dialogs/qfilesystemmodel.cpp tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp3
-rw-r--r--src/3rdparty/angle/src/libANGLE/validationEGL.cpp3
-rw-r--r--src/3rdparty/freetype/freetype.pro8
-rw-r--r--src/3rdparty/zlib_dependency.pri4
-rw-r--r--src/angle/patches/0010-ANGLE-fixed-usage-of-shared-handles-for-WinRT-WinPho.patch57
-rw-r--r--src/angle/patches/0011-ANGLE-Disable-support-for-shared-handles-in-warp-mod.patch44
-rw-r--r--src/concurrent/concurrent.pro3
-rw-r--r--src/concurrent/doc/qtconcurrent.qdocconf2
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/doc/qtcore.qdocconf2
-rw-r--r--src/corelib/global/qglobal.h9
-rw-r--r--src/corelib/global/qlogging.cpp140
-rw-r--r--src/corelib/global/qnamespace.h3
-rw-r--r--src/corelib/global/qnamespace.qdoc11
-rw-r--r--src/corelib/global/qprocessordetection.h2
-rw-r--r--src/corelib/io/qdebug.cpp11
-rw-r--r--src/corelib/io/qdebug.h9
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp2
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp66
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp4
-rw-r--r--src/corelib/kernel/qvariant.cpp22
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp6
-rw-r--r--src/corelib/thread/qbasicatomic.h4
-rw-r--r--src/corelib/thread/qmutex_linux.cpp41
-rw-r--r--src/corelib/tools/qarraydata.cpp6
-rw-r--r--src/corelib/tools/qarraydata.h4
-rw-r--r--src/corelib/tools/qarraydatapointer.h2
-rw-r--r--src/corelib/tools/qcontiguouscache.h2
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp17
-rw-r--r--src/corelib/tools/qelapsedtimer_unix.cpp3
-rw-r--r--src/corelib/tools/qhash.h5
-rw-r--r--src/corelib/tools/qhashfunctions.h3
-rw-r--r--src/corelib/tools/qlinkedlist.h2
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qmap.h2
-rw-r--r--src/corelib/tools/qrefcount.h6
-rw-r--r--src/corelib/tools/qset.h2
-rw-r--r--src/corelib/tools/qsharedpointer.cpp11
-rw-r--r--src/corelib/tools/qsharedpointer.h2
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h11
-rw-r--r--src/corelib/tools/qsimd.cpp6
-rw-r--r--src/corelib/tools/qvector.h8
-rw-r--r--src/corelib/tools/tools.pri1
-rw-r--r--src/dbus/dbus.pro2
-rw-r--r--src/dbus/doc/qtdbus.qdocconf2
-rw-r--r--src/dbus/qdbusconnection_p.h2
-rw-r--r--src/dbus/qdbusintegrator.cpp31
-rw-r--r--src/gui/doc/qtgui.qdocconf2
-rw-r--r--src/gui/opengl/qopengl.cpp50
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp3
-rw-r--r--src/gui/painting/qstroker.cpp2
-rw-r--r--src/gui/text/qfont.cpp3
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp103
-rw-r--r--src/network/access/qnetworkaccessmanager.h2
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h5
-rw-r--r--src/network/doc/qtnetwork.qdocconf2
-rw-r--r--src/network/kernel/qauthenticator.cpp2
-rw-r--r--src/network/network.pro2
-rw-r--r--src/network/socket/qhttpsocketengine.cpp34
-rw-r--r--src/network/socket/qlocalsocket_p.h2
-rw-r--r--src/network/socket/qlocalsocket_win.cpp6
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp34
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h2
-rw-r--r--src/network/ssl/qsslconfiguration.cpp2
-rw-r--r--src/network/ssl/qsslconfiguration_p.h1
-rw-r--r--src/network/ssl/qsslcontext_openssl.cpp2
-rw-r--r--src/opengl/doc/qtopengl.qdocconf2
-rw-r--r--src/opengl/opengl.pro3
-rw-r--r--src/openglextensions/openglextensions.pro3
-rw-r--r--src/platformheaders/doc/qtplatformheaders.qdocconf2
-rw-r--r--src/platformsupport/clipboard/qmacmime.mm8
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenuconnection.cpp5
-rw-r--r--src/platformsupport/dbusmenu/qdbusmenuconnection_p.h2
-rw-r--r--src/platformsupport/dbustray/qdbustrayicon.cpp2
-rw-r--r--src/platformsupport/eglconvenience/qeglpbuffer_p.h2
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore.cpp11
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp5
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm2
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm65
-rw-r--r--src/plugins/bearer/nativewifi/main.cpp59
-rw-r--r--src/plugins/imageformats/ico/qicohandler.cpp10
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h39
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm37
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp57
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h30
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.cpp1
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsdeviceintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsglobal.h13
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.h1
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h3
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp2
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp6
-rw-r--r--src/plugins/platforms/windows/openglblacklists/default.json12
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp6
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp16
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp1
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp61
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp9
-rw-r--r--src/printsupport/doc/qtprintsupport.qdocconf2
-rw-r--r--src/printsupport/printsupport.pro2
-rw-r--r--src/sql/doc/qtsql.qdocconf2
-rw-r--r--src/sql/models/qsqltablemodel.cpp2
-rw-r--r--src/sql/sql.pro2
-rw-r--r--src/src.pro10
-rw-r--r--src/testlib/doc/qttestlib.qdocconf2
-rw-r--r--src/testlib/qtestcase.h2
-rw-r--r--src/testlib/testlib.pro1
-rw-r--r--src/tools/bootstrap-dbus/bootstrap-dbus.pro1
-rw-r--r--src/tools/bootstrap/bootstrap.pro9
-rw-r--r--src/tools/moc/moc.cpp8
-rw-r--r--src/tools/moc/moc.pro7
-rw-r--r--src/tools/moc/preprocessor.cpp6
-rw-r--r--src/tools/qdbuscpp2xml/qdbuscpp2xml.pro2
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.pro2
-rw-r--r--src/tools/qlalr/qlalr.pro3
-rw-r--r--src/tools/rcc/rcc.pro2
-rw-r--r--src/tools/uic/uic.pro2
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp14
-rw-r--r--src/widgets/accessible/qaccessiblemenu_p.h2
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp10
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp35
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp21
-rw-r--r--src/widgets/doc/qtwidgets.qdocconf2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/widgets.qdoc6
-rw-r--r--src/widgets/itemviews/qtableview.cpp23
-rw-r--r--src/widgets/kernel/qapplication.cpp8
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp99
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp27
-rw-r--r--src/widgets/kernel/qwidgetwindow_p.h2
-rw-r--r--src/widgets/util/qundostack.cpp2
-rw-r--r--src/widgets/widgets/qlineedit.cpp1
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp59
-rw-r--r--src/widgets/widgets/qlineedit_p.h15
-rw-r--r--src/widgets/widgets/qmenubar.cpp55
-rw-r--r--src/widgets/widgets/qmenubar_p.h3
-rw-r--r--src/winmain/qtmain_winrt.cpp2
-rw-r--r--src/winmain/winmain.pro4
-rw-r--r--src/xml/doc/qtxml.qdocconf2
-rw-r--r--src/xml/xml.pro3
154 files changed, 1202 insertions, 630 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 62badccefc..0173311bc6 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -2618,12 +2618,15 @@ bool Renderer11::getShareHandleSupport() const
return false;
}
+ // Qt: we don't care about the 9_3 limitation
+#if 0
// Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
{
mSupportsShareHandles = false;
return false;
}
+#endif
// Find out which type of D3D11 device the Renderer11 is using
d3d11::ANGLED3D11DeviceType deviceType = getDeviceType();
diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
index 972f6a7a5a..903f51b158 100644
--- a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
+++ b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
@@ -642,11 +642,14 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
return Error(EGL_BAD_ATTRIBUTE);
}
+// On Windows Store, we know the originating texture came from D3D11, so bypass this check
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
const Caps &caps = display->getCaps();
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height)))
{
return Error(EGL_BAD_MATCH);
}
+#endif
}
return Error(EGL_SUCCESS);
diff --git a/src/3rdparty/freetype/freetype.pro b/src/3rdparty/freetype/freetype.pro
index d73d8ece55..e85ed1699b 100644
--- a/src/3rdparty/freetype/freetype.pro
+++ b/src/3rdparty/freetype/freetype.pro
@@ -64,10 +64,10 @@ win32 {
INCLUDEPATH += $$PWD/include
DEFINES += FT2_BUILD_LIBRARY
-contains(QT_CONFIG, system-zlib) {
- DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
- include($$PWD/../zlib_dependency.pri)
-}
+
+DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
+include(../zlib_dependency.pri)
+
contains(QT_CONFIG, system-png) {
DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri)
diff --git a/src/3rdparty/zlib_dependency.pri b/src/3rdparty/zlib_dependency.pri
index 0bcb9f9e5e..53e0b3ef39 100644
--- a/src/3rdparty/zlib_dependency.pri
+++ b/src/3rdparty/zlib_dependency.pri
@@ -7,4 +7,8 @@ contains(QT_CONFIG, system-zlib) {
}
} else {
INCLUDEPATH += $$PWD/zlib
+ !no_core_dep {
+ CONFIG += qt
+ QT_PRIVATE += core
+ }
}
diff --git a/src/angle/patches/0010-ANGLE-fixed-usage-of-shared-handles-for-WinRT-WinPho.patch b/src/angle/patches/0010-ANGLE-fixed-usage-of-shared-handles-for-WinRT-WinPho.patch
new file mode 100644
index 0000000000..8f17018e6e
--- /dev/null
+++ b/src/angle/patches/0010-ANGLE-fixed-usage-of-shared-handles-for-WinRT-WinPho.patch
@@ -0,0 +1,57 @@
+From 5cacddc702624d64a4917a7a704dbbb92aeba53c Mon Sep 17 00:00:00 2001
+From: Oliver Wolff <oliver.wolff@qt.io>
+Date: Thu, 19 May 2016 10:55:46 +0200
+Subject: [PATCH] ANGLE: fixed usage of shared handles for WinRT/WinPhone
+ applications
+
+Both checks are not relevant in Qt's context and were skipped before but
+they sneaked back in with the latest ANGLE update.
+
+Change-Id: Ic44de5468a3254afd76ef4804d97d245676daeb1
+---
+ src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 3 +++
+ src/3rdparty/angle/src/libANGLE/validationEGL.cpp | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+index 62badcc..0173311 100644
+--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+@@ -2618,12 +2618,15 @@ bool Renderer11::getShareHandleSupport() const
+ return false;
+ }
+
++ // Qt: we don't care about the 9_3 limitation
++#if 0
+ // Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
+ if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
+ {
+ mSupportsShareHandles = false;
+ return false;
+ }
++#endif
+
+ // Find out which type of D3D11 device the Renderer11 is using
+ d3d11::ANGLED3D11DeviceType deviceType = getDeviceType();
+diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
+index 972f6a7..903f51b 100644
+--- a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
++++ b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp
+@@ -642,11 +642,14 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
+ return Error(EGL_BAD_ATTRIBUTE);
+ }
+
++// On Windows Store, we know the originating texture came from D3D11, so bypass this check
++#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+ const Caps &caps = display->getCaps();
+ if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height)))
+ {
+ return Error(EGL_BAD_MATCH);
+ }
++#endif
+ }
+
+ return Error(EGL_SUCCESS);
+--
+2.7.0.windows.1
+
diff --git a/src/angle/patches/0011-ANGLE-Disable-support-for-shared-handles-in-warp-mod.patch b/src/angle/patches/0011-ANGLE-Disable-support-for-shared-handles-in-warp-mod.patch
new file mode 100644
index 0000000000..1c4ee1d513
--- /dev/null
+++ b/src/angle/patches/0011-ANGLE-Disable-support-for-shared-handles-in-warp-mod.patch
@@ -0,0 +1,44 @@
+From db13a9cf7e41207660f080827983655864df802d Mon Sep 17 00:00:00 2001
+From: Oliver Wolff <oliver.wolff@qt.io>
+Date: Wed, 11 May 2016 13:51:54 +0200
+Subject: [PATCH] ANGLE: Disable support for shared handles in warp mode on
+ Windows < 8
+
+Shared handles are not supported on Windows 7 and below. If the
+according flag is set CreateTexture2D will fail with E_OUTOFMEMORY. The
+check already happens with newer ANGLE versions, which we use in 5.7
+but has to happen here as well. Otherwise Qt applications running on
+Windows 7 and below will crash at startup.
+
+Change-Id: I8f539f16dce298611fb1ec7b2f6804d4a04d04e0
+---
+ .../angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+index 223e2b0..dd554f4 100644
+--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+@@ -2370,6 +2370,19 @@ unsigned int Renderer11::getReservedFragmentUniformBuffers() const
+
+ bool Renderer11::getShareHandleSupport() const
+ {
++ if (mDriverType == D3D_DRIVER_TYPE_WARP)
++ {
++#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
++ // Warp mode does not support shared handles in Windows versions below Windows 8
++ OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
++ if (GetVersionEx(&result) &&
++ ((result.dwMajorVersion == 6 && result.dwMinorVersion < 2) || result.dwMajorVersion < 6))
++ {
++ // WARP on Windows 7 doesn't support shared handles
++ return false;
++ }
++#endif // ANGLE_ENABLE_WINDOWS_STORE
++ }
+ // We only currently support share handles with BGRA surfaces, because
+ // chrome needs BGRA. Once chrome fixes this, we should always support them.
+ // PIX doesn't seem to support using share handles, so disable them.
+--
+2.7.0.windows.1
+
diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro
index 2a519314f3..fd15a3c758 100644
--- a/src/concurrent/concurrent.pro
+++ b/src/concurrent/concurrent.pro
@@ -2,7 +2,8 @@ TARGET = QtConcurrent
QT = core-private
CONFIG += exceptions
-DEFINES += QT_NO_USING_NAMESPACE
+DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
+
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf
index 3cd2fac075..d8ee963ef5 100644
--- a/src/concurrent/doc/qtconcurrent.qdocconf
+++ b/src/concurrent/doc/qtconcurrent.qdocconf
@@ -4,7 +4,7 @@ project = QtConcurrent
description = Qt Concurrent Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/qtconcurrent
+examplesinstallpath = qtconcurrent
qhp.projects = QtConcurrent
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index aea3f54bb5..ccf9aaa612 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -8,7 +8,7 @@ MODULE_CONFIG = moc resources
CONFIG += $$MODULE_CONFIG
DEFINES += $$MODULE_DEFINES
-DEFINES += QT_NO_USING_NAMESPACE
+DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index e98f06d47d..3d64708def 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -4,7 +4,7 @@ project = QtCore
description = Qt Core Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/corelib
+examplesinstallpath = corelib
qhp.projects = QtCore
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 38ced26ea4..78b7cec915 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -61,6 +61,9 @@
#include <QtCore/qfeatures.h>
#endif
+// The QT_SUPPORTS macro is deprecated. Don't use it in new code.
+// Instead, use #ifdef/ndef QT_NO_feature.
+// ### Qt6: remove macro
#ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else
@@ -920,6 +923,8 @@ QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantic
# endif
#endif
+#ifndef QT_NO_FOREACH
+
template <typename T>
class QForeachContainer {
QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE;
@@ -945,11 +950,15 @@ for (QForeachContainer<typename QtPrivate::remove_reference<decltype(container)>
++_container_.i, _container_.control ^= 1) \
for (variable = *_container_.i; _container_.control; _container_.control = 0)
+#endif // QT_NO_FOREACH
+
#define Q_FOREVER for(;;)
#ifndef QT_NO_KEYWORDS
+# ifndef QT_NO_FOREACH
# ifndef foreach
# define foreach Q_FOREACH
# endif
+# endif // QT_NO_FOREACH
# ifndef forever
# define forever Q_FOREVER
# endif
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 6dc453009b..0fe095b8d3 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -54,6 +54,7 @@
#include "qthread.h"
#include "private/qloggingregistry_p.h"
#include "private/qcoreapplication_p.h"
+#include "private/qsimd_p.h"
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
@@ -1193,6 +1194,89 @@ void QMessagePattern::setPattern(const QString &pattern)
memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*));
}
+#if defined(QLOGGING_HAVE_BACKTRACE) && !defined(QT_BOOTSTRAPPED)
+// make sure the function has "Message" in the name so the function is removed
+
+#if (defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)
+// force skipping the frame pointer, to save the backtrace() function some work
+__attribute__((optimize("omit-frame-pointer")))
+#endif
+static QStringList backtraceFramesForLogMessage(int frameCount)
+{
+ QStringList result;
+ if (frameCount == 0)
+ return result;
+
+ // The results of backtrace_symbols looks like this:
+ // /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413]
+ // The offset and function name are optional.
+ // This regexp tries to extract the library name (without the path) and the function name.
+ // This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
+ static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"),
+ QRegularExpression::OptimizeOnFirstUsageOption);
+
+ QVarLengthArray<void*, 32> buffer(7 + frameCount);
+ int n = backtrace(buffer.data(), buffer.size());
+ if (n > 0) {
+ int numberPrinted = 0;
+ for (int i = 0; i < n && numberPrinted < frameCount; ++i) {
+ QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
+ QString trace = QString::fromLatin1(strings.data()[0]);
+ QRegularExpressionMatch m = rx.match(trace);
+ if (m.hasMatch()) {
+ QString library = m.captured(1);
+ QString function = m.captured(2);
+
+ // skip the trace from QtCore that are because of the qDebug itself
+ if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
+ && (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
+ || function.contains(QLatin1String("QDebug")))) {
+ continue;
+ }
+
+ if (function.startsWith(QLatin1String("_Z"))) {
+ QScopedPointer<char, QScopedPointerPodDeleter> demangled(
+ abi::__cxa_demangle(function.toUtf8(), 0, 0, 0));
+ if (demangled)
+ function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
+ }
+
+ if (function.isEmpty()) {
+ result.append(QLatin1Char('?') + library + QLatin1Char('?'));
+ } else {
+ result.append(function);
+ }
+ } else {
+ if (numberPrinted == 0) {
+ // innermost, unknown frames are usually the logging framework itself
+ continue;
+ }
+ result.append(QStringLiteral("???"));
+ }
+ numberPrinted++;
+ }
+ }
+ return result;
+}
+
+static QString formatBacktraceForLogMessage(const QMessagePattern::BacktraceParams backtraceParams,
+ const char *function)
+{
+ QString backtraceSeparator = backtraceParams.backtraceSeparator;
+ int backtraceDepth = backtraceParams.backtraceDepth;
+
+ QStringList frames = backtraceFramesForLogMessage(backtraceDepth);
+ if (frames.isEmpty())
+ return QString();
+
+ // if the first frame is unknown, replace it with the context function
+ if (function && frames.at(0).startsWith(QLatin1Char('?')))
+ frames[0] = QString::fromUtf8(qCleanupFuncinfo(function));
+
+ return frames.join(backtraceSeparator);
+}
+#endif // QLOGGING_HAVE_BACKTRACE && !QT_BOOTSTRAPPED
+
#if defined(QT_USE_SLOG2)
#ifndef QT_LOG_CODE
#define QT_LOG_CODE 9000
@@ -1336,62 +1420,8 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con
#ifdef QLOGGING_HAVE_BACKTRACE
} else if (token == backtraceTokenC) {
QMessagePattern::BacktraceParams backtraceParams = pattern->backtraceArgs.at(backtraceArgsIdx);
- QString backtraceSeparator = backtraceParams.backtraceSeparator;
- int backtraceDepth = backtraceParams.backtraceDepth;
backtraceArgsIdx++;
- QVarLengthArray<void*, 32> buffer(7 + backtraceDepth);
- int n = backtrace(buffer.data(), buffer.size());
- if (n > 0) {
- int numberPrinted = 0;
- for (int i = 0; i < n && numberPrinted < backtraceDepth; ++i) {
- QScopedPointer<char*, QScopedPointerPodDeleter> strings(backtrace_symbols(buffer.data() + i, 1));
- QString trace = QString::fromLatin1(strings.data()[0]);
- // The results of backtrace_symbols looks like this:
- // /lib/libc.so.6(__libc_start_main+0xf3) [0x4a937413]
- // The offset and function name are optional.
- // This regexp tries to extract the librry name (without the path) and the function name.
- // This code is protected by QMessagePattern::mutex so it is thread safe on all compilers
- static QRegularExpression rx(QStringLiteral("^(?:[^(]*/)?([^(/]+)\\(([^+]*)(?:[\\+[a-f0-9x]*)?\\) \\[[a-f0-9x]*\\]$"),
- QRegularExpression::OptimizeOnFirstUsageOption);
-
- QRegularExpressionMatch m = rx.match(trace);
- if (m.hasMatch()) {
- // skip the trace from QtCore that are because of the qDebug itself
- QString library = m.captured(1);
- QString function = m.captured(2);
- if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
- && (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
- || function.contains(QLatin1String("QDebug")))) {
- continue;
- }
-
- if (function.startsWith(QLatin1String("_Z"))) {
- QScopedPointer<char, QScopedPointerPodDeleter> demangled(
- abi::__cxa_demangle(function.toUtf8(), 0, 0, 0));
- if (demangled)
- function = QString::fromUtf8(qCleanupFuncinfo(demangled.data()));
- }
-
- if (numberPrinted > 0)
- message.append(backtraceSeparator);
-
- if (function.isEmpty()) {
- if (numberPrinted == 0 && context.function)
- message += QString::fromUtf8(qCleanupFuncinfo(context.function));
- else
- message += QLatin1Char('?') + library + QLatin1Char('?');
- } else {
- message += function;
- }
-
- } else {
- if (numberPrinted == 0)
- continue;
- message += backtraceSeparator + QLatin1String("???");
- }
- numberPrinted++;
- }
- }
+ message.append(formatBacktraceForLogMessage(backtraceParams, context.function));
#endif
} else if (token == timeTokenC) {
QString timeFormat = pattern->timeArgs.at(timeArgsIdx);
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 06b0f824f6..edb568a2d6 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -503,7 +503,8 @@ public:
AA_UseStyleSheetPropagationInWidgetStyles = 22, // ### Qt 6: remove me
AA_DontUseNativeDialogs = 23,
AA_SynthesizeMouseForUnhandledTabletEvents = 24,
- AA_DontCheckOpenGLContextThreadAffinity = 25,
+ AA_CompressHighFrequencyEvents = 25,
+ AA_DontCheckOpenGLContextThreadAffinity = 26,
// Add new attributes before this line
AA_AttributeCount
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 9878ce046a..d8a0acabf1 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -239,6 +239,17 @@
to mouse events instead. This attribute is enabled
by default. This value has been added in Qt 5.7.
+ \value AA_CompressHighFrequencyEvents Enables compression of certain frequent events.
+ On the X11 windowing system, the default value is true, which means that
+ QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and
+ position will be combined whenever they occur more frequently than the
+ application handles them, so that they don't accumulate and overwhelm the
+ application later. On other platforms, the default is false.
+ (In the future, the compression feature may be implemented across platforms.)
+ You can test the attribute to see whether compression is enabled.
+ If your application needs to handle all events with no compression,
+ you can unset this attribute. This value has been added in Qt 5.7.
+
\value AA_DontCheckOpenGLContextThreadAffinity When making a context
current using QOpenGLContext, do not check that the
\l{QObject#Thread Affinity}{QObject thread affinity}
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index ee94720e7a..6ecd41bc30 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -107,7 +107,7 @@
# define Q_PROCESSOR_ARM __TARGET_ARCH_ARM
# elif defined(_M_ARM) && _M_ARM > 1
# define Q_PROCESSOR_ARM _M_ARM
-# elif defined(__ARM64_ARCH_8__)
+# elif defined(__ARM64_ARCH_8__) || defined(__aarch64__)
# define Q_PROCESSOR_ARM 8
# elif defined(__ARM_ARCH_7__) \
|| defined(__ARM_ARCH_7A__) \
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index ffa7867d18..0d9fdb3453 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -794,6 +794,17 @@ QDebug &QDebug::resetFormat()
*/
/*!
+ \fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
+ \relates QSharedPointer
+ \since 5.7
+
+ Writes the pointer tracked by \a ptr into the debug object \a debug for
+ debugging purposes.
+
+ \sa {Debugging Techniques}
+*/
+
+/*!
\class QDebugStateSaver
\inmodule QtCore
\brief Convenience class for custom QDebug operators
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 5087e3b532..8021f29e16 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -51,6 +51,7 @@
#include <QtCore/qvector.h>
#include <QtCore/qset.h>
#include <QtCore/qcontiguouscache.h>
+#include <QtCore/qsharedpointer.h>
// all these have already been included by various headers above, but don't rely on indirect includes:
#include <vector>
@@ -330,6 +331,14 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.maybeSpace();
}
+template <class T>
+inline QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
+ return debug;
+}
+
Q_CORE_EXPORT void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, int value);
template <typename Int>
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index dd71c68edc..8375dc9b1b 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -812,7 +812,9 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
#if !defined(Q_OS_WINRT)
if (fname.isDriveRoot()) {
// a valid drive ??
+ const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
DWORD drivesBitmask = ::GetLogicalDrives();
+ ::SetErrorMode(oldErrorMode);
int drivebit = 1 << (fname.filePath().at(0).toUpper().unicode() - QLatin1Char('A').unicode());
if (drivesBitmask & drivebit) {
fileAttrib = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 1e041ab837..70c347978e 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -551,7 +551,9 @@ QFileInfoList QFSFileEngine::drives()
QFileInfoList ret;
#if !defined(Q_OS_WINRT)
# if defined(Q_OS_WIN32)
+ const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff;
+ ::SetErrorMode(oldErrorMode);
# endif
char driveName[] = "A:/";
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index a826bcbd9b..3a9f74bf59 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -108,25 +108,6 @@
QT_BEGIN_NAMESPACE
-static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
-{
- if (mountDir.startsWith(QLatin1String("/dev"))
- || mountDir.startsWith(QLatin1String("/proc"))
- || mountDir.startsWith(QLatin1String("/sys"))
- || mountDir.startsWith(QLatin1String("/var/run"))
- || mountDir.startsWith(QLatin1String("/var/lock"))) {
- return true;
- }
- if (type == "tmpfs")
- return true;
-#if defined(Q_OS_LINUX)
- if (type == "rootfs" || type == "rpc_pipefs")
- return true;
-#endif
-
- return false;
-}
-
class QStorageIterator
{
public:
@@ -164,6 +145,39 @@ private:
#endif
};
+template <typename String>
+static bool isParentOf(const String &parent, const QString &dirName)
+{
+ return dirName.startsWith(parent) &&
+ (dirName.size() == parent.size() || dirName.at(parent.size()) == QLatin1Char('/') ||
+ parent.size() == 1);
+}
+
+static bool isPseudoFs(const QStorageIterator &it)
+{
+ QString mountDir = it.rootPath();
+ if (isParentOf(QLatin1String("/dev"), mountDir)
+ || isParentOf(QLatin1String("/proc"), mountDir)
+ || isParentOf(QLatin1String("/sys"), mountDir)
+ || isParentOf(QLatin1String("/var/run"), mountDir)
+ || isParentOf(QLatin1String("/var/lock"), mountDir)) {
+ return true;
+ }
+
+ QByteArray type = it.fileSystemType();
+ if (type == "tmpfs")
+ return false;
+#if defined(Q_OS_LINUX)
+ if (type == "rootfs" || type == "rpc_pipefs")
+ return true;
+#endif
+
+ if (!it.device().startsWith('/'))
+ return true;
+
+ return false;
+}
+
#if defined(Q_OS_BSD4)
inline QStorageIterator::QStorageIterator()
@@ -450,10 +464,8 @@ void QStorageInfoPrivate::initRootPath()
while (it.next()) {
const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType();
- if (isPseudoFs(mountDir, fsName))
- continue;
// we try to find most suitable entry
- if (oldRootPath.startsWith(mountDir) && maxLength < mountDir.length()) {
+ if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.length()) {
maxLength = mountDir.length();
rootPath = mountDir;
device = it.device();
@@ -467,11 +479,14 @@ static inline QString retrieveLabel(const QByteArray &device)
#ifdef Q_OS_LINUX
static const char pathDiskByLabel[] = "/dev/disk/by-label";
+ QFileInfo devinfo(QFile::decodeName(device));
+ QString devicePath = devinfo.canonicalFilePath();
+
QDirIterator it(QLatin1String(pathDiskByLabel), QDir::NoDotAndDotDot);
while (it.hasNext()) {
it.next();
QFileInfo fileInfo(it.fileInfo());
- if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device)
+ if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
return fileInfo.fileName();
}
#elif defined Q_OS_HAIKU
@@ -542,11 +557,10 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
QList<QStorageInfo> volumes;
while (it.next()) {
- const QString mountDir = it.rootPath();
- const QByteArray fsName = it.fileSystemType();
- if (isPseudoFs(mountDir, fsName))
+ if (isPseudoFs(it))
continue;
+ const QString mountDir = it.rootPath();
volumes.append(QStorageInfo(mountDir));
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 54afb8a974..d645205155 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -3690,7 +3690,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelAboutToBeReset()
\since 4.2
- This signal is emitted when reset() is called, before the model's internal
+ This signal is emitted when beginResetModel() is called, before the model's internal
state (e.g. persistent model indexes) has been invalidated.
\sa beginResetModel(), modelReset()
@@ -3700,7 +3700,7 @@ bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
\fn QAbstractItemModel::modelReset()
\since 4.1
- This signal is emitted when reset() or endResetModel() is called, after the
+ This signal is emitted when endResetModel() is called, after the
model's internal state (e.g. persistent model indexes) has been invalidated.
Note that if a model is reset it should be considered that all information
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 5feb7a409b..f1d38db96c 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -945,6 +945,26 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
}
}
#endif
+ if (QMetaType::typeFlags(t) & QMetaType::IsEnumeration) {
+ qlonglong value = qConvertToNumber(d, ok);
+ if (*ok) {
+ switch (QMetaType::sizeOf(t)) {
+ case 1:
+ *static_cast<signed char *>(result) = value;
+ return true;
+ case 2:
+ *static_cast<qint16 *>(result) = value;
+ return true;
+ case 4:
+ *static_cast<qint32 *>(result) = value;
+ return true;
+ case 8:
+ *static_cast<qint64 *>(result) = value;
+ return true;
+ }
+ }
+ return *ok;
+ }
return false;
}
return true;
@@ -2819,7 +2839,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*Int*/ 1 << QVariant::UInt | 1 << QVariant::String | 1 << QVariant::Double
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong
- | 1 << QVariant::Char | 1 << QVariant::ByteArray,
+ | 1 << QVariant::Char | 1 << QVariant::ByteArray | 1 << QVariant::Int,
/*UInt*/ 1 << QVariant::Int | 1 << QVariant::String | 1 << QVariant::Double
| 1 << QVariant::Bool | 1 << QVariant::LongLong | 1 << QVariant::ULongLong
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index d5b01f3c8a..e3cfd7b988 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1778,7 +1778,11 @@ void QStateMachinePrivate::_q_start()
{
Q_Q(QStateMachine);
Q_ASSERT(state == Starting);
- foreach (QAbstractState *state, configuration) {
+ // iterate over a copy, since we emit signals which may cause
+ // 'configuration' to change, resulting in undefined behavior when
+ // iterating at the same time:
+ const auto config = configuration;
+ for (QAbstractState *state : config) {
QAbstractStatePrivate *abstractStatePrivate = QAbstractStatePrivate::get(state);
abstractStatePrivate->active = false;
emit state->activeChanged(false);
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 5ea8bbe770..447fca44c0 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -232,8 +232,8 @@ public:
AtomicType _q_value;
- Type load() const Q_DECL_NOTHROW { return _q_value; }
- void store(Type newValue) Q_DECL_NOTHROW { _q_value = newValue; }
+ Type load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
+ void store(Type newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
operator Type() const Q_DECL_NOTHROW { return loadAcquire(); }
Type operator=(Type newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; }
diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp
index 89eb3da203..25444ffff6 100644
--- a/src/corelib/thread/qmutex_linux.cpp
+++ b/src/corelib/thread/qmutex_linux.cpp
@@ -56,6 +56,11 @@
# error "Qt build is broken: qmutex_linux.cpp is being built but futex support is not wanted"
#endif
+#ifndef FUTEX_PRIVATE_FLAG
+# define FUTEX_PRIVATE_FLAG 128
+#endif
+
+
QT_BEGIN_NAMESPACE
/*
@@ -104,40 +109,6 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicInt futexFlagSupport = Q_BASIC_ATOMIC_INITIALIZER(-1);
-static int checkFutexPrivateSupport()
-{
- int value = 0;
-#if defined(FUTEX_PRIVATE_FLAG)
- // check if the kernel supports extra futex flags
- // FUTEX_PRIVATE_FLAG appeared in v2.6.22
- Q_STATIC_ASSERT(FUTEX_PRIVATE_FLAG != 0x80000000);
-
- // try an operation that has no side-effects: wake up 42 threads
- // futex will return -1 (errno==ENOSYS) if the flag isn't supported
- // there should be no other error conditions
- value = syscall(__NR_futex, &futexFlagSupport,
- FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
- 42, 0, 0, 0);
- if (value != -1)
- value = FUTEX_PRIVATE_FLAG;
- else
- value = 0;
-
-#else
- value = 0;
-#endif
- futexFlagSupport.store(value);
- return value;
-}
-
-static inline int futexFlags()
-{
- int value = futexFlagSupport.load();
- if (Q_LIKELY(value != -1))
- return value;
- return checkFutexPrivateSupport();
-}
-
static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout) Q_DECL_NOTHROW
{
volatile int *int_addr = reinterpret_cast<volatile int *>(addr);
@@ -149,7 +120,7 @@ static inline int _q_futex(void *addr, int op, int val, const struct timespec *t
// we use __NR_futex because some libcs (like Android's bionic) don't
// provide SYS_futex etc.
- return syscall(__NR_futex, int_addr, op | futexFlags(), val, timeout, addr2, val2);
+ return syscall(__NR_futex, int_addr, op | FUTEX_PRIVATE_FLAG, val, timeout, addr2, val2);
}
static inline QMutexData *dummyFutexValue()
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp
index bf336a8f31..36f1997a6c 100644
--- a/src/corelib/tools/qarraydata.cpp
+++ b/src/corelib/tools/qarraydata.cpp
@@ -71,7 +71,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
// Don't allocate empty headers
if (!(options & RawData) && !capacity) {
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (options & Unsharable)
return const_cast<QArrayData *>(&qt_array_unsharable_empty);
#endif
@@ -116,7 +116,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
quintptr data = (quintptr(header) + sizeof(QArrayData) + alignment - 1)
& ~(alignment - 1);
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
header->ref.atomic.store(bool(!(options & Unsharable)));
#else
header->ref.atomic.store(1);
@@ -138,7 +138,7 @@ void QArrayData::deallocate(QArrayData *data, size_t objectSize,
&& !(alignment & (alignment - 1)));
Q_UNUSED(objectSize) Q_UNUSED(alignment)
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (data == &qt_array_unsharable_empty)
return;
#endif
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 79d0d006ac..5a369baf08 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -78,7 +78,7 @@ struct Q_CORE_EXPORT QArrayData
enum AllocationOption {
CapacityReserved = 0x1,
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Unsharable = 0x2,
#endif
RawData = 0x4,
@@ -255,7 +255,7 @@ struct QTypedArrayData
return allocate(/* capacity */ 0);
}
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
static QTypedArrayData *unsharableEmpty()
{
Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 2036120520..b97dde5a61 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -133,7 +133,7 @@ public:
return (!d->isMutable() || d->ref.isShared());
}
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
void setSharable(bool sharable)
{
if (needsDetach()) {
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index 06b539933e..18facf7e42 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -102,7 +102,7 @@ public:
inline void detach() { if (d->ref.load() != 1) detach_helper(); }
inline bool isDetached() const { return d->ref.load() == 1; }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
#endif
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 8ddf1d9e41..cc8c08d5b1 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -713,7 +713,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
QDTPDEBUG << "sectionValue for" << sn.name()
<< "with text" << text << "and st" << sectiontext
- << text.mid(index, sectionmaxsize)
+ << text.midRef(index, sectionmaxsize)
<< index;
int used = 0;
@@ -743,9 +743,8 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
QDTPDEBUGN("This should never happen (findAmPm returned %d)", ampm);
break;
}
- if (state != Invalid) {
- text.replace(index, used, sectiontext.left(used));
- }
+ if (state != Invalid)
+ text.replace(index, used, sectiontext.constData(), used);
break; }
case MonthSection:
case DayOfWeekSectionShort:
@@ -764,7 +763,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
if (num != -1) {
state = (used == sectiontext.size() ? Acceptable : Intermediate);
- text.replace(index, used, sectiontext.left(used));
+ text.replace(index, used, sectiontext.constData(), used);
} else {
state = Intermediate;
}
@@ -810,7 +809,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
}
}
if (ok && tmp <= absMax) {
- QDTPDEBUG << sectiontext.left(digits) << tmp << digits;
+ QDTPDEBUG << sectiontext.leftRef(digits) << tmp << digits;
last = tmp;
used = digits;
break;
@@ -911,7 +910,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
for (int index=0; state != Invalid && index<sectionNodesCount; ++index) {
if (QStringRef(&input, pos, separators.at(index).size()) != separators.at(index)) {
- QDTPDEBUG << "invalid because" << input.mid(pos, separators.at(index).size())
+ QDTPDEBUG << "invalid because" << input.midRef(pos, separators.at(index).size())
<< "!=" << separators.at(index)
<< index << pos << currentSectionIndex;
state = Invalid;
@@ -983,7 +982,7 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos
}
if (state != Invalid && QStringRef(&input, pos, input.size() - pos) != separators.last()) {
- QDTPDEBUG << "invalid because" << input.mid(pos)
+ QDTPDEBUG << "invalid because" << input.midRef(pos)
<< "!=" << separators.last() << pos;
state = Invalid;
}
@@ -1384,7 +1383,7 @@ QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionI
}
if (used)
*used = str.size();
- if (str.trimmed().isEmpty()) {
+ if (QStringRef(&str).trimmed().isEmpty()) {
return PossibleBoth;
}
const QLatin1Char space(' ');
diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp
index e1fc77fb4c..e2c3ae6280 100644
--- a/src/corelib/tools/qelapsedtimer_unix.cpp
+++ b/src/corelib/tools/qelapsedtimer_unix.cpp
@@ -38,9 +38,6 @@
**
****************************************************************************/
-// ask for the latest POSIX, just in case
-#define _POSIX_C_SOURCE 200809L
-
#include "qelapsedtimer.h"
#if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h"
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index b15dc7b07b..7abbeabeae 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -272,7 +272,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); }
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QHashData::shared_null) d->sharable = sharable; }
#endif
bool isSharedWith(const QHash &other) const { return d == other.d; }
@@ -1092,9 +1092,6 @@ Q_INLINE_TEMPLATE int QMultiHash<Key, T>::count(const Key &key, const T &value)
return n;
}
-Q_CORE_EXPORT int qGlobalQHashSeed();
-Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
-
Q_DECLARE_ASSOCIATIVE_ITERATOR(Hash)
Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(Hash)
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h
index b6cb84ee15..0eb6c1b5ce 100644
--- a/src/corelib/tools/qhashfunctions.h
+++ b/src/corelib/tools/qhashfunctions.h
@@ -64,6 +64,9 @@ class QString;
class QStringRef;
class QLatin1String;
+Q_CORE_EXPORT int qGlobalQHashSeed();
+Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed);
+
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW;
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; }
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 3e0de52da6..e3eed9184f 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -105,7 +105,7 @@ public:
inline void detach()
{ if (d->ref.isShared()) detach_helper2(this->e); }
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { if (!sharable) detach(); if (d != &QLinkedListData::shared_null) d->sharable = sharable; }
#endif
inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; }
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 81f8f8ec05..c7f27abdd6 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -178,7 +178,7 @@ public:
}
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable)
{
if (sharable == d->ref.isSharable())
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index f84d733db0..baa10b7a95 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -365,7 +365,7 @@ public:
inline void detach() { if (d->ref.isShared()) detach_helper(); }
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable)
{
if (sharable == d->ref.isSharable())
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h
index 77f06c8077..9586c3a79a 100644
--- a/src/corelib/tools/qrefcount.h
+++ b/src/corelib/tools/qrefcount.h
@@ -53,7 +53,7 @@ class RefCount
public:
inline bool ref() Q_DECL_NOTHROW {
int count = atomic.load();
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (count == 0) // !isSharable
return false;
#endif
@@ -64,7 +64,7 @@ public:
inline bool deref() Q_DECL_NOTHROW {
int count = atomic.load();
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (count == 0) // !isSharable
return false;
#endif
@@ -73,7 +73,7 @@ public:
return atomic.deref();
}
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
bool setSharable(bool sharable) Q_DECL_NOTHROW
{
Q_ASSERT(!isShared());
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h
index 088403f09d..08b38a08c2 100644
--- a/src/corelib/tools/qset.h
+++ b/src/corelib/tools/qset.h
@@ -85,7 +85,7 @@ public:
inline void detach() { q_hash.detach(); }
inline bool isDetached() const { return q_hash.isDetached(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable) { q_hash.setSharable(sharable); }
#endif
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index c369ff8697..939a1bdffd 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -1323,17 +1323,6 @@
compile. Use qSharedPointerConstCast to cast away the constness.
*/
-/*!
- \fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
- \relates QSharedPointer
- \since 5.7
-
- Writes the pointer tracked by \a ptr into the debug object \a debug for
- debugging purposes.
-
- \sa {Debugging Techniques}
-*/
-
#include <qset.h>
#include <qmutex.h>
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index 3e05bf1ece..6b38f0e80c 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -161,8 +161,6 @@ template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(const QWe
template <class X, class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src);
-template <class T> QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr);
-
QT_END_NAMESPACE
#endif // Q_QDOC
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index bbac2d0327..d051ed6099 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -62,7 +62,6 @@ QT_END_NAMESPACE
#include <new>
#include <QtCore/qatomic.h>
#include <QtCore/qobject.h> // for qobject_cast
-#include <QtCore/qdebug.h>
#if QT_DEPRECATED_SINCE(5, 6)
#include <QtCore/qhash.h>
#endif
@@ -883,16 +882,6 @@ inline void qSwap(QSharedPointer<T> &p1, QSharedPointer<T> &p2)
p1.swap(p2);
}
-#ifndef QT_NO_DEBUG_STREAM
-template <class T>
-Q_INLINE_TEMPLATE QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
-{
- QDebugStateSaver saver(debug);
- debug.nospace() << "QSharedPointer(" << ptr.data() << ")";
- return debug;
-}
-#endif
-
QT_END_NAMESPACE
namespace std {
template <class T>
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 698189f9c6..7b1d94c501 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -670,7 +670,11 @@ void qDetectCpuFeatures()
// contains all the features that the code required. Qt 4 ran for years
// like that, so it shouldn't be a problem.
- qt_cpu_features.store(minFeature | quint32(QSimdInitialized));
+ qt_cpu_features[0].store(minFeature | quint32(QSimdInitialized));
+#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
+ qt_cpu_features[1].store(minFeature >> 32);
+#endif
+
return;
# endif
#endif
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 557bec9676..fea50f4c34 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -106,7 +106,7 @@ public:
inline void detach();
inline bool isDetached() const { return !d->ref.isShared(); }
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
inline void setSharable(bool sharable)
{
if (sharable == d->ref.isSharable())
@@ -382,7 +382,7 @@ template <typename T>
void QVector<T>::detach()
{
if (!isDetached()) {
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
if (!d->alloc)
d = Data::unsharableEmpty();
else
@@ -539,7 +539,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
x = Data::allocate(aalloc, options);
Q_CHECK_PTR(x);
// aalloc is bigger then 0 so it is not [un]sharedEmpty
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(x->ref.isSharable() || options.testFlag(QArrayData::Unsharable));
#endif
Q_ASSERT(!x->ref.isStatic());
@@ -607,7 +607,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo
Q_ASSERT(d->data());
Q_ASSERT(uint(d->size) <= d->alloc);
-#if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
+#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
Q_ASSERT(d != Data::unsharableEmpty());
#endif
Q_ASSERT(aalloc ? d != Data::sharedNull() : d == Data::sharedNull());
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index de86a60616..4d77f4e43f 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -152,6 +152,7 @@ else:SOURCES += tools/qelapsedtimer_generic.cpp
contains(QT_CONFIG, system-zlib) {
include($$PWD/../../3rdparty/zlib_dependency.pri)
} else {
+ CONFIG += no_core_dep
include($$PWD/../../3rdparty/zlib.pri)
}
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 445ff48482..c50f0b6b9c 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -23,6 +23,8 @@ win32 {
-luser32
}
+DEFINES += QT_NO_FOREACH
+
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf
PUB_HEADERS = qdbusargument.h \
diff --git a/src/dbus/doc/qtdbus.qdocconf b/src/dbus/doc/qtdbus.qdocconf
index fc8921ff35..ff46cc5961 100644
--- a/src/dbus/doc/qtdbus.qdocconf
+++ b/src/dbus/doc/qtdbus.qdocconf
@@ -19,7 +19,7 @@ sourcedirs += .. \
../../../examples/dbus/doc/src
excludedirs += ../../../examples/widgets/doc
-examplesinstallpath = qtbase/dbus
+examplesinstallpath = dbus
depends += qtdoc qtcore
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index f00988c05f..b710bfd2aa 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -259,7 +259,7 @@ private:
const QVector<int> &metaTypes, int slotIdx);
SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it);
- void disconnectObjectTree(ObjectTreeNode &node);
+ void collectAllObjects(ObjectTreeNode &node, QSet<QObject *> &set);
bool isServiceRegisteredByThread(const QString &serviceName);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index c73f808485..54418c213a 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1076,17 +1076,18 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
}
}
-void QDBusConnectionPrivate::disconnectObjectTree(QDBusConnectionPrivate::ObjectTreeNode &haystack)
+void QDBusConnectionPrivate::collectAllObjects(QDBusConnectionPrivate::ObjectTreeNode &haystack,
+ QSet<QObject *> &set)
{
QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin();
while (it != haystack.children.end()) {
- disconnectObjectTree(*it);
+ collectAllObjects(*it, set);
it++;
}
if (haystack.obj)
- haystack.obj->disconnect(this);
+ set.insert(haystack.obj);
}
void QDBusConnectionPrivate::closeConnection()
@@ -1115,15 +1116,23 @@ void QDBusConnectionPrivate::closeConnection()
// 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++;
+ // already quit. We need to make sure we disconnect exactly once per
+ // object, because if we tried a second time, we might be hitting a
+ // dangling pointer.
+ QSet<QObject *> allObjects;
+ collectAllObjects(rootNode, allObjects);
+ SignalHookHash::const_iterator sit = signalHooks.constBegin();
+ while (sit != signalHooks.constEnd()) {
+ allObjects.insert(sit.value().obj);
+ ++sit;
+ }
+
+ // now disconnect ourselves
+ QSet<QObject *>::const_iterator oit = allObjects.constBegin();
+ while (oit != allObjects.constEnd()) {
+ (*oit)->disconnect(this);
+ ++oit;
}
-
- disconnectObjectTree(rootNode);
- rootNode.children.clear(); // free resources
}
void QDBusConnectionPrivate::handleDBusDisconnection()
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index 027d2663de..b07d39fa37 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -4,7 +4,7 @@ project = QtGui
description = Qt GUI Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/gui
+examplesinstallpath = gui
qhp.projects = QtGui
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index a798db662c..1a8fc599ce 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -138,22 +138,6 @@ QDebug operator<<(QDebug d, const QOpenGLConfig::Gpu &g)
enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan };
static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="};
-static inline QString valueKey() { return QStringLiteral("value"); }
-static inline QString opKey() { return QStringLiteral("op"); }
-static inline QString versionKey() { return QStringLiteral("version"); }
-static inline QString releaseKey() { return QStringLiteral("release"); }
-static inline QString typeKey() { return QStringLiteral("type"); }
-static inline QString osKey() { return QStringLiteral("os"); }
-static inline QString vendorIdKey() { return QStringLiteral("vendor_id"); }
-static inline QString glVendorKey() { return QStringLiteral("gl_vendor"); }
-static inline QString deviceIdKey() { return QStringLiteral("device_id"); }
-static inline QString driverVersionKey() { return QStringLiteral("driver_version"); }
-static inline QString driverDescriptionKey() { return QStringLiteral("driver_description"); }
-static inline QString featuresKey() { return QStringLiteral("features"); }
-static inline QString idKey() { return QStringLiteral("id"); }
-static inline QString descriptionKey() { return QStringLiteral("description"); }
-static inline QString exceptionsKey() { return QStringLiteral("exceptions"); }
-
typedef QJsonArray::ConstIterator JsonArrayConstIt;
static inline bool contains(const QJsonArray &haystack, unsigned needle)
@@ -216,8 +200,8 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v)
if (!v.isObject())
return result;
const QJsonObject o = v.toObject();
- result.number = QVersionNumber::fromString(o.value(valueKey()).toString());
- const QString opS = o.value(opKey()).toString();
+ result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString());
+ const QString opS = o.value(QLatin1String("op")).toString();
for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) {
if (opS == QLatin1String(operators[i])) {
result.op = static_cast<Operator>(i);
@@ -292,9 +276,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v)
if (!v.isObject())
return result;
const QJsonObject o = v.toObject();
- result.type = o.value(typeKey()).toString();
- result.versionTerm = VersionTerm::fromJson(o.value(versionKey()));
- result.release = o.value(releaseKey()).toArray();
+ result.type = o.value(QLatin1String("type")).toString();
+ result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version")));
+ result.release = o.value(QLatin1String("release")).toArray();
return result;
}
@@ -318,8 +302,8 @@ QString OsTypeTerm::hostOs()
static QString msgSyntaxWarning(const QJsonObject &object, const QString &what)
{
QString result;
- QTextStream(&result) << "Id " << object.value(idKey()).toInt()
- << " (\"" << object.value(descriptionKey()).toString()
+ QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt()
+ << " (\"" << object.value(QLatin1String("description")).toString()
<< "\"): " << what;
return result;
}
@@ -333,11 +317,11 @@ static bool matches(const QJsonObject &object,
const QString &osRelease,
const QOpenGLConfig::Gpu &gpu)
{
- const OsTypeTerm os = OsTypeTerm::fromJson(object.value(osKey()));
+ const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os")));
if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease))
return false;
- const QJsonValue exceptionsV = object.value(exceptionsKey());
+ const QJsonValue exceptionsV = object.value(QLatin1String("exceptions"));
if (exceptionsV.isArray()) {
const QJsonArray exceptionsA = exceptionsV.toArray();
for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) {
@@ -346,20 +330,20 @@ static bool matches(const QJsonObject &object,
}
}
- const QJsonValue vendorV = object.value(vendorIdKey());
+ const QJsonValue vendorV = object.value(QLatin1String("vendor_id"));
if (vendorV.isString()) {
if (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0))
return false;
} else {
- if (object.contains(glVendorKey())) {
- const QByteArray glVendorV = object.value(glVendorKey()).toString().toUtf8();
+ if (object.contains(QLatin1String("gl_vendor"))) {
+ const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8();
if (!gpu.glVendor.contains(glVendorV))
return false;
}
}
if (gpu.deviceId) {
- const QJsonValue deviceIdV = object.value(deviceIdKey());
+ const QJsonValue deviceIdV = object.value(QLatin1String("device_id"));
switch (deviceIdV.type()) {
case QJsonValue::Array:
if (!contains(deviceIdV.toArray(), gpu.deviceId))
@@ -375,7 +359,7 @@ static bool matches(const QJsonObject &object,
}
}
if (!gpu.driverVersion.isNull()) {
- const QJsonValue driverVersionV = object.value(driverVersionKey());
+ const QJsonValue driverVersionV = object.value(QLatin1String("driver_version"));
switch (driverVersionV.type()) {
case QJsonValue::Object:
if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion))
@@ -392,7 +376,7 @@ static bool matches(const QJsonObject &object,
}
if (!gpu.driverDescription.isEmpty()) {
- const QJsonValue driverDescriptionV = object.value(driverDescriptionKey());
+ const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description"));
if (driverDescriptionV.isString()) {
if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8()))
return false;
@@ -412,7 +396,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
{
result->clear();
errorMessage->clear();
- const QJsonValue entriesV = doc.object().value(QStringLiteral("entries"));
+ const QJsonValue entriesV = doc.object().value(QLatin1String("entries"));
if (!entriesV.isArray()) {
*errorMessage = QLatin1String("No entries read.");
return false;
@@ -423,7 +407,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu,
if (eit->isObject()) {
const QJsonObject object = eit->toObject();
if (matches(object, osName, kernelVersion, osRelease, gpu)) {
- const QJsonValue featuresListV = object.value(featuresKey());
+ const QJsonValue featuresListV = object.value(QLatin1String("features"));
if (featuresListV.isArray()) {
const QJsonArray featuresListA = featuresListV.toArray();
for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit)
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index aeb76589e0..8defcfb28d 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6272,7 +6272,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
pen.setColor(uc);
// Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms
- const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / 2.), pen);
+ const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / qreal(2.)), pen);
const int descent = qFloor(maxHeight);
painter->setBrushOrigin(painter->brushOrigin().x(), 0);
@@ -6283,7 +6283,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
// the text above it, but limit it to stay within descent.
qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5;
if (underlineOffset <= fe->descent().toReal())
- adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - 0.5);
+ adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - qreal(0.5));
const qreal underlinePos = pos.y() + adjustedUnderlineOffset;
QColor uc = charFormat.underlineColor();
if (uc.isValid())
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 7381f381fe..d967a168d2 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -232,7 +232,8 @@ void QPlatformTextureList::clear()
Flushes the given \a region from the specified \a window onto the
screen.
- Note that the \a offset parameter is currently unused.
+ The \a offset parameter is relative to the origin of the backing
+ store image.
*/
#ifndef QT_NO_OPENGL
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 92683448aa..c52792c2d3 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -428,7 +428,7 @@ void QStroker::processCurrentSubpath()
bool fwclosed = qt_stroke_side(&fwit, this, false, &fwStartTangent);
bool bwclosed = qt_stroke_side(&bwit, this, !fwclosed, &bwStartTangent);
- if (!bwclosed)
+ if (!bwclosed && !fwStartTangent.isNull())
joinPoints(m_elements.at(0).x, m_elements.at(0).y, fwStartTangent, m_capStyle);
}
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 7e18250087..f92e4ab457 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -118,9 +118,6 @@ bool QFontDef::exactMatch(const QFontDef &other) const
QFontDatabase::parseFontName(family, this_foundry, this_family);
QFontDatabase::parseFontName(other.family, other_foundry, other_family);
- this_family = QFontDatabase::resolveFontFamilyAlias(this_family);
- other_family = QFontDatabase::resolveFontFamilyAlias(other_family);
-
return (styleHint == other.styleHint
&& styleStrategy == other.styleStrategy
&& weight == other.weight
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 0abc48a99c..1aa2d71bc5 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -480,6 +480,9 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
//
connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)),
SLOT(_q_onlineStateChanged(bool)));
+ connect(&d->networkConfigurationManager, SIGNAL(configurationChanged(const QNetworkConfiguration &)),
+ SLOT(_q_configurationChanged(const QNetworkConfiguration &)));
+
#endif
}
@@ -1578,6 +1581,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)));
+ QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
+ q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
}
//switch to new session (null if config was invalid)
@@ -1585,7 +1590,6 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
networkSessionWeakRef = networkSessionStrongRef.toWeakRef();
if (!networkSessionStrongRef) {
- online = false;
if (networkAccessible == QNetworkAccessManager::NotAccessible || !online)
emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible);
@@ -1601,6 +1605,8 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
QObject::connect(networkSessionStrongRef.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection);
QObject::connect(networkSessionStrongRef.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
+ QObject::connect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
+ q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
_q_networkSessionStateChanged(networkSessionStrongRef->state());
}
@@ -1617,6 +1623,9 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
QObject::disconnect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()));
QObject::disconnect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)));
+ QObject::disconnect(networkSessionStrongRef.data(), SIGNAL(error(QNetworkSession::SessionError)),
+ q, SLOT(_q_networkSessionFailed(QNetworkSession::SessionError)));
+
networkSessionStrongRef.clear();
networkSessionWeakRef.clear();
}
@@ -1625,46 +1634,57 @@ void QNetworkAccessManagerPrivate::_q_networkSessionClosed()
void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state)
{
Q_Q(QNetworkAccessManager);
-
+ bool reallyOnline = false;
//Do not emit the networkSessionConnected signal here, except for roaming -> connected
//transition, otherwise it is emitted twice in a row when opening a connection.
- if (state == QNetworkSession::Connected && lastSessionState == QNetworkSession::Roaming)
+ if (state == QNetworkSession::Connected && lastSessionState != QNetworkSession::Roaming)
emit q->networkSessionConnected();
lastSessionState = state;
- if (online) {
+ if (online && state == QNetworkSession::Disconnected) {
+ const auto cfgs = networkConfigurationManager.allConfigurations();
+ for (const QNetworkConfiguration &cfg : cfgs) {
+ if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
+ reallyOnline = true;
+ }
+ }
+ } else if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
+ reallyOnline = true;
+ }
+
+ if (!reallyOnline) {
if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) {
- online = false;
if (networkAccessible != QNetworkAccessManager::NotAccessible) {
networkAccessible = QNetworkAccessManager::NotAccessible;
emit q->networkAccessibleChanged(networkAccessible);
}
}
} else {
- if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) {
- online = true;
- if (defaultAccessControl)
- if (networkAccessible != QNetworkAccessManager::Accessible) {
- networkAccessible = QNetworkAccessManager::Accessible;
- emit q->networkAccessibleChanged(networkAccessible);
- }
- }
+ if (defaultAccessControl)
+ if (networkAccessible != QNetworkAccessManager::Accessible) {
+ networkAccessible = QNetworkAccessManager::Accessible;
+ emit q->networkAccessibleChanged(networkAccessible);
+ }
+ }
+ online = reallyOnline;
+ if (online && (state != QNetworkSession::Connected && state != QNetworkSession::Roaming)) {
+ _q_networkSessionClosed();
+ createSession(q->configuration());
}
}
void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
{
Q_Q(QNetworkAccessManager);
+
// if the user set a config, we only care whether this one is active.
// Otherwise, this QNAM is online if there is an online config.
if (customNetworkConfiguration) {
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else {
if (online != isOnline) {
- if (isOnline) {
- networkSessionStrongRef.clear();
- networkSessionWeakRef.clear();
- }
+ _q_networkSessionClosed();
+ createSession(q->configuration());
online = isOnline;
}
}
@@ -1675,11 +1695,6 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
emit q->networkAccessibleChanged(networkAccessible);
}
}
- } else if (networkConfiguration.state().testFlag(QNetworkConfiguration::Undefined)) {
- if (networkAccessible != QNetworkAccessManager::UnknownAccessibility) {
- networkAccessible = QNetworkAccessManager::UnknownAccessibility;
- emit q->networkAccessibleChanged(networkAccessible);
- }
} else {
if (networkAccessible != QNetworkAccessManager::NotAccessible) {
networkAccessible = QNetworkAccessManager::NotAccessible;
@@ -1688,6 +1703,50 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
}
}
+void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfiguration &configuration)
+{
+ const QString id = configuration.identifier();
+ if (configuration.state().testFlag(QNetworkConfiguration::Active)) {
+ if (!onlineConfigurations.contains(id)) {
+
+ QSharedPointer<QNetworkSession> session(getNetworkSession());
+ if (session) {
+ if (online && session->configuration().identifier()
+ != networkConfigurationManager.defaultConfiguration().identifier()) {
+
+ onlineConfigurations.insert(id);
+ //this one disconnected but another one is online,
+ // close and create new session
+ _q_networkSessionClosed();
+ createSession(networkConfigurationManager.defaultConfiguration());
+ }
+ }
+ }
+
+ } else if (onlineConfigurations.contains(id)) {
+ //this one is disconnecting
+ onlineConfigurations.remove(id);
+ if (!onlineConfigurations.isEmpty()) {
+ _q_networkSessionClosed();
+ createSession(configuration);
+ }
+ }
+}
+
+
+void QNetworkAccessManagerPrivate::_q_networkSessionFailed(QNetworkSession::SessionError)
+{
+ const auto cfgs = networkConfigurationManager.allConfigurations();
+ for (const QNetworkConfiguration &cfg : cfgs) {
+ if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
+ online = true;
+ _q_networkSessionClosed();
+ createSession(networkConfigurationManager.defaultConfiguration());
+ return;
+ }
+ }
+}
+
#endif // QT_NO_BEARERMANAGEMENT
QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart)
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index 9d02fd7c34..7e8c399047 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -183,6 +183,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
Q_PRIVATE_SLOT(d_func(), void _q_onlineStateChanged(bool))
+ Q_PRIVATE_SLOT(d_func(), void _q_configurationChanged(const QNetworkConfiguration &))
+ Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed(QNetworkSession::SessionError))
#endif
};
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index 48270f0c17..5f8148d6e4 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -152,6 +152,11 @@ public:
bool isSeamless);
void _q_networkSessionStateChanged(QNetworkSession::State state);
void _q_onlineStateChanged(bool isOnline);
+ void _q_configurationChanged(const QNetworkConfiguration &configuration);
+ void _q_networkSessionFailed(QNetworkSession::SessionError error);
+
+ QSet<QString> onlineConfigurations;
+
#endif
QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart);
diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf
index 87e322d6c0..2a8e577dda 100644
--- a/src/network/doc/qtnetwork.qdocconf
+++ b/src/network/doc/qtnetwork.qdocconf
@@ -4,7 +4,7 @@ project = QtNetwork
description = Qt Network Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/network
+examplesinstallpath = network
qhp.projects = QtNetwork
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index 10c0dccb9e..959db6e9d9 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -199,6 +199,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
{
if (d == other.d)
return true;
+ if (!d || !other.d)
+ return false;
return d->user == other.d->user
&& d->password == other.d->password
&& d->realm == other.d->realm
diff --git a/src/network/network.pro b/src/network/network.pro
index fed14616af..7a05f927c5 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -1,7 +1,7 @@
TARGET = QtNetwork
QT = core-private
-DEFINES += QT_NO_USING_NAMESPACE
+DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
#DEFINES += QLOCALSERVER_DEBUG QLOCALSOCKET_DEBUG
#DEFINES += QNETWORKDISKCACHE_DEBUG
#DEFINES += QSSLSOCKET_DEBUG
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 73b42ba432..f9ff958525 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -188,17 +188,26 @@ bool QHttpSocketEngine::connectToHostByName(const QString &hostname, quint16 por
bool QHttpSocketEngine::bind(const QHostAddress &, quint16)
{
+ qWarning("Operation is not supported");
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
return false;
}
bool QHttpSocketEngine::listen()
{
+ qWarning("Operation is not supported");
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
return false;
}
int QHttpSocketEngine::accept()
{
- return 0;
+ qWarning("Operation is not supported");
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
+ return -1;
}
void QHttpSocketEngine::close()
@@ -251,16 +260,18 @@ qint64 QHttpSocketEngine::write(const char *data, qint64 len)
bool QHttpSocketEngine::joinMulticastGroup(const QHostAddress &,
const QNetworkInterface &)
{
+ qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
- QLatin1String("Operation on socket is not supported"));
+ QLatin1String("Unsupported socket operation"));
return false;
}
bool QHttpSocketEngine::leaveMulticastGroup(const QHostAddress &,
const QNetworkInterface &)
{
+ qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
- QLatin1String("Operation on socket is not supported"));
+ QLatin1String("Unsupported socket operation"));
return false;
}
@@ -271,30 +282,39 @@ QNetworkInterface QHttpSocketEngine::multicastInterface() const
bool QHttpSocketEngine::setMulticastInterface(const QNetworkInterface &)
{
+ qWarning("Operation is not supported");
setError(QAbstractSocket::UnsupportedSocketOperationError,
- QLatin1String("Operation on socket is not supported"));
+ QLatin1String("Unsupported socket operation"));
return false;
}
#endif // QT_NO_NETWORKINTERFACE
qint64 QHttpSocketEngine::readDatagram(char *, qint64, QIpPacketHeader *, PacketHeaderOptions)
{
- return 0;
+ qWarning("Operation is not supported");
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
+ return -1;
}
qint64 QHttpSocketEngine::writeDatagram(const char *, qint64, const QIpPacketHeader &)
{
- return 0;
+ qWarning("Operation is not supported");
+ setError(QAbstractSocket::UnsupportedSocketOperationError,
+ QLatin1String("Unsupported socket operation"));
+ return -1;
}
bool QHttpSocketEngine::hasPendingDatagrams() const
{
+ qWarning("Operation is not supported");
return false;
}
qint64 QHttpSocketEngine::pendingDatagramSize() const
{
- return 0;
+ qWarning("Operation is not supported");
+ return -1;
}
#endif // QT_NO_UDPSOCKET
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index cf36887e92..56f8b590f1 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -61,7 +61,6 @@
#if defined(QT_LOCALSOCKET_TCP)
# include "qtcpsocket.h"
#elif defined(Q_OS_WIN)
-# include <private/qringbuffer_p.h>
# include "private/qwindowspipereader_p.h"
# include "private/qwindowspipewriter_p.h"
# include <qwineventnotifier.h>
@@ -134,7 +133,6 @@ public:
void _q_pipeClosed();
void _q_winError(ulong windowsError, const QString &function);
HANDLE handle;
- QRingBuffer writeBuffer;
QWindowsPipeWriter *pipeWriter;
QWindowsPipeReader *pipeReader;
QLocalSocket::LocalSocketError error;
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 66b461522b..bed4355aa9 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -107,6 +107,7 @@ QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
error(QLocalSocket::UnknownSocketError),
state(QLocalSocket::UnconnectedState)
{
+ writeBufferChunkSize = QIODEVICE_BUFFERSIZE;
}
QLocalSocketPrivate::~QLocalSocketPrivate()
@@ -214,8 +215,7 @@ qint64 QLocalSocket::writeData(const char *data, qint64 len)
Q_D(QLocalSocket);
if (len == 0)
return 0;
- char *dest = d->writeBuffer.reserve(len);
- memcpy(dest, data, len);
+ d->writeBuffer.append(data, len);
if (!d->pipeWriter) {
d->pipeWriter = new QWindowsPipeWriter(d->handle, this);
connect(d->pipeWriter, &QWindowsPipeWriter::bytesWritten,
@@ -233,7 +233,6 @@ void QLocalSocket::abort()
if (d->pipeWriter) {
delete d->pipeWriter;
d->pipeWriter = 0;
- d->writeBuffer.clear();
}
close();
}
@@ -291,6 +290,7 @@ void QLocalSocket::close()
if (openMode() == NotOpen)
return;
+ d->setWriteChannelCount(0);
QIODevice::close();
d->serverName = QString();
d->fullServerName = QString();
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 18f90a8a4e..181c49f200 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -464,17 +464,24 @@ void QNativeSocketEngine::close()
}
#if _MSC_VER >= 1900
- // To close the connection properly (not with a hard reset) all pending read operation have to
- // be finished or cancelled. The API isn't available on Windows 8.1 though.
- ComPtr<IStreamSocket3> socket3;
- hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3));
- Q_ASSERT_SUCCEEDED(hr);
+ if (d->socketType == QAbstractSocket::TcpSocket) {
+ hr = QEventDispatcherWinRT::runOnXamlThread([d]() {
+ HRESULT hr;
+ // To close the connection properly (not with a hard reset) all pending read operation have to
+ // be finished or cancelled. The API isn't available on Windows 8.1 though.
+ ComPtr<IStreamSocket3> socket3;
+ hr = d->tcpSocket()->QueryInterface(IID_PPV_ARGS(&socket3));
+ Q_ASSERT_SUCCEEDED(hr);
- ComPtr<IAsyncAction> action;
- hr = socket3->CancelIOAsync(&action);
- Q_ASSERT_SUCCEEDED(hr);
- hr = QWinRTFunctions::await(action);
- Q_ASSERT_SUCCEEDED(hr);
+ ComPtr<IAsyncAction> action;
+ hr = socket3->CancelIOAsync(&action);
+ Q_ASSERT_SUCCEEDED(hr);
+ hr = QWinRTFunctions::await(action);
+ Q_ASSERT_SUCCEEDED(hr);
+ return S_OK;
+ });
+ Q_ASSERT_SUCCEEDED(hr);
+ }
#endif // _MSC_VER >= 1900
if (d->readOp) {
@@ -1271,9 +1278,12 @@ void QNativeSocketEnginePrivate::handleConnectionEstablished(IAsyncAction *actio
HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status)
{
- Q_Q(QNativeSocketEngine);
- if (wasDeleted || isDeletingChildren)
+ if (closingDown || wasDeleted || isDeletingChildren
+ || socketState == QAbstractSocket::UnconnectedState) {
return S_OK;
+ }
+
+ Q_Q(QNativeSocketEngine);
// A read in UnconnectedState will close the socket and return -1 and thus tell the caller,
// that the connection was closed. The socket cannot be closed here, as the subsequent read
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index 2c4d439a29..325e4965e6 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -154,7 +154,7 @@ public:
qintptr socketDescriptor;
bool notifyOnRead, notifyOnWrite, notifyOnException;
- bool closingDown;
+ QAtomicInt closingDown;
enum ErrorString {
NonBlockingInitFailedErrorString,
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index 1eb253d202..edcaef7b0c 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -213,6 +213,7 @@ bool QSslConfiguration::operator==(const QSslConfiguration &other) const
d->preSharedKeyIdentityHint == other.d->preSharedKeyIdentityHint &&
d->ciphers == other.d->ciphers &&
d->ellipticCurves == other.d->ellipticCurves &&
+ d->ephemeralServerKey == other.d->ephemeralServerKey &&
d->caCertificates == other.d->caCertificates &&
d->protocol == other.d->protocol &&
d->peerVerifyMode == other.d->peerVerifyMode &&
@@ -254,6 +255,7 @@ bool QSslConfiguration::isNull() const
d->caCertificates.count() == 0 &&
d->ciphers.count() == 0 &&
d->ellipticCurves.isEmpty() &&
+ d->ephemeralServerKey.isNull() &&
d->localCertificateChain.isEmpty() &&
d->privateKey.isNull() &&
d->peerCertificate.isNull() &&
diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h
index 113954d7d1..5ab0ef36e4 100644
--- a/src/network/ssl/qsslconfiguration_p.h
+++ b/src/network/ssl/qsslconfiguration_p.h
@@ -88,6 +88,7 @@ public:
peerSessionShared(false),
sslOptions(QSslConfigurationPrivate::defaultSslOptions),
sslSessionTicketLifeTimeHint(-1),
+ ephemeralServerKey(),
preSharedKeyIdentityHint(),
nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone)
{ }
diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
index 2c1f87128e..cbf290a05c 100644
--- a/src/network/ssl/qsslcontext_openssl.cpp
+++ b/src/network/ssl/qsslcontext_openssl.cpp
@@ -207,7 +207,7 @@ init_context:
QList<QSslCipher> ciphers = sslContext->sslConfiguration.ciphers();
if (ciphers.isEmpty())
ciphers = QSslSocketPrivate::defaultCiphers();
- foreach (const QSslCipher &cipher, ciphers) {
+ for (const QSslCipher &cipher : qAsConst(ciphers)) {
if (first)
first = false;
else
diff --git a/src/opengl/doc/qtopengl.qdocconf b/src/opengl/doc/qtopengl.qdocconf
index 3c5fc280bd..6ff6cae2cb 100644
--- a/src/opengl/doc/qtopengl.qdocconf
+++ b/src/opengl/doc/qtopengl.qdocconf
@@ -21,7 +21,7 @@ imagedirs += images \
depends += qtdoc qtcore qtgui qtwidgets qmake
-examplesinstallpath = qtbase/opengl
+examplesinstallpath = opengl
# The following parameters are for creating a qhp file, the qhelpgenerator
# program can convert the qhp file into a qch file which can be opened in
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 007f73c45f..2386ef5d19 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -1,7 +1,8 @@
TARGET = QtOpenGL
QT = core-private gui-private widgets-private
-DEFINES += QT_NO_USING_NAMESPACE
+DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
+
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
diff --git a/src/openglextensions/openglextensions.pro b/src/openglextensions/openglextensions.pro
index 18eec27e1c..04a871114b 100644
--- a/src/openglextensions/openglextensions.pro
+++ b/src/openglextensions/openglextensions.pro
@@ -4,7 +4,8 @@ CONFIG += static
contains(QT_CONFIG, opengl):CONFIG += opengl
contains(QT_CONFIG, opengles2):CONFIG += opengles2
-DEFINES += QT_NO_CAST_FROM_ASCII
+DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
+
PRECOMPILED_HEADER =
HEADERS = qopenglextensions.h
diff --git a/src/platformheaders/doc/qtplatformheaders.qdocconf b/src/platformheaders/doc/qtplatformheaders.qdocconf
index 989df524e6..1ff6fe7a21 100644
--- a/src/platformheaders/doc/qtplatformheaders.qdocconf
+++ b/src/platformheaders/doc/qtplatformheaders.qdocconf
@@ -4,7 +4,7 @@ project = QtPlatformHeaders
description = Qt Platform Headers Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/qtplatformheaders
+examplesinstallpath = qtplatformheaders
qhp.projects = QtPlatformHeaders
diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm
index d8e46bdbc6..762cb5214a 100644
--- a/src/platformsupport/clipboard/qmacmime.mm
+++ b/src/platformsupport/clipboard/qmacmime.mm
@@ -757,7 +757,7 @@ bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav)
QString QMacPasteboardMimeVCard::flavorFor(const QString &mime)
{
- if (mime.startsWith(QLatin1String("text/plain")))
+ if (mime.startsWith(QLatin1String("text/vcard")))
return QLatin1String("public.vcard");
return QString();
}
@@ -765,14 +765,14 @@ QString QMacPasteboardMimeVCard::flavorFor(const QString &mime)
QString QMacPasteboardMimeVCard::mimeFor(QString flav)
{
if (flav == QLatin1String("public.vcard"))
- return QLatin1String("text/plain");
+ return QLatin1String("text/vcard");
return QString();
}
QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByteArray> data, QString)
{
QByteArray cards;
- if (mime == QLatin1String("text/plain")) {
+ if (mime == QLatin1String("text/vcard")) {
for (int i=0; i<data.size(); ++i)
cards += data[i];
}
@@ -782,7 +782,7 @@ QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByte
QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime, QVariant data, QString)
{
QList<QByteArray> ret;
- if (mime == QLatin1String("text/plain"))
+ if (mime == QLatin1String("text/vcard"))
ret.append(data.toString().toUtf8());
return ret;
}
diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp
index ee25f1a2b0..361146dc23 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp
+++ b/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp
@@ -65,9 +65,10 @@ const QString MenuBarPath = QLatin1String("/MenuBar");
A D-Bus connection which is used for both menu and tray icon services.
Connects to the session bus and registers with the respective watcher services.
*/
-QDBusMenuConnection::QDBusMenuConnection(QObject *parent)
+QDBusMenuConnection::QDBusMenuConnection(QObject *parent, const QString &serviceName)
: QObject(parent)
- , m_connection(QDBusConnection::sessionBus())
+ , m_connection(serviceName.isNull() ? QDBusConnection::sessionBus()
+ : QDBusConnection::connectToBus(QDBusConnection::SessionBus, serviceName))
, m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this))
, m_statusNotifierHostRegistered(false)
{
diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h b/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h
index b9434ee4d7..84eb2a6f3a 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h
+++ b/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h
@@ -67,7 +67,7 @@ class QDBusMenuConnection : public QObject
Q_OBJECT
public:
- QDBusMenuConnection(QObject *parent = 0);
+ QDBusMenuConnection(QObject *parent = 0, const QString &serviceName = QString());
QDBusConnection connection() const { return m_connection; }
bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; }
#ifndef QT_NO_SYSTEMTRAYICON
diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/dbustray/qdbustrayicon.cpp
index c8de50ebe1..724992f348 100644
--- a/src/platformsupport/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/dbustray/qdbustrayicon.cpp
@@ -171,7 +171,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
QDBusMenuConnection * QDBusTrayIcon::dBusConnection()
{
if (!m_dbusConnection) {
- m_dbusConnection = new QDBusMenuConnection(this);
+ m_dbusConnection = new QDBusMenuConnection(this, m_instanceId);
m_notifier = new QXdgNotificationInterface(XdgNotificationService,
XdgNotificationPath, m_dbusConnection->connection(), this);
connect(m_notifier, SIGNAL(NotificationClosed(uint,uint)), this, SLOT(notificationClosed(uint,uint)));
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
index e454f14f33..19a29d5dd8 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h
+++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
@@ -51,9 +51,9 @@
// We mean it.
//
-#include <EGL/egl.h>
#include <qpa/qplatformoffscreensurface.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
+#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
index e6b9e09a25..2cad3441e4 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp
+++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
@@ -43,6 +43,7 @@
#include <qpa/qplatformwindow.h>
#include <QtGui/qscreen.h>
+#include <QtGui/qpainter.h>
QT_BEGIN_NAMESPACE
@@ -96,9 +97,17 @@ void QFbBackingStore::unlock()
mImageMutex.unlock();
}
-void QFbBackingStore::beginPaint(const QRegion &)
+void QFbBackingStore::beginPaint(const QRegion &region)
{
lock();
+
+ if (mImage.hasAlphaChannel()) {
+ QPainter p(&mImage);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ const QVector<QRect> rects = region.rects();
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it)
+ p.fillRect(*it, Qt::transparent);
+ }
}
void QFbBackingStore::endPaint()
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index ee8183c896..01de2a59b2 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -237,6 +237,7 @@ QRegion QFbScreen::doRedraw()
if (!mCompositePainter)
mCompositePainter = new QPainter(mScreenImage);
+
for (int rectIndex = 0; rectIndex < mRepaintRegion.rectCount(); rectIndex++) {
QRegion rectRegion = rects[rectIndex];
@@ -254,7 +255,8 @@ QRegion QFbScreen::doRedraw()
for (const QRect &rect : intersect) {
bool firstLayer = true;
if (layer == -1) {
- mCompositePainter->fillRect(rect, Qt::black);
+ mCompositePainter->setCompositionMode(QPainter::CompositionMode_Source);
+ mCompositePainter->fillRect(rect, mScreenImage->hasAlphaChannel() ? Qt::transparent : Qt::black);
firstLayer = false;
layer = mWindowStack.size() - 1;
}
@@ -287,6 +289,7 @@ QRegion QFbScreen::doRedraw()
QRect cursorRect;
if (mCursor && (mCursor->isDirty() || mRepaintRegion.intersects(mCursor->lastPainted()))) {
+ mCompositePainter->setCompositionMode(QPainter::CompositionMode_SourceOver);
cursorRect = mCursor->drawCursor(*mCompositePainter);
touchedRegion += cursorRect;
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index bea32950be..493ffc7a46 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -373,7 +373,7 @@ static QByteArray filenameForCFUrl(CFURLRef url)
if (!CFURLGetFileSystemRepresentation(url, true, buffer, sizeof(buffer))) {
qWarning("QCoreTextFontDatabase::filenameForCFUrl: could not resolve file for URL %s",
- qPrintable(QString::fromCFString(CFURLGetString(url))));
+ url ? qPrintable(QString::fromCFString(CFURLGetString(url))) : "(null)");
} else {
QCFType<CFStringRef> scheme = CFURLCopyScheme(url);
if (QString::fromCFString(scheme) == QLatin1String("qrc"))
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 88d80d19ae..140b6c129f 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -47,6 +47,49 @@
#include <cmath>
+#if defined(Q_OS_OSX) && !QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
+#import <AppKit/AppKit.h>
+#endif
+
+#if defined(Q_OS_IOS) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2)
+#import <UIKit/UIKit.h>
+#endif
+
+// These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework,
+// but they are not documented and are not in public headers so are private API and exposed
+// only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857)
+#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_11, __IPHONE_8_2)
+#define kCTFontWeightUltraLight -0.8
+#define kCTFontWeightThin -0.6
+#define kCTFontWeightLight -0.4
+#define kCTFontWeightRegular 0
+#define kCTFontWeightMedium 0.23
+#define kCTFontWeightSemibold 0.3
+#define kCTFontWeightBold 0.4
+#define kCTFontWeightHeavy 0.56
+#define kCTFontWeightBlack 0.62
+#elif defined(Q_OS_OSX)
+#define kCTFontWeightUltraLight NSFontWeightUltraLight
+#define kCTFontWeightThin NSFontWeightThin
+#define kCTFontWeightLight NSFontWeightLight
+#define kCTFontWeightRegular NSFontWeightRegular
+#define kCTFontWeightMedium NSFontWeightMedium
+#define kCTFontWeightSemibold NSFontWeightSemibold
+#define kCTFontWeightBold NSFontWeightBold
+#define kCTFontWeightHeavy NSFontWeightHeavy
+#define kCTFontWeightBlack NSFontWeightBlack
+#elif defined(Q_OS_IOS)
+#define kCTFontWeightUltraLight UIFontWeightUltraLight
+#define kCTFontWeightThin UIFontWeightThin
+#define kCTFontWeightLight UIFontWeightLight
+#define kCTFontWeightRegular UIFontWeightRegular
+#define kCTFontWeightMedium UIFontWeightMedium
+#define kCTFontWeightSemibold UIFontWeightSemibold
+#define kCTFontWeightBold UIFontWeightBold
+#define kCTFontWeightHeavy UIFontWeightHeavy
+#define kCTFontWeightBlack UIFontWeightBlack
+#endif
+
QT_BEGIN_NAMESPACE
static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f);
@@ -69,24 +112,24 @@ bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buff
QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value)
{
- if (value >= 0.62)
+ if (value >= kCTFontWeightBlack)
return QFont::Black;
- if (value >= 0.5)
+ if (value >= kCTFontWeightHeavy)
return QFont::ExtraBold;
- if (value >= 0.4)
+ if (value >= kCTFontWeightBold)
return QFont::Bold;
- if (value >= 0.3)
+ if (value >= kCTFontWeightSemibold)
return QFont::DemiBold;
- if (value >= 0.2)
+ if (value >= kCTFontWeightMedium)
return QFont::Medium;
- if (value == 0.0)
+ if (value == kCTFontWeightRegular)
return QFont::Normal;
- if (value <= -0.4)
- return QFont::Light;
- if (value <= -0.6)
- return QFont::ExtraLight;
- if (value <= -0.8)
+ if (value <= kCTFontWeightUltraLight)
return QFont::Thin;
+ if (value <= kCTFontWeightThin)
+ return QFont::ExtraLight;
+ if (value <= kCTFontWeightLight)
+ return QFont::Light;
return QFont::Normal;
}
diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp
index 84320bfe14..826c0104e4 100644
--- a/src/plugins/bearer/nativewifi/main.cpp
+++ b/src/plugins/bearer/nativewifi/main.cpp
@@ -41,7 +41,6 @@
#include "platformdefs.h"
#include <QtCore/qmutex.h>
-#include <QtCore/private/qmutexpool_p.h>
#include <QtCore/qlibrary.h>
#include <QtNetwork/private/qbearerplugin_p.h>
@@ -52,42 +51,32 @@
QT_BEGIN_NAMESPACE
-static void resolveLibrary()
+static bool resolveLibraryInternal()
{
- static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
-
- if (!triedResolve.loadAcquire()) {
-#ifndef QT_NO_THREAD
- QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle));
-#endif
-
- if (!triedResolve.load()) {
- QLibrary wlanapiLib(QLatin1String("wlanapi"));
- local_WlanOpenHandle = (WlanOpenHandleProto)
- wlanapiLib.resolve("WlanOpenHandle");
- local_WlanRegisterNotification = (WlanRegisterNotificationProto)
- wlanapiLib.resolve("WlanRegisterNotification");
- local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
- wlanapiLib.resolve("WlanEnumInterfaces");
- local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
- wlanapiLib.resolve("WlanGetAvailableNetworkList");
- local_WlanQueryInterface = (WlanQueryInterfaceProto)
- wlanapiLib.resolve("WlanQueryInterface");
- local_WlanConnect = (WlanConnectProto)
- wlanapiLib.resolve("WlanConnect");
- local_WlanDisconnect = (WlanDisconnectProto)
- wlanapiLib.resolve("WlanDisconnect");
- local_WlanScan = (WlanScanProto)
- wlanapiLib.resolve("WlanScan");
- local_WlanFreeMemory = (WlanFreeMemoryProto)
- wlanapiLib.resolve("WlanFreeMemory");
- local_WlanCloseHandle = (WlanCloseHandleProto)
- wlanapiLib.resolve("WlanCloseHandle");
-
- triedResolve.storeRelease(true);
- }
- }
+ QLibrary wlanapiLib(QLatin1String("wlanapi"));
+ local_WlanOpenHandle = (WlanOpenHandleProto)
+ wlanapiLib.resolve("WlanOpenHandle");
+ local_WlanRegisterNotification = (WlanRegisterNotificationProto)
+ wlanapiLib.resolve("WlanRegisterNotification");
+ local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
+ wlanapiLib.resolve("WlanEnumInterfaces");
+ local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
+ wlanapiLib.resolve("WlanGetAvailableNetworkList");
+ local_WlanQueryInterface = (WlanQueryInterfaceProto)
+ wlanapiLib.resolve("WlanQueryInterface");
+ local_WlanConnect = (WlanConnectProto)
+ wlanapiLib.resolve("WlanConnect");
+ local_WlanDisconnect = (WlanDisconnectProto)
+ wlanapiLib.resolve("WlanDisconnect");
+ local_WlanScan = (WlanScanProto)
+ wlanapiLib.resolve("WlanScan");
+ local_WlanFreeMemory = (WlanFreeMemoryProto)
+ wlanapiLib.resolve("WlanFreeMemory");
+ local_WlanCloseHandle = (WlanCloseHandleProto)
+ wlanapiLib.resolve("WlanCloseHandle");
+ return true;
}
+Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
class QNativeWifiEnginePlugin : public QBearerEnginePlugin
{
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp
index f15c4dd496..17d1aeeb5d 100644
--- a/src/plugins/imageformats/ico/qicohandler.cpp
+++ b/src/plugins/imageformats/ico/qicohandler.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
typedef struct
{
quint8 bWidth; // Width of the image
- quint8 bHeight; // Height of the image (times 2)
+ quint8 bHeight; // Height of the image (actual height, not times 2)
quint8 bColorCount; // Number of colors in image (0 if >=8bpp) [ not ture ]
quint8 bReserved; // Reserved
quint16 wPlanes; // Color Planes
@@ -687,8 +687,8 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images)
entries[i].bColorCount = 0;
entries[i].bReserved = 0;
entries[i].wBitCount = nbits;
- entries[i].bHeight = image.height();
- entries[i].bWidth = image.width();
+ entries[i].bHeight = image.height() < 256 ? image.height() : 0; // 0 means 256
+ entries[i].bWidth = image.width() < 256 ? image.width() : 0; // 0 means 256
entries[i].dwBytesInRes = BMP_INFOHDR_SIZE + (bpl_bmp * image.height())
+ (maskImage.bytesPerLine() * maskImage.height());
entries[i].wPlanes = 1;
@@ -702,11 +702,11 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images)
bmpHeaders[i].biClrImportant = 0;
bmpHeaders[i].biClrUsed = entries[i].bColorCount;
bmpHeaders[i].biCompression = 0;
- bmpHeaders[i].biHeight = entries[i].bHeight * 2; // 2 is for the mask
+ bmpHeaders[i].biHeight = entries[i].bHeight ? entries[i].bHeight * 2 : 256 * 2; // 2 is for the mask
bmpHeaders[i].biPlanes = entries[i].wPlanes;
bmpHeaders[i].biSize = BMP_INFOHDR_SIZE;
bmpHeaders[i].biSizeImage = entries[i].dwBytesInRes - BMP_INFOHDR_SIZE;
- bmpHeaders[i].biWidth = entries[i].bWidth;
+ bmpHeaders[i].biWidth = entries[i].bWidth ? entries[i].bWidth : 256;
bmpHeaders[i].biXPelsPerMeter = 0;
bmpHeaders[i].biYPelsPerMeter = 0;
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 488c9b8928..aaa12c6edb 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -58,7 +58,7 @@ static NSButton *macCreateButton(const char *text, NSView *superview)
[button setButtonType:NSMomentaryLightButton];
[button setBezelStyle:NSRoundedBezelStyle];
[button setTitle:(NSString*)(CFStringRef)QCFString(
- QPlatformTheme::removeMnemonics(QCoreApplication::translate("QDialogButtonBox", text)))];
+ QPlatformTheme::removeMnemonics(QCoreApplication::translate("QPlatformTheme", text)))];
[[button cell] setFont:[NSFont systemFontOfSize:
[NSFont systemFontSizeForControlSize:NSRegularControlSize]]];
[superview addSubview:button];
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index a445b6e9bf..86f6dda2e9 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -179,7 +179,9 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
}
}
- nativeItemForMenu(cocoaMenu).hidden = shouldHide;
+ NSMenuItem *nativeMenuItem = nativeItemForMenu(cocoaMenu);
+ nativeMenuItem.title = cocoaMenu->nsMenu().title;
+ nativeMenuItem.hidden = shouldHide;
}
NSMenuItem *QCocoaMenuBar::nativeItemForMenu(QCocoaMenu *menu) const
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index fa54c1e90e..64c460feb9 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -118,6 +118,8 @@ QCocoaMenuItem::~QCocoaMenuItem()
if (m_merged) {
[m_native setHidden:YES];
} else {
+ if (m_menu && m_menu->attachedItem() == m_native)
+ m_menu->setAttachedItem(nil);
[m_native release];
}
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 4d5f5d74f2..d9e94735ac 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -44,6 +44,7 @@
#include <qpa/qplatformwindow.h>
#include <QRect>
+#include <QPointer>
#ifndef QT_NO_OPENGL
#include "qcocoaglcontext.h"
@@ -53,6 +54,32 @@
QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
+QT_BEGIN_NAMESPACE
+
+class QCocoaWindowPointer
+{
+public:
+ void assign(QCocoaWindow *w);
+ void clear();
+
+ QCocoaWindow *data() const
+ { return watcher.isNull() ? Q_NULLPTR : window; }
+ bool isNull() const
+ { return watcher.isNull(); }
+ operator QCocoaWindow*() const
+ { return data(); }
+ QCocoaWindow *operator->() const
+ { return data(); }
+ QCocoaWindow &operator*() const
+ { return *data(); }
+
+private:
+ QPointer<QObject> watcher;
+ QCocoaWindow *window;
+};
+
+QT_END_NAMESPACE
+
@class QT_MANGLE_NAMESPACE(QNSWindowHelper);
@protocol QNSWindowProtocol
@@ -69,14 +96,13 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
@interface QT_MANGLE_NAMESPACE(QNSWindowHelper) : NSObject
{
QCocoaNSWindow *_window;
- QCocoaWindow *_platformWindow;
+ QCocoaWindowPointer _platformWindow;
BOOL _grabbingMouse;
BOOL _releaseOnMouseUp;
- QPointer<QObject> _watcher;
}
@property (nonatomic, readonly) QCocoaNSWindow *window;
-@property (nonatomic, readonly) QCocoaWindow *platformWindow;
+@property (nonatomic, readonly) QCocoaWindowPointer platformWindow;
@property (nonatomic) BOOL grabbingMouse;
@property (nonatomic) BOOL releaseOnMouseUp;
@@ -260,7 +286,7 @@ public: // for QNSView
NSView *m_contentView;
QNSView *m_qtView;
QCocoaNSWindow *m_nsWindow;
- QCocoaWindow *m_forwardWindow;
+ QCocoaWindowPointer m_forwardWindow;
// TODO merge to one variable if possible
bool m_contentViewIsEmbedded; // true if the m_contentView is actually embedded in a "foreign" NSView hiearchy
@@ -323,9 +349,8 @@ public: // for QNSView
QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower
QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false)
- // This object is tracked by a 'watcher'
- // object in a window helper, preventing use of dangling
- // pointers.
+ // This object is tracked by QCocoaWindowPointer,
+ // preventing the use of dangling pointers.
QObject sentinel;
};
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 01e72303be..eaa0170748 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -90,7 +90,7 @@ static bool isMouseEvent(NSEvent *ev)
self = [super init];
if (self) {
_window = window;
- _platformWindow = platformWindow;
+ _platformWindow.assign(platformWindow);
_window.delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:_platformWindow];
@@ -99,7 +99,6 @@ static bool isMouseEvent(NSEvent *ev)
// make sure that m_nsWindow stays valid until the
// QCocoaWindow is deleted by Qt.
[_window setReleasedWhenClosed:NO];
- _watcher = &_platformWindow->sentinel;
}
return self;
@@ -108,19 +107,19 @@ static bool isMouseEvent(NSEvent *ev)
- (void)handleWindowEvent:(NSEvent *)theEvent
{
QCocoaWindow *pw = self.platformWindow;
- if (_watcher && pw && pw->m_forwardWindow) {
+ if (pw && pw->m_forwardWindow) {
if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) {
QNSView *forwardView = pw->m_qtView;
if (theEvent.type == NSLeftMouseUp) {
[forwardView mouseUp:theEvent];
- pw->m_forwardWindow = 0;
+ pw->m_forwardWindow.clear();
} else {
[forwardView mouseDragged:theEvent];
}
}
if (!pw->m_isNSWindowChild && theEvent.type == NSLeftMouseDown) {
- pw->m_forwardWindow = 0;
+ pw->m_forwardWindow.clear();
}
}
@@ -147,7 +146,7 @@ static bool isMouseEvent(NSEvent *ev)
if (!self.window.delegate)
return; // Already detached, pending NSAppKitDefined event
- if (_watcher && pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) {
+ if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) {
NSPoint loc = [theEvent locationInWindow];
NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]];
NSRect contentFrame = [[self.window contentView] frame];
@@ -162,8 +161,7 @@ static bool isMouseEvent(NSEvent *ev)
- (void)detachFromPlatformWindow
{
- _platformWindow = 0;
- _watcher.clear();
+ self.platformWindow.clear();
[self.window.delegate release];
self.window.delegate = nil;
}
@@ -184,7 +182,7 @@ static bool isMouseEvent(NSEvent *ev)
- (void)dealloc
{
_window = nil;
- _platformWindow = 0;
+ self.platformWindow.clear();
[super dealloc];
}
@@ -336,6 +334,18 @@ static bool isMouseEvent(NSEvent *ev)
@end
+void QCocoaWindowPointer::assign(QCocoaWindow *w)
+{
+ window = w;
+ watcher = &w->sentinel;
+}
+
+void QCocoaWindowPointer::clear()
+{
+ window = Q_NULLPTR;
+ watcher.clear();
+}
+
const int QCocoaWindow::NoAlertRequest = -1;
QCocoaWindow::QCocoaWindow(QWindow *tlw)
@@ -343,7 +353,6 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
, m_contentView(nil)
, m_qtView(nil)
, m_nsWindow(0)
- , m_forwardWindow(0)
, m_contentViewIsEmbedded(false)
, m_contentViewIsToBeEmbedded(false)
, m_parentCocoaWindow(0)
@@ -1138,8 +1147,7 @@ bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
if (grab && ![m_nsWindow isKeyWindow])
[m_nsWindow makeKeyWindow];
- else if (!grab && [m_nsWindow isKeyWindow])
- [m_nsWindow resignKeyWindow];
+
return true;
}
@@ -1151,8 +1159,7 @@ bool QCocoaWindow::setMouseGrabEnabled(bool grab)
if (grab && ![m_nsWindow isKeyWindow])
[m_nsWindow makeKeyWindow];
- else if (!grab && [m_nsWindow isKeyWindow])
- [m_nsWindow resignKeyWindow];
+
return true;
}
@@ -1339,7 +1346,7 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
if (oldParentCocoaWindow) {
if (!m_isNSWindowChild || oldParentCocoaWindow != m_parentCocoaWindow)
oldParentCocoaWindow->removeChildWindow(this);
- m_forwardWindow = oldParentCocoaWindow;
+ m_forwardWindow.assign(oldParentCocoaWindow);
}
setNSWindow(m_nsWindow);
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index c9783df44b..fcfc805348 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -290,6 +290,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)viewDidMoveToWindow
{
+ m_backingStore = Q_NULLPTR;
m_isMenuView = [self.window.className isEqualToString:@"NSCarbonMenuWindow"];
if (self.window) {
// This is the case of QWidgetAction's generated QWidget inserted in an NSMenu.
@@ -760,7 +761,7 @@ QT_WARNING_POP
if (theEvent.type == NSLeftMouseDragged || theEvent.type == NSLeftMouseUp)
targetView = m_platformWindow->m_forwardWindow->m_qtView;
else
- m_platformWindow->m_forwardWindow = 0;
+ m_platformWindow->m_forwardWindow.clear();
}
// Popups implicitly grap mouse events; forward to the active popup if there is one
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
index d96c3964df..abff88b4bd 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
@@ -48,6 +48,7 @@
#include <QtCore/QJsonArray>
#include <QtCore/QLoggingCategory>
#include <QtGui/QPainter>
+#include <QtGui/private/qguiapplication_p.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
@@ -69,13 +70,13 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
, m_cursorSize(64, 64) // 64x64 is the old standard size, we now try to query the real size below
, m_bo(Q_NULLPTR)
, m_cursorImage(0, 0, 0, 0, 0, 0)
- , m_visible(true)
+ , m_state(CursorPendingVisible)
{
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
- if (!hideCursorVal.isEmpty())
- m_visible = hideCursorVal.toInt() == 0;
- if (!m_visible)
+ if (!hideCursorVal.isEmpty() && hideCursorVal.toInt()) {
+ m_state = CursorDisabled;
return;
+ }
uint64_t width, height;
if ((drmGetCap(m_screen->device()->fd(), DRM_CAP_CURSOR_WIDTH, &width) == 0)
@@ -92,6 +93,12 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
initCursorAtlas();
}
+ m_deviceListener = new QEglFSKmsGbmCursorDeviceListener(this);
+ connect(QGuiApplicationPrivate::inputDeviceManager(), &QInputDeviceManager::deviceListChanged,
+ m_deviceListener, &QEglFSKmsGbmCursorDeviceListener::onDeviceListChanged);
+ if (!m_deviceListener->hasMouse())
+ m_state = CursorPendingHidden;
+
#ifndef QT_NO_CURSOR
QCursor cursor(Qt::ArrowCursor);
changeCursor(&cursor, 0);
@@ -101,6 +108,8 @@ QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
QEglFSKmsGbmCursor::~QEglFSKmsGbmCursor()
{
+ delete m_deviceListener;
+
Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) {
QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen);
drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0);
@@ -113,6 +122,31 @@ QEglFSKmsGbmCursor::~QEglFSKmsGbmCursor()
}
}
+void QEglFSKmsGbmCursor::updateMouseStatus()
+{
+ const bool wasVisible = m_state == CursorVisible;
+ const bool visible = m_deviceListener->hasMouse();
+ if (visible == wasVisible)
+ return;
+
+ m_state = visible ? CursorPendingVisible : CursorPendingHidden;
+
+#ifndef QT_NO_CURSOR
+ changeCursor(nullptr, m_screen->topLevelAt(pos()));
+#endif
+}
+
+bool QEglFSKmsGbmCursorDeviceListener::hasMouse() const
+{
+ return QGuiApplicationPrivate::inputDeviceManager()->deviceCount(QInputDeviceManager::DeviceTypePointer) > 0;
+}
+
+void QEglFSKmsGbmCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::DeviceType type)
+{
+ if (type == QInputDeviceManager::DeviceTypePointer)
+ m_cursor->updateMouseStatus();
+}
+
void QEglFSKmsGbmCursor::pointerEvent(const QMouseEvent &event)
{
setPos(event.screenPos().toPoint());
@@ -126,7 +160,15 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
if (!m_bo)
return;
- if (!m_visible)
+ if (m_state == CursorPendingHidden) {
+ m_state = CursorHidden;
+ Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) {
+ QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen);
+ drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0);
+ }
+ }
+
+ if (m_state == CursorHidden || m_state == CursorDisabled)
return;
const Qt::CursorShape newShape = windowCursor ? windowCursor->shape() : Qt::ArrowCursor;
@@ -166,6 +208,9 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window)
uint32_t handle = gbm_bo_get_handle(m_bo).u32;
+ if (m_state == CursorPendingVisible)
+ m_state = CursorVisible;
+
Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) {
QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen);
@@ -213,7 +258,7 @@ void QEglFSKmsGbmCursor::initCursorAtlas()
drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0);
drmModeMoveCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0);
}
- m_visible = false;
+ m_state = CursorDisabled;
return;
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
index c1e3706e91..de13a058cf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
@@ -43,12 +43,29 @@
#include <qpa/qplatformcursor.h>
#include <QtCore/QList>
#include <QtGui/QImage>
+#include <QtGui/private/qinputdevicemanager_p.h>
#include <gbm.h>
QT_BEGIN_NAMESPACE
class QEglFSKmsGbmScreen;
+class QEglFSKmsGbmCursor;
+
+class QEglFSKmsGbmCursorDeviceListener : public QObject
+{
+ Q_OBJECT
+
+public:
+ QEglFSKmsGbmCursorDeviceListener(QEglFSKmsGbmCursor *cursor) : m_cursor(cursor) { }
+ bool hasMouse() const;
+
+public slots:
+ void onDeviceListChanged(QInputDeviceManager::DeviceType type);
+
+private:
+ QEglFSKmsGbmCursor *m_cursor;
+};
class QEglFSKmsGbmCursor : public QPlatformCursor
{
@@ -66,15 +83,26 @@ public:
QPoint pos() const Q_DECL_OVERRIDE;
void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
+ void updateMouseStatus();
+
private:
void initCursorAtlas();
+ enum CursorState {
+ CursorDisabled,
+ CursorPendingHidden,
+ CursorHidden,
+ CursorPendingVisible,
+ CursorVisible
+ };
+
QEglFSKmsGbmScreen *m_screen;
QSize m_cursorSize;
gbm_bo *m_bo;
QPoint m_pos;
QPlatformCursorImage m_cursorImage;
- bool m_visible;
+ CursorState m_state;
+ QEglFSKmsGbmCursorDeviceListener *m_deviceListener;
// cursor atlas information
struct CursorAtlas {
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp
index 229ac6bbd9..6acb362bf0 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp
@@ -37,6 +37,7 @@
**
****************************************************************************/
+#include "qeglfsglobal.h"
#include <QtGui/QSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/qeglfscontext.h
index b861ae5329..91c5a7910b 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.h
+++ b/src/plugins/platforms/eglfs/qeglfscontext.h
@@ -40,9 +40,9 @@
#ifndef QEGLFSCONTEXT_H
#define QEGLFSCONTEXT_H
+#include "qeglfsglobal.h"
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtCore/QVariant>
-#include "qeglfsglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
index cbbf2551b7..f1a5bde331 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
@@ -51,13 +51,12 @@
// We mean it.
//
+#include "qeglfsglobal.h"
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h>
#include <QtCore/QString>
#include <QtGui/QSurfaceFormat>
#include <QtGui/QImage>
-#include <EGL/egl.h>
-#include "qeglfsglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsglobal.h b/src/plugins/platforms/eglfs/qeglfsglobal.h
index 8b6a391143..d6aba565ce 100644
--- a/src/plugins/platforms/eglfs/qeglfsglobal.h
+++ b/src/plugins/platforms/eglfs/qeglfsglobal.h
@@ -48,4 +48,17 @@
#define Q_EGLFS_EXPORT Q_DECL_IMPORT
#endif
+#include <EGL/egl.h>
+#undef Status
+#undef None
+#undef Bool
+#undef CursorShape
+#undef KeyPress
+#undef KeyRelease
+#undef FocusIn
+#undef FocusOut
+#undef FontChange
+#undef Expose
+#undef Unsorted
+
#endif
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index 745c5d479c..cc6c325b58 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -40,8 +40,8 @@
#ifndef QEGLFSHOOKS_H
#define QEGLFSHOOKS_H
-#include "qeglfsdeviceintegration.h"
#include "qeglfsglobal.h"
+#include "qeglfsdeviceintegration.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 29e3c5e560..6f38a96f45 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -86,8 +86,6 @@
#include <QtPlatformHeaders/qeglfsfunctions.h>
-#include <EGL/egl.h>
-
static void initResources()
{
#ifndef QT_NO_CURSOR
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index e06d7e8876..678452a8db 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -40,12 +40,11 @@
#ifndef QEGLFSINTEGRATION_H
#define QEGLFSINTEGRATION_H
+#include "qeglfsglobal.h"
#include <QtCore/QVariant>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformscreen.h>
-#include <EGL/egl.h>
-#include "qeglfsglobal.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h
index 6f808d8a10..673fa0d729 100644
--- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h
+++ b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h
@@ -40,9 +40,8 @@
#ifndef QEGLFSOFFSCREENWINDOW_H
#define QEGLFSOFFSCREENWINDOW_H
-#include <EGL/egl.h>
-#include <qpa/qplatformoffscreensurface.h>
#include "qeglfsglobal.h"
+#include <qpa/qplatformoffscreensurface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h
index b388885186..57d68ca572 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.h
@@ -42,7 +42,6 @@
#include "qeglfsglobal.h"
#include <QtCore/QPointer>
-#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index 621890b060..d607c8bd62 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -40,13 +40,12 @@
#ifndef QEGLFSWINDOW_H
#define QEGLFSWINDOW_H
+#include "qeglfsglobal.h"
#include "qeglfsintegration.h"
#include "qeglfsscreen.h"
-#include "qeglfsglobal.h"
#include <qpa/qplatformwindow.h>
#include <QtPlatformSupport/private/qopenglcompositor_p.h>
-#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
index f0c29130f8..6ca651fdf7 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
@@ -412,8 +412,10 @@ QRegion QLinuxFbScreen::doRedraw()
if (!mBlitter)
mBlitter = new QPainter(&mFbScreenImage);
+ mBlitter->setCompositionMode(QPainter::CompositionMode_Source);
for (const QRect &rect : touched)
mBlitter->drawImage(rect, *mScreenImage, rect);
+
return touched;
}
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index f77e7241e6..ff115a2249 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -504,7 +504,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yT
if (!accessible)
return E_FAIL;
- const QPoint pos = QHighDpi::fromNativeLocalPosition(QPoint(xLeft, yTop), accessible->window());
+ const QPoint pos = QHighDpi::fromNativeLocalPosition(QPoint(xLeft, yTop),
+ QWindowsAccessibility::windowHelper(accessible));
QAccessibleInterface *child = accessible->childAt(pos.x(), pos.y());
if (child == 0) {
// no child found, return this item if it contains the coordinates
@@ -547,7 +548,8 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long
QAccessibleInterface *acc = childPointer(accessible, varID);
if (!acc || !acc->isValid())
return E_FAIL;
- const QRect rect = QHighDpi::toNativePixels(acc->rect(), accessible->window());
+ const QRect rect = QHighDpi::toNativePixels(acc->rect(),
+ QWindowsAccessibility::windowHelper(accessible));
*pxLeft = rect.x();
*pyTop = rect.y();
diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json
index f7a8844611..1e00da52eb 100644
--- a/src/plugins/platforms/windows/openglblacklists/default.json
+++ b/src/plugins/platforms/windows/openglblacklists/default.json
@@ -90,6 +90,18 @@
"features": [
"disable_angle"
]
+ },
+ {
+ "id": 8,
+ "description": "Standard VGA: Insufficent support for OpenGL, D3D9 and D3D11",
+ "vendor_id": "0x0000",
+ "device_id": ["0x0000"],
+ "os": {
+ "type": "win"
+ },
+ "features": [
+ "disable_desktopgl", "disable_d3d11", "disable_d3d9"
+ ]
}
]
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 764c76e323..6e324ce0ed 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -139,7 +139,8 @@ struct QWindowsIntegrationPrivate
# endif
#endif
#ifndef QT_NO_OPENGL
- QSharedPointer<QWindowsStaticOpenGLContext> m_staticOpenGLContext;
+ QMutex m_staticContextLock;
+ QScopedPointer<QWindowsStaticOpenGLContext> m_staticOpenGLContext;
#endif // QT_NO_OPENGL
QScopedPointer<QPlatformInputContext> m_inputContext;
#ifndef QT_NO_ACCESSIBILITY
@@ -455,8 +456,9 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext()
if (!integration)
return 0;
QWindowsIntegrationPrivate *d = integration->d.data();
+ QMutexLocker lock(&d->m_staticContextLock);
if (d->m_staticOpenGLContext.isNull())
- d->m_staticOpenGLContext = QSharedPointer<QWindowsStaticOpenGLContext>(QWindowsStaticOpenGLContext::create());
+ d->m_staticOpenGLContext.reset(QWindowsStaticOpenGLContext::create());
return d->m_staticOpenGLContext.data();
}
#endif // !QT_NO_OPENGL
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp
index 3cae53d0a0..a910967f87 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.cpp
+++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp
@@ -110,9 +110,6 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
d->surface = EGL_NO_SURFACE;
d->display = EGL_NO_DISPLAY;
d->screen = static_cast<QWinRTScreen *>(screen());
- setWindowFlags(window->flags());
- setWindowState(window->windowState());
- setWindowTitle(window->title());
handleContentOrientationChange(window->contentOrientation());
d->surfaceFormat.setAlphaBufferSize(0);
@@ -160,6 +157,10 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
});
Q_ASSERT_SUCCEEDED(hr);
+ setWindowFlags(window->flags());
+ setWindowState(window->windowState());
+ setWindowTitle(window->title());
+
setGeometry(window->geometry());
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 87b4c7b91f..4b0e94eda0 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1713,7 +1713,8 @@ void QXcbConnection::processXcbEvents()
continue;
}
- if (compressEvent(event, i, eventqueue))
+ if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_CompressHighFrequencyEvents)) &&
+ compressEvent(event, i, eventqueue))
continue;
bool accepted = false;
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index b55fbd8f03..fb006ec0f1 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -56,6 +56,7 @@
#include <qpa/qwindowsysteminterface.h>
+#include <private/qguiapplication_p.h>
#include <private/qshapedpixmapdndwindow_p.h>
#include <private/qsimpledrag_p.h>
#include <private/qhighdpiscaling_p.h>
@@ -176,6 +177,17 @@ QMimeData *QXcbDrag::platformDropData()
return dropData;
}
+bool QXcbDrag::eventFilter(QObject *o, QEvent *e)
+{
+ /* We are setting a mouse grab on the QShapedPixmapWindow in order not to
+ * lose the grab when the virtual desktop changes, but
+ * QBasicDrag::eventFilter() expects the events to be coming from the
+ * window where the drag was started. */
+ if (initiatorWindow && o == shapedPixmapWindow())
+ o = initiatorWindow.data();
+ return QBasicDrag::eventFilter(o, e);
+}
+
void QXcbDrag::startDrag()
{
// #fixme enableEventFilter();
@@ -200,6 +212,7 @@ void QXcbDrag::startDrag()
setUseCompositing(current_virtual_desktop->compositingActive());
setScreen(current_virtual_desktop->screens().constFirst()->screen());
+ initiatorWindow = QGuiApplicationPrivate::currentMouseWindow;
QBasicDrag::startDrag();
if (connection()->mouseGrabber() == Q_NULLPTR)
shapedPixmapWindow()->setMouseGrabEnabled(true);
@@ -208,6 +221,7 @@ void QXcbDrag::startDrag()
void QXcbDrag::endDrag()
{
QBasicDrag::endDrag();
+ initiatorWindow.clear();
}
static xcb_translate_coordinates_reply_t *
@@ -821,7 +835,7 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event)
DEBUG("xdndHandleStatus");
waiting_for_status = false;
// ignore late status messages
- if (event->data.data32[0] && event->data.data32[0] != current_proxy_target)
+ if (event->data.data32[0] && event->data.data32[0] != current_target)
return;
const bool dropPossible = event->data.data32[1];
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index 7eac6cbbe0..f65dbda05d 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -75,6 +75,7 @@ public:
~QXcbDrag();
virtual QMimeData *platformDropData() Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
void startDrag() Q_DECL_OVERRIDE;
void cancel() Q_DECL_OVERRIDE;
@@ -112,6 +113,7 @@ private:
Qt::DropAction toDropAction(xcb_atom_t atom) const;
xcb_atom_t toXdndAction(Qt::DropAction a) const;
+ QPointer<QWindow> initiatorWindow;
QPointer<QWindow> currentWindow;
QPoint currentPosition;
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 703167c0cd..cdbf9b295e 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -125,6 +125,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
, m_defaultVisualId(UINT_MAX)
{
m_instance = this;
+ qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
qRegisterMetaType<QXcbWindow*>();
#ifdef XCB_USE_XLIB
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index a4a99ece64..825a8acd1f 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -117,17 +117,18 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
QString atomName = mimeAtomToString(connection, a);
if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) {
*data = QInternalMimeData::renderDataHelper(atomName, mimeData);
- if (atomName == QLatin1String("application/x-color"))
+ // mimeAtomToString() converts "text/x-moz-url" to "text/uri-list",
+ // so QXcbConnection::atomName() has to be used.
+ if (atomName == QLatin1String("text/uri-list")
+ && connection->atomName(a) == "text/x-moz-url") {
+ const QByteArray uri = data->split('\n').first();
+ QString mozUri = QString::fromLatin1(uri, uri.size());
+ mozUri += QLatin1Char('\n');
+ *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()),
+ mozUri.length() * 2);
+ } else if (atomName == QLatin1String("application/x-color"))
*dataFormat = 16;
ret = true;
- } else if (atomName == QLatin1String("text/x-moz-url") &&
- QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) {
- QByteArray uri = QInternalMimeData::renderDataHelper(
- QLatin1String("text/uri-list"), mimeData).split('\n').first();
- QString mozUri = QString::fromLatin1(uri, uri.size());
- mozUri += QLatin1Char('\n');
- *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2);
- ret = true;
} else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) {
ret = true;
}
@@ -188,17 +189,37 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
a == connection->atom(QXcbAtom::TEXT))
return QString::fromLatin1(data);
}
-
- // special case for uri types
- if (format == QLatin1String("text/uri-list")) {
- if (atomName == QLatin1String("text/x-moz-url")) {
- // we expect this as utf16 <url><space><title>
- // the first part is a url that should only contain ascci char
- // so it should be safe to check that the second char is 0
- // to verify that it is utf16
- if (data.size() > 1 && data.at(1) == 0)
- return QString::fromRawData((const QChar *)data.constData(),
- data.size() / 2).split(QLatin1Char('\n')).first().toLatin1();
+ // If data contains UTF16 text, convert it to a string.
+ // Firefox uses UTF16 without BOM for text/x-moz-url, "text/html",
+ // Google Chrome uses UTF16 without BOM for "text/x-moz-url",
+ // UTF16 with BOM for "text/html".
+ if ((format == QLatin1String("text/html") || format == QLatin1String("text/uri-list"))
+ && data.size() > 1) {
+ const quint8 byte0 = data.at(0);
+ const quint8 byte1 = data.at(1);
+ if ((byte0 == 0xff && byte1 == 0xfe) || (byte0 == 0xfe && byte1 == 0xff)
+ || (byte0 != 0 && byte1 == 0) || (byte0 == 0 && byte1 != 0)) {
+ const QString str = QString::fromUtf16(
+ reinterpret_cast<const ushort *>(data.constData()), data.size() / 2);
+ if (!str.isNull()) {
+ if (format == QLatin1String("text/uri-list")) {
+ const QStringList urls = str.split(QLatin1Char('\n'));
+ QList<QVariant> list;
+ foreach (const QString &s, urls) {
+ const QUrl url(s.trimmed());
+ if (url.isValid())
+ list.append(url);
+ }
+ // We expect "text/x-moz-url" as <url><space><title>.
+ // The atomName variable is not used because mimeAtomToString()
+ // converts "text/x-moz-url" to "text/uri-list".
+ if (!list.isEmpty() && connection->atomName(a) == "text/x-moz-url")
+ return list.first();
+ return list;
+ } else {
+ return str;
+ }
+ }
}
}
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 17fafd5ef0..789229c0a7 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2336,9 +2336,14 @@ void QXcbWindow::handleMotionNotifyEvent(int event_x, int event_y, int root_x, i
QPoint local(event_x, event_y);
QPoint global(root_x, root_y);
- // "mousePressWindow" can be NULL i.e. if a window will be grabbed or umnapped, so set it again here
- if (connection()->buttons() != Qt::NoButton && connection()->mousePressWindow() == Q_NULLPTR)
+ // "mousePressWindow" can be NULL i.e. if a window will be grabbed or unmapped, so set it again here.
+ // Unset "mousePressWindow" when mouse button isn't pressed - in some cases the release event won't arrive.
+ const bool isMouseButtonPressed = (connection()->buttons() != Qt::NoButton);
+ const bool hasMousePressWindow = (connection()->mousePressWindow() != Q_NULLPTR);
+ if (isMouseButtonPressed && !hasMousePressWindow)
connection()->setMousePressWindow(this);
+ else if (hasMousePressWindow && !isMouseButtonPressed)
+ connection()->setMousePressWindow(Q_NULLPTR);
handleMouseEvent(timestamp, local, global, modifiers, source);
}
diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf
index d8fbc23c0a..fbb6f8d1a9 100644
--- a/src/printsupport/doc/qtprintsupport.qdocconf
+++ b/src/printsupport/doc/qtprintsupport.qdocconf
@@ -4,7 +4,7 @@ project = QtPrintSupport
description = Qt Print Support Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/printsupport
+examplesinstallpath = printsupport
qhp.projects = QtPrintSupport
diff --git a/src/printsupport/printsupport.pro b/src/printsupport/printsupport.pro
index 52eab672d3..52e99803c3 100644
--- a/src/printsupport/printsupport.pro
+++ b/src/printsupport/printsupport.pro
@@ -1,7 +1,7 @@
TARGET = QtPrintSupport
QT = core-private gui-private widgets-private
-DEFINES += QT_NO_USING_NAMESPACE
+DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
QMAKE_DOCS = $$PWD/doc/qtprintsupport.qdocconf
diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf
index ceaa75f455..5a224adeb9 100644
--- a/src/sql/doc/qtsql.qdocconf
+++ b/src/sql/doc/qtsql.qdocconf
@@ -4,7 +4,7 @@ project = QtSql
description = Qt SQL Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/sql
+examplesinstallpath = sql
qhp.projects = QtSql
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 0bc86494f9..9932fb75e3 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -500,7 +500,7 @@ QVariant QSqlTableModel::headerData(int section, Qt::Orientation orientation, in
\since 5.0
Returns \c true if the model contains modified values that have not been
- committed to the datase, otherwise false.
+ committed to the database, otherwise false.
*/
bool QSqlTableModel::isDirty() const
{
diff --git a/src/sql/sql.pro b/src/sql/sql.pro
index 622ffb66c5..133bf831c8 100644
--- a/src/sql/sql.pro
+++ b/src/sql/sql.pro
@@ -6,7 +6,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf
-DEFINES += QT_NO_CAST_FROM_ASCII
+DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
diff --git a/src/src.pro b/src/src.pro
index 0e411f96af..fcececdeda 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -129,7 +129,12 @@ src_plugins.depends = src_sql src_xml src_network
src_android.subdir = $$PWD/android
# this order is important
-!contains(QT_CONFIG, system-zlib)|cross_compile: SUBDIRS += src_qtzlib
+!contains(QT_CONFIG, system-zlib)|cross_compile {
+ SUBDIRS += src_qtzlib
+ !contains(QT_CONFIG, system-zlib) {
+ src_3rdparty_freetype.depends += src_corelib
+ }
+}
SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc
!contains(QT_DISABLED_FEATURES, regularexpression):pcre {
SUBDIRS += src_3rdparty_pcre
@@ -140,7 +145,8 @@ TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr
win32:SUBDIRS += src_winmain
SUBDIRS += src_network src_sql src_xml src_testlib
contains(QT_CONFIG, dbus) {
- force_bootstrap: SUBDIRS += src_tools_bootstrap_dbus
+ force_bootstrap|contains(QT_CONFIG, private_tests): \
+ SUBDIRS += src_tools_bootstrap_dbus
SUBDIRS += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
TOOLS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
contains(QT_CONFIG, accessibility-atspi-bridge): \
diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf
index 72db51b925..0fafc733b1 100644
--- a/src/testlib/doc/qttestlib.qdocconf
+++ b/src/testlib/doc/qttestlib.qdocconf
@@ -4,7 +4,7 @@ project = QtTestLib
description = Qt Test Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/testlib
+examplesinstallpath = testlib
qhp.projects = QtTestLib
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 3ef9fd148f..09da575bc9 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -244,7 +244,7 @@ namespace QTest
inline typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, char*>::Type toString(T e)
{
QMetaEnum me = QMetaEnum::fromType<T>();
- return qstrdup(me.key(int(e))); // int cast is necessary to support enum classes
+ return qstrdup(me.valueToKey(int(e))); // int cast is necessary to support enum classes
}
template <typename T> // Fallback
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 9d204208cf..386dfb6c0e 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -64,6 +64,7 @@ SOURCES = qtestcase.cpp \
DEFINES *= QT_NO_CAST_TO_ASCII \
QT_NO_CAST_FROM_ASCII \
+ QT_NO_FOREACH \
QT_NO_DATASTREAM
embedded:QMAKE_CXXFLAGS += -fno-rtti
diff --git a/src/tools/bootstrap-dbus/bootstrap-dbus.pro b/src/tools/bootstrap-dbus/bootstrap-dbus.pro
index 3b28c23311..c3ed27d979 100644
--- a/src/tools/bootstrap-dbus/bootstrap-dbus.pro
+++ b/src/tools/bootstrap-dbus/bootstrap-dbus.pro
@@ -5,6 +5,7 @@ TARGET = QtBootstrapDBus
CONFIG += minimal_syncqt internal_module force_bootstrap
DEFINES += \
+ QT_NO_FOREACH \
QT_NO_CAST_FROM_ASCII
MODULE_INCNAME = QtDBus
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 2eb8837b4c..f763d0c8fe 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -23,6 +23,7 @@ MODULE_DEFINES = \
DEFINES += \
$$MODULE_DEFINES \
QT_CRYPTOGRAPHICHASH_ONLY_SHA1 \
+ QT_NO_FOREACH \
QT_NO_CAST_FROM_ASCII
DEFINES -= QT_EVAL
@@ -133,8 +134,12 @@ macx {
../../corelib/io/qstandardpaths_win.cpp
}
-!contains(QT_CONFIG, system-zlib)|cross_compile:include(../../3rdparty/zlib.pri)
-else:include(../../3rdparty/zlib_dependency.pri)
+!contains(QT_CONFIG, system-zlib)|cross_compile {
+ include(../../3rdparty/zlib.pri)
+} else {
+ CONFIG += no_core_dep
+ include(../../3rdparty/zlib_dependency.pri)
+}
win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index eb365b293c..f2efcadad7 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -373,8 +373,8 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro)
def->isVirtual = false;
def->isStatic = false;
//skip modifiers and attributes
- while (test(INLINE) || (test(STATIC) && (def->isStatic = true)) ||
- (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
+ while (test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) ||
+ (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual
|| testFunctionAttribute(def) || testFunctionRevision(def)) {}
bool templateFunction = (lookup() == TEMPLATE);
def->type = parseType();
@@ -467,8 +467,8 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
def->isVirtual = false;
def->isStatic = false;
//skip modifiers and attributes
- while (test(EXPLICIT) || test(INLINE) || (test(STATIC) && (def->isStatic = true)) ||
- (test(VIRTUAL) && (def->isVirtual = true)) //mark as virtual
+ while (test(EXPLICIT) || test(INLINE) || (test(STATIC) && (def->isStatic = true) == true) ||
+ (test(VIRTUAL) && (def->isVirtual = true) == true) //mark as virtual
|| testFunctionAttribute(def) || testFunctionRevision(def)) {}
bool tilde = test(TILDE);
def->type = parseType();
diff --git a/src/tools/moc/moc.pro b/src/tools/moc/moc.pro
index d39749a318..ccd29341d0 100644
--- a/src/tools/moc/moc.pro
+++ b/src/tools/moc/moc.pro
@@ -1,7 +1,12 @@
option(host_build)
CONFIG += force_bootstrap
-DEFINES += QT_MOC QT_NO_CAST_FROM_ASCII QT_NO_CAST_FROM_BYTEARRAY QT_NO_COMPRESS
+DEFINES += \
+ QT_MOC \
+ QT_NO_CAST_FROM_ASCII \
+ QT_NO_CAST_FROM_BYTEARRAY \
+ QT_NO_COMPRESS \
+ QT_NO_FOREACH
include(moc.pri)
HEADERS += qdatetime_p.h
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 59611ca597..6ae785f417 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
static QByteArray cleaned(const QByteArray &input)
{
QByteArray result;
- result.reserve(input.size());
+ result.resize(input.size());
const char *data = input.constData();
const char *end = input.constData() + input.size();
char *output = result.data();
@@ -73,13 +73,15 @@ static QByteArray cleaned(const QByteArray &input)
if (data != end && (*(data + 1) == '\n' || (*data) == '\r')) {
++newlines;
data += 1;
- if (*data != '\r')
+ if (data != end && *data != '\r')
data += 1;
continue;
}
} else if (*data == '\r' && *(data + 1) == '\n') { // reduce \r\n to \n
++data;
}
+ if (data == end)
+ break;
char ch = *data;
if (ch == '\r') // os9: replace \r with \n
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro b/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro
index d65b5ce6ef..5ac3159797 100644
--- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro
+++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.pro
@@ -2,7 +2,7 @@ option(host_build)
QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
-DEFINES += QT_NO_CAST_FROM_ASCII
+DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
include(../moc/moc.pri)
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro b/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro
index 6efcf323b8..cb14db5fef 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.pro
@@ -2,7 +2,7 @@ option(host_build)
QT = core-private
force_bootstrap: QT += bootstrap_dbus-private
else: QT += dbus-private
-DEFINES += QT_NO_CAST_FROM_ASCII
+DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
QMAKE_CXXFLAGS += $$QT_HOST_CFLAGS_DBUS
SOURCES = qdbusxml2cpp.cpp
diff --git a/src/tools/qlalr/qlalr.pro b/src/tools/qlalr/qlalr.pro
index 08cf6a1591..bd5f337c64 100644
--- a/src/tools/qlalr/qlalr.pro
+++ b/src/tools/qlalr/qlalr.pro
@@ -22,4 +22,7 @@ HEADERS += \
OTHER_FILES += \
lalr.g
+DEFINES += \
+ QT_NO_FOREACH
+
load(qt_tool)
diff --git a/src/tools/rcc/rcc.pro b/src/tools/rcc/rcc.pro
index de3cc90e1b..701f15ff22 100644
--- a/src/tools/rcc/rcc.pro
+++ b/src/tools/rcc/rcc.pro
@@ -1,7 +1,7 @@
option(host_build)
CONFIG += force_bootstrap
-DEFINES += QT_RCC QT_NO_CAST_FROM_ASCII
+DEFINES += QT_RCC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
include(rcc.pri)
SOURCES += main.cpp
diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro
index a625bdef9a..8008dde07a 100644
--- a/src/tools/uic/uic.pro
+++ b/src/tools/uic/uic.pro
@@ -1,6 +1,6 @@
option(host_build)
-DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII
+DEFINES += QT_UIC QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
include(uic.pri)
include(cpp/cpp.pri)
diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp
index 5b10c6d6c6..4a684e01f9 100644
--- a/src/widgets/accessible/qaccessiblemenu.cpp
+++ b/src/widgets/accessible/qaccessiblemenu.cpp
@@ -231,6 +231,20 @@ QObject *QAccessibleMenuItem::object() const
return m_action;
}
+/*! \reimp */
+QWindow *QAccessibleMenuItem::window() const
+{
+ QWindow *result = Q_NULLPTR;
+ if (!m_owner.isNull()) {
+ result = m_owner->windowHandle();
+ if (!result) {
+ if (const QWidget *nativeParent = m_owner->nativeParentWidget())
+ result = nativeParent->windowHandle();
+ }
+ }
+ return result;
+}
+
QRect QAccessibleMenuItem::rect() const
{
QRect rect;
diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h
index e9dc851ab3..5a5a4a3222 100644
--- a/src/widgets/accessible/qaccessiblemenu_p.h
+++ b/src/widgets/accessible/qaccessiblemenu_p.h
@@ -114,6 +114,8 @@ public:
QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
QObject * object() const Q_DECL_OVERRIDE;
+ QWindow *window() const Q_DECL_OVERRIDE;
+
QRect rect() const Q_DECL_OVERRIDE;
QAccessible::Role role() const Q_DECL_OVERRIDE;
void setText(QAccessible::Text t, const QString & text) Q_DECL_OVERRIDE;
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 901fd7e201..5096c1ff37 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -210,8 +210,14 @@ bool QAccessibleWidget::isValid() const
/*! \reimp */
QWindow *QAccessibleWidget::window() const
{
- Q_ASSERT(widget());
- return widget()->windowHandle();
+ const QWidget *w = widget();
+ Q_ASSERT(w);
+ QWindow *result = w->windowHandle();
+ if (!result) {
+ if (const QWidget *nativeParent = w->nativeParentWidget())
+ result = nativeParent->windowHandle();
+ }
+ return result;
}
/*!
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 5494036827..f3652c09da 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -174,8 +174,6 @@ private:
namespace {
-struct QWellArrayData;
-
class QWellArray : public QWidget
{
Q_OBJECT
@@ -195,8 +193,6 @@ public:
QSize sizeHint() const Q_DECL_OVERRIDE;
- virtual void setCellBrush(int row, int col, const QBrush &);
-
inline int cellWidth() const
{ return cellw; }
@@ -263,7 +259,6 @@ private:
int curCol;
int selRow;
int selCol;
- QWellArrayData *d;
};
void QWellArray::paintEvent(QPaintEvent *e)
@@ -313,15 +308,10 @@ void QWellArray::paintEvent(QPaintEvent *e)
}
}
-struct QWellArrayData {
- QBrush *brush;
-};
-
QWellArray::QWellArray(int rows, int cols, QWidget *parent)
: QWidget(parent)
,nrows(rows), ncols(cols)
{
- d = 0;
setFocusPolicy(Qt::StrongFocus);
cellw = 28;
cellh = 24;
@@ -370,14 +360,12 @@ void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
*/
void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r)
{
- if (d) {
- p->fillRect(r, d->brush[row*numCols()+col]);
- } else {
- p->fillRect(r, Qt::white);
- p->setPen(Qt::black);
- p->drawLine(r.topLeft(), r.bottomRight());
- p->drawLine(r.topRight(), r.bottomLeft());
- }
+ Q_UNUSED(row);
+ Q_UNUSED(col);
+ p->fillRect(r, Qt::white);
+ p->setPen(Qt::black);
+ p->drawLine(r.topLeft(), r.bottomRight());
+ p->drawLine(r.topRight(), r.bottomLeft());
}
void QWellArray::mousePressEvent(QMouseEvent *e)
@@ -453,17 +441,6 @@ void QWellArray::focusInEvent(QFocusEvent*)
emit currentChanged(curRow, curCol);
}
-void QWellArray::setCellBrush(int row, int col, const QBrush &b)
-{
- if (!d) {
- d = new QWellArrayData;
- int i = numRows()*numCols();
- d->brush = new QBrush[i];
- }
- if (row >= 0 && row < numRows() && col >= 0 && col < numCols())
- d->brush[row*numCols()+col] = b;
-}
-
/*!\reimp
*/
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 1d07c31476..5424a4126a 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -372,6 +372,9 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
)
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
QModelIndex index = QModelIndex(); // start with "My Computer"
+ QString elementPath;
+ QChar separator = QLatin1Char('/');
+ QString trailingSeparator;
#if defined(Q_OS_WIN)
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
QString host = QLatin1String("\\\\") + pathElements.constFirst();
@@ -379,6 +382,8 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
absolutePath.append(QLatin1Char('/'));
if (longPath.endsWith(QLatin1Char('/')) && !absolutePath.endsWith(QLatin1Char('/')))
absolutePath.append(QLatin1Char('/'));
+ if (absolutePath.endsWith(QLatin1Char('/')))
+ trailingSeparator = QLatin1String("\\");
int r = 0;
QFileSystemModelPrivate::QFileSystemNode *rootNode = const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
if (!root.children.contains(host.toLower())) {
@@ -395,11 +400,10 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
r = translateVisibleLocation(rootNode, r);
index = q->index(r, 0, QModelIndex());
pathElements.pop_front();
- } else
-#endif
-
-#if defined(Q_OS_WIN)
- {
+ separator = QLatin1Char('\\');
+ elementPath = host;
+ elementPath.append(separator);
+ } else {
if (!pathElements.at(0).contains(QLatin1Char(':'))) {
QString rootPath = QDir(longPath).rootPath();
pathElements.prepend(rootPath);
@@ -417,6 +421,11 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
for (int i = 0; i < pathElements.count(); ++i) {
QString element = pathElements.at(i);
+ if (i != 0)
+ elementPath.append(separator);
+ elementPath.append(element);
+ if (i == pathElements.count() - 1)
+ elementPath.append(trailingSeparator);
#ifdef Q_OS_WIN
// On Windows, "filename " and "filename" are equivalent and
// "filename . " and "filename" are equivalent
@@ -448,7 +457,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
if (!alreadyExisted) {
// Someone might call ::index("file://cookie/monster/doesn't/like/veggies"),
// a path that doesn't exists, I.E. don't blindly create directories.
- QFileInfo info(absolutePath);
+ QFileInfo info(elementPath);
if (!info.exists())
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);
diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf
index 75bbb99579..d0cf9671b1 100644
--- a/src/widgets/doc/qtwidgets.qdocconf
+++ b/src/widgets/doc/qtwidgets.qdocconf
@@ -4,7 +4,7 @@ project = QtWidgets
description = Qt Widgets Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/widgets
+examplesinstallpath = widgets
qhp.projects = QtWidgets
diff --git a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
index abd6ddd5fb..1e99030e7a 100644
--- a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc
@@ -43,11 +43,11 @@
\table
\row
- \li \image gtk-label.png
+ \li \image fusion-label.png
\li \image windowsvista-pushbutton.png
\li \image macintosh-progressbar.png
\row
- \li \image gtk-combobox.png
+ \li \image fusion-combobox.png
\li \image windowsvista-radiobutton.png
\li \image macintosh-lineedit.png
\endtable
@@ -69,7 +69,7 @@
\table
\row
\li \image windowsxp-treeview.png
- \li \image gtk-calendarwidget.png
+ \li \image fusion-calendarwidget.png
\li \image qundoview.png
\endtable
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index ff3832e499..c7cc1d155e 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3247,13 +3247,12 @@ void QTableViewPrivate::selectRow(int row, bool anchor)
command |= QItemSelectionModel::Current;
}
- QModelIndex tl = model->index(qMin(rowSectionAnchor, row), logicalColumn(0), root);
- QModelIndex br = model->index(qMax(rowSectionAnchor, row), logicalColumn(model->columnCount(root) - 1), root);
- if ((verticalHeader->sectionsMoved() && tl.row() != br.row())
- || horizontalHeader->sectionsMoved()) {
- q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
+ QModelIndex upper = model->index(qMin(rowSectionAnchor, row), column, root);
+ QModelIndex lower = model->index(qMax(rowSectionAnchor, row), column, root);
+ if ((verticalHeader->sectionsMoved() && upper.row() != lower.row())) {
+ q->setSelection(q->visualRect(upper) | q->visualRect(lower), command | QItemSelectionModel::Rows);
} else {
- selectionModel->select(QItemSelection(tl, br), command);
+ selectionModel->select(QItemSelection(upper, lower), command | QItemSelectionModel::Rows);
}
}
}
@@ -3287,14 +3286,12 @@ void QTableViewPrivate::selectColumn(int column, bool anchor)
command |= QItemSelectionModel::Current;
}
- QModelIndex tl = model->index(logicalRow(0), qMin(columnSectionAnchor, column), root);
- QModelIndex br = model->index(logicalRow(model->rowCount(root) - 1),
- qMax(columnSectionAnchor, column), root);
- if ((horizontalHeader->sectionsMoved() && tl.column() != br.column())
- || verticalHeader->sectionsMoved()) {
- q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
+ QModelIndex left = model->index(row, qMin(columnSectionAnchor, column), root);
+ QModelIndex right = model->index(row, qMax(columnSectionAnchor, column), root);
+ if ((horizontalHeader->sectionsMoved() && left.column() != right.column())) {
+ q->setSelection(q->visualRect(left) | q->visualRect(right), command | QItemSelectionModel::Columns);
} else {
- selectionModel->select(QItemSelection(tl, br), command);
+ selectionModel->select(QItemSelection(left, right), command | QItemSelectionModel::Columns);
}
}
}
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 4ff466e04b..5007969c96 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2213,10 +2213,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
QApplication::setActiveWindow(tlw);
// QTBUG-37126, Active X controls may set the focus on native child widgets.
if (wnd && tlw && wnd != tlw->windowHandle()) {
- if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd)) {
- if (widgetWindow->widget()->inherits("QAxHostWidget"))
- widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
- }
+ if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd))
+ if (QWidget *widget = widgetWindow->widget())
+ if (widget->inherits("QAxHostWidget"))
+ widget->setFocus(Qt::ActiveWindowFocusReason);
}
}
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 777be8525e..c901285d1a 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -552,7 +552,7 @@ bool QGestureManager::filterEvent(QObject *receiver, QEvent *event)
// filter method.
QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(receiver);
- if (widgetWindow)
+ if (widgetWindow && widgetWindow->widget())
return filterEvent(widgetWindow->widget(), event);
QGesture *state = qobject_cast<QGesture *>(receiver);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 495af34c60..6fa74b7cc6 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -12374,6 +12374,53 @@ static inline bool canMapPosition(QWindow *window)
return window->handle() && !qt_window_private(window)->resizeEventPending;
}
+#ifndef QT_NO_GRAPHICSVIEW
+static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w)
+{
+ QGraphicsProxyWidget *result = Q_NULLPTR;
+ const QWidgetPrivate *d = qt_widget_private(const_cast<QWidget *>(w));
+ if (d->extra)
+ result = d->extra->proxyWidget;
+ return result;
+}
+#endif // !QT_NO_GRAPHICSVIEW
+
+struct MapToGlobalTransformResult {
+ QTransform transform;
+ QWindow *window;
+};
+
+static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)
+{
+ MapToGlobalTransformResult result;
+ result.window = Q_NULLPTR;
+ for ( ; w ; w = w->parentWidget()) {
+#ifndef QT_NO_GRAPHICSVIEW
+ if (QGraphicsProxyWidget *qgpw = graphicsProxyWidget(w)) {
+ if (const QGraphicsScene *scene = qgpw->scene()) {
+ const QList <QGraphicsView *> views = scene->views();
+ if (!views.isEmpty()) {
+ result.transform *= qgpw->sceneTransform();
+ result.transform *= views.first()->viewportTransform();
+ w = views.first()->viewport();
+ }
+ }
+ }
+#endif // !QT_NO_GRAPHICSVIEW
+ QWindow *window = w->windowHandle();
+ if (window && canMapPosition(window)) {
+ result.window = window;
+ break;
+ }
+
+ const QPoint topLeft = w->geometry().topLeft();
+ result.transform.translate(topLeft.x(), topLeft.y());
+ if (w->isWindow())
+ break;
+ }
+ return result;
+}
+
/*!
\fn QPoint QWidget::mapToGlobal(const QPoint &pos) const
@@ -12385,29 +12432,9 @@ static inline bool canMapPosition(QWindow *window)
*/
QPoint QWidget::mapToGlobal(const QPoint &pos) const
{
-#ifndef QT_NO_GRAPHICSVIEW
- Q_D(const QWidget);
- if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) {
- const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views();
- if (!views.isEmpty()) {
- const QPointF scenePos = d->extra->proxyWidget->mapToScene(pos);
- const QPoint viewPortPos = views.first()->mapFromScene(scenePos);
- return views.first()->viewport()->mapToGlobal(viewPortPos);
- }
- }
-#endif // !QT_NO_GRAPHICSVIEW
- int x = pos.x(), y = pos.y();
- const QWidget *w = this;
- while (w) {
- QWindow *window = w->windowHandle();
- if (window && canMapPosition(window))
- return window->mapToGlobal(QPoint(x, y));
-
- x += w->data->crect.x();
- y += w->data->crect.y();
- w = w->isWindow() ? 0 : w->parentWidget();
- }
- return QPoint(x, y);
+ const MapToGlobalTransformResult t = mapToGlobalTransform(this);
+ const QPoint g = t.transform.map(pos);
+ return t.window ? t.window->mapToGlobal(g) : g;
}
/*!
@@ -12420,29 +12447,9 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const
*/
QPoint QWidget::mapFromGlobal(const QPoint &pos) const
{
-#ifndef QT_NO_GRAPHICSVIEW
- Q_D(const QWidget);
- if (d->extra && d->extra->proxyWidget && d->extra->proxyWidget->scene()) {
- const QList <QGraphicsView *> views = d->extra->proxyWidget->scene()->views();
- if (!views.isEmpty()) {
- const QPoint viewPortPos = views.first()->viewport()->mapFromGlobal(pos);
- const QPointF scenePos = views.first()->mapToScene(viewPortPos);
- return d->extra->proxyWidget->mapFromScene(scenePos).toPoint();
- }
- }
-#endif // !QT_NO_GRAPHICSVIEW
- int x = pos.x(), y = pos.y();
- const QWidget *w = this;
- while (w) {
- QWindow *window = w->windowHandle();
- if (window && canMapPosition(window))
- return window->mapFromGlobal(QPoint(x, y));
-
- x -= w->data->crect.x();
- y -= w->data->crect.y();
- w = w->isWindow() ? 0 : w->parentWidget();
- }
- return QPoint(x, y);
+ const MapToGlobalTransformResult t = mapToGlobalTransform(this);
+ const QPoint windowLocal = t.window ? t.window->mapFromGlobal(pos) : pos;
+ return t.transform.inverted().map(windowLocal);
}
QWidget *qt_pressGrab = 0;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 843b89b6e4..675d54f6b4 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -93,7 +93,7 @@ QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const
{
Q_Q(const QWidgetWindow);
const QWidget *widget = q->widget();
- if (!widget->isWindow() || !widget->hasHeightForWidth())
+ if (!widget || !widget->isWindow() || !widget->hasHeightForWidth())
return QRect();
const QSize oldSize = rect.size().toSize();
const QSize newSize = QLayout::closestAcceptableSize(widget, oldSize);
@@ -129,7 +129,7 @@ QWidgetWindow::QWidgetWindow(QWidget *widget)
&& !QApplication::testAttribute(Qt::AA_ForceRasterWidgets)) {
setSurfaceType(QSurface::RasterGLSurface);
}
- connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
+ connect(widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
connect(this, SIGNAL(screenChanged(QScreen*)), this, SLOT(handleScreenChange()));
}
@@ -148,16 +148,18 @@ QAccessibleInterface *QWidgetWindow::accessibleRoot() const
QObject *QWidgetWindow::focusObject() const
{
- QWidget *widget = m_widget->focusWidget();
+ QWidget *windowWidget = m_widget;
+ if (!windowWidget)
+ return Q_NULLPTR;
+
+ QWidget *widget = windowWidget->focusWidget();
if (!widget)
- widget = m_widget;
+ widget = windowWidget;
- if (widget) {
- QObject *focusObj = QWidgetPrivate::get(widget)->focusObject();
- if (focusObj)
- return focusObj;
- }
+ QObject *focusObj = QWidgetPrivate::get(widget)->focusObject();
+ if (focusObj)
+ return focusObj;
return widget;
}
@@ -180,6 +182,9 @@ static inline bool shouldBePropagatedToWidget(QEvent *event)
bool QWidgetWindow::event(QEvent *event)
{
+ if (!m_widget)
+ return QWindow::event(event);
+
if (m_widget->testAttribute(Qt::WA_DontShowOnScreen)) {
// \a event is uninteresting for QWidgetWindow, the event was probably
// generated before WA_DontShowOnScreen was set
@@ -207,7 +212,7 @@ bool QWidgetWindow::event(QEvent *event)
#ifndef QT_NO_ACCESSIBILITY
QAccessible::State state;
state.active = true;
- QAccessibleStateChangeEvent ev(widget(), state);
+ QAccessibleStateChangeEvent ev(m_widget, state);
QAccessible::updateAccessibility(&ev);
#endif
return false; }
@@ -381,7 +386,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
} else {
const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
QWidget *child = m_widget->childAt(ee->pos());
- QWidget *receiver = child ? child : m_widget;
+ QWidget *receiver = child ? child : m_widget.data();
QApplicationPrivate::dispatchEnterLeave(receiver, 0, ee->screenPos());
qt_last_mouse_receiver = receiver;
}
diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h
index d20e7cb15e..a0d79b2b72 100644
--- a/src/widgets/kernel/qwidgetwindow_p.h
+++ b/src/widgets/kernel/qwidgetwindow_p.h
@@ -125,7 +125,7 @@ private:
};
QWidget *getFocusWidget(FocusWidgets fw);
- QWidget *m_widget;
+ QPointer<QWidget> m_widget;
QPointer<QWidget> m_implicit_mouse_grabber;
#ifndef QT_NO_DRAGANDDROP
QPointer<QWidget> m_dragTarget;
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 1863ab9145..18f85ca505 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -627,6 +627,8 @@ void QUndoStack::push(QUndoCommand *cmd)
Marks the stack as clean and emits cleanChanged() if the stack was
not already clean.
+ This is typically called when a document is saved, for example.
+
Whenever the stack returns to this state through the use of undo/redo
commands, it emits the signal cleanChanged(). This signal is also
emitted when the stack leaves the clean state.
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 3c9cab4e17..2bc715724d 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -2192,7 +2192,6 @@ void QLineEdit::changeEvent(QEvent *ev)
d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this));
d->control->setPasswordMaskDelay(style()->styleHint(QStyle::SH_LineEdit_PasswordMaskDelay, &opt, this));
}
- d->m_iconSize = QSize();
update();
break;
case QEvent::LayoutDirectionChange:
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 3d8a854753..7da1d911ee 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -320,6 +320,12 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent)
setFocusPolicy(Qt::NoFocus);
}
+QLineEditPrivate *QLineEditIconButton::lineEditPrivate() const
+{
+ QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget());
+ return le ? static_cast<QLineEditPrivate *>(qt_widget_private(le)) : Q_NULLPTR;
+}
+
void QLineEditIconButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
@@ -331,7 +337,9 @@ void QLineEditIconButton::paintEvent(QPaintEvent *)
QIcon::Mode state = QIcon::Disabled;
if (isEnabled())
state = isDown() ? QIcon::Selected : QIcon::Normal;
- const QSize iconSize(IconButtonSize, IconButtonSize);
+ const QLineEditPrivate *lep = lineEditPrivate();
+ const int iconWidth = lep ? lep->sideWidgetParameters().iconSize : 16;
+ const QSize iconSize(iconWidth, iconWidth);
const QPixmap iconPixmap = icon().pixmap(window, iconSize, state, QIcon::Off);
QRect pixmapRect = QRect(QPoint(0, 0), iconSize);
pixmapRect.moveCenter(rect().center());
@@ -346,8 +354,8 @@ void QLineEditIconButton::actionEvent(QActionEvent *e)
const QAction *action = e->action();
if (isVisibleTo(parentWidget()) != action->isVisible()) {
setVisible(action->isVisible());
- if (QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget()))
- static_cast<QLineEditPrivate *>(qt_widget_private(le))->positionSideWidgets();
+ if (QLineEditPrivate *lep = lineEditPrivate())
+ lep->positionSideWidgets();
}
}
break;
@@ -413,11 +421,15 @@ void QLineEditPrivate::_q_clearButtonClicked()
}
}
-QSize QLineEditPrivate::iconSize() const
+QLineEditPrivate::SideWidgetParameters QLineEditPrivate::sideWidgetParameters() const
{
- if (!m_iconSize.isValid()) // This might require style-specific handling (pixel metric).
- m_iconSize = QSize(QLineEditIconButton::IconButtonSize + 6, QLineEditIconButton::IconButtonSize + 2);
- return m_iconSize;
+ Q_Q(const QLineEdit);
+ SideWidgetParameters result;
+ result.iconSize = q->height() < 34 ? 16 : 32;
+ result.margin = result.iconSize / 4;
+ result.widgetWidth = result.iconSize + 6;
+ result.widgetHeight = result.iconSize + 2;
+ return result;
}
QIcon QLineEditPrivate::clearButtonIcon() const
@@ -443,15 +455,16 @@ void QLineEditPrivate::positionSideWidgets()
Q_Q(QLineEdit);
if (hasSideWidgets()) {
const QRect contentRect = q->rect();
- const QSize iconSize = QLineEditPrivate::iconSize();
- const int delta = QLineEditIconButton::IconMargin + iconSize.width();
- QRect widgetGeometry(QPoint(QLineEditIconButton::IconMargin, (contentRect.height() - iconSize.height()) / 2), iconSize);
+ const SideWidgetParameters p = sideWidgetParameters();
+ const int delta = p.margin + p.widgetWidth;
+ QRect widgetGeometry(QPoint(p.margin, (contentRect.height() - p.widgetHeight) / 2),
+ QSize(p.widgetWidth, p.widgetHeight));
for (const SideWidgetEntry &e : leftSideWidgetList()) {
e.widget->setGeometry(widgetGeometry);
if (e.action->isVisible())
widgetGeometry.moveLeft(widgetGeometry.left() + delta);
}
- widgetGeometry.moveLeft(contentRect.width() - iconSize.width() - QLineEditIconButton::IconMargin);
+ widgetGeometry.moveLeft(contentRect.width() - p.widgetWidth - p.margin);
for (const SideWidgetEntry &e : rightSideWidgetList()) {
e.widget->setGeometry(widgetGeometry);
if (e.action->isVisible())
@@ -539,18 +552,26 @@ static bool isSideWidgetVisible(const QLineEditPrivate::SideWidgetEntry &e)
int QLineEditPrivate::effectiveLeftTextMargin() const
{
- const auto &list = leftSideWidgetList();
- return leftTextMargin + (QLineEditIconButton::IconMargin + iconSize().width())
- * int(std::count_if(list.begin(), list.end(),
- isSideWidgetVisible));
+ int result = leftTextMargin;
+ if (!leftSideWidgetList().empty()) {
+ const SideWidgetParameters p = sideWidgetParameters();
+ result += (p.margin + p.widgetWidth)
+ * int(std::count_if(leftSideWidgetList().begin(), leftSideWidgetList().end(),
+ isSideWidgetVisible));
+ }
+ return result;
}
int QLineEditPrivate::effectiveRightTextMargin() const
{
- const auto &list = rightSideWidgetList();
- return rightTextMargin + (QLineEditIconButton::IconMargin + iconSize().width())
- * int(std::count_if(list.begin(), list.end(),
- isSideWidgetVisible));
+ int result = rightTextMargin;
+ if (!rightSideWidgetList().empty()) {
+ const SideWidgetParameters p = sideWidgetParameters();
+ result += (p.margin + p.widgetWidth)
+ * int(std::count_if(rightSideWidgetList().begin(), rightSideWidgetList().end(),
+ isSideWidgetVisible));
+ }
+ return result;
}
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 12a4299204..a14cd66398 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -71,6 +71,8 @@
QT_BEGIN_NAMESPACE
+class QLineEditPrivate;
+
// QLineEditIconButton: This is a simple helper class that represents clickable icons that fade in with text
class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton
@@ -78,8 +80,6 @@ class Q_AUTOTEST_EXPORT QLineEditIconButton : public QToolButton
Q_OBJECT
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
- enum { IconMargin = 4, IconButtonSize = 16 };
-
explicit QLineEditIconButton(QWidget *parent = 0);
qreal opacity() const { return m_opacity; }
@@ -99,6 +99,7 @@ private:
#ifndef QT_NO_ANIMATION
void startOpacityAnimation(qreal endValue);
#endif
+ QLineEditPrivate *lineEditPrivate() const;
qreal m_opacity;
};
@@ -122,6 +123,13 @@ public:
};
typedef std::vector<SideWidgetEntry> SideWidgetEntryList;
+ struct SideWidgetParameters {
+ int iconSize;
+ int widgetWidth;
+ int widgetHeight;
+ int margin;
+ };
+
QLineEditPrivate()
: control(0), frame(1), contextMenuEnabled(1), cursorVisible(0),
dragEnabled(0), clickCausedFocus(0), hscroll(0), vscroll(0),
@@ -212,7 +220,7 @@ public:
QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0);
void removeAction(QAction *action);
- QSize iconSize() const;
+ SideWidgetParameters sideWidgetParameters() const;
QIcon clearButtonIcon() const;
void setClearButtonEnabled(bool enabled);
void positionSideWidgets();
@@ -233,7 +241,6 @@ private:
SideWidgetEntryList leadingSideWidgets;
SideWidgetEntryList trailingSideWidgets;
int lastTextSize;
- mutable QSize m_iconSize;
};
Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE);
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 59cf9c9aee..3a90e14655 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -698,7 +698,6 @@ void QMenuBarPrivate::init()
if (platformMenuBar)
q->hide();
q->setBackgroundRole(QPalette::Button);
- oldWindow = oldParent = 0;
handleReparent();
q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
@@ -1320,30 +1319,41 @@ void QMenuBarPrivate::handleReparent()
{
Q_Q(QMenuBar);
QWidget *newParent = q->parentWidget();
- //Note: if parent is reparented, then window may change even if parent doesn't
- // we need to install an event filter on parent, and remove the old one
-
- if (oldParent != newParent) {
- if (oldParent)
- oldParent->removeEventFilter(q);
- if (newParent)
- newParent->installEventFilter(q);
+ //Note: if parent is reparented, then window may change even if parent doesn't.
+ // We need to install an avent filter on each parent up to the parent that is
+ // also a window (for shortcuts)
+ QWidget *newWindow = newParent ? newParent->window() : Q_NULLPTR;
+
+ QVector<QPointer<QWidget> > newParents;
+ // Remove event filters on ex-parents, keep them on still-parents
+ // The parents are always ordered in the vector
+ foreach (const QPointer<QWidget> &w, oldParents) {
+ if (w) {
+ if (newParent == w) {
+ newParents.append(w);
+ if (newParent != newWindow) //stop at the window
+ newParent = newParent->parentWidget();
+ } else {
+ w->removeEventFilter(q);
+ }
+ }
}
- //we also need event filter on top-level (for shortcuts)
- QWidget *newWindow = newParent ? newParent->window() : 0;
-
- if (oldWindow != newWindow) {
- if (oldParent && oldParent != oldWindow)
- oldWindow->removeEventFilter(q);
-
- if (newParent && newParent != newWindow)
- newWindow->installEventFilter(q);
+ // At this point, newParent is the next one to be added to newParents
+ while (newParent && newParent != newWindow) {
+ //install event filters all the way up to (excluding) the window
+ newParents.append(newParent);
+ newParent->installEventFilter(q);
+ newParent = newParent->parentWidget();
}
- oldParent = newParent;
- oldWindow = newWindow;
+ if (newParent && newWindow) {
+ // Install the event filter on the window
+ newParents.append(newParent);
+ newParent->installEventFilter(q);
+ }
+ oldParents = newParents;
if (platformMenuBar) {
if (newWindow) {
@@ -1450,10 +1460,9 @@ bool QMenuBar::event(QEvent *e)
bool QMenuBar::eventFilter(QObject *object, QEvent *event)
{
Q_D(QMenuBar);
- if (object == parent() && object) {
- if (event->type() == QEvent::ParentChange) //GrandparentChange
+ if (object && (event->type() == QEvent::ParentChange)) //GrandparentChange
d->handleReparent();
- }
+
if (object == d->leftWidget || object == d->rightWidget) {
switch (event->type()) {
case QEvent::ShowToParent:
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index 8a01cb3233..0db986bac5 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -124,8 +124,7 @@ public:
// reparenting
void handleReparent();
- QWidget *oldParent;
- QWidget *oldWindow;
+ QVector<QPointer<QWidget> > oldParents;
QList<QAction*> hiddenActions;
//default action
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index e2046b1106..1ac0a98cb1 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -298,7 +298,7 @@ private:
bool develMode = false;
bool debugWait = false;
- foreach (const char *arg, args) {
+ for (const char *arg : args) {
if (strcmp(arg, "-qdevel") == 0)
develMode = true;
if (strcmp(arg, "-qdebug") == 0)
diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index 828ef6cf5a..2bb7529456 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -8,7 +8,9 @@ DESTDIR = $$QT.core.libs
CONFIG += static
QT = core
-contains(QT_CONFIG, build_all):CONFIG += build_all
+DEFINES += QT_NO_FOREACH
+
+contains(QT_CONFIG, debug_and_release): CONFIG += build_all
win32-msvc*:QMAKE_CFLAGS_DEBUG -= -Zi
win32-msvc*:QMAKE_CXXFLAGS_DEBUG -= -Zi
diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf
index b31c2a18d2..a23915487f 100644
--- a/src/xml/doc/qtxml.qdocconf
+++ b/src/xml/doc/qtxml.qdocconf
@@ -4,7 +4,7 @@ project = QtXml
description = Qt XML Reference Documentation
version = $QT_VERSION
-examplesinstallpath = qtbase/xml
+examplesinstallpath = xml
qhp.projects = QtXml
diff --git a/src/xml/xml.pro b/src/xml/xml.pro
index f281e35444..cf9feda9bc 100644
--- a/src/xml/xml.pro
+++ b/src/xml/xml.pro
@@ -1,7 +1,8 @@
TARGET = QtXml
QT = core-private
-DEFINES += QT_NO_USING_NAMESPACE
+DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
+
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
QMAKE_DOCS = $$PWD/doc/qtxml.qdocconf