summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/atspi2/xml/Cache.xml4
-rw-r--r--src/3rdparty/freetype_dependency.pri3
-rw-r--r--src/3rdparty/sha3/KeccakF-1600-interface.h4
-rw-r--r--src/3rdparty/xkbcommon.pri2
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java12
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtService.java5
-rw-r--r--src/corelib/configure.json25
-rw-r--r--src/corelib/global/qcompilerdetection.h8
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h99
-rw-r--r--src/corelib/global/qglobal.cpp2
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/global/qnamespace.h2
-rw-r--r--src/corelib/global/qnamespace.qdoc13
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp10
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm103
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents_p.h19
-rw-r--r--src/corelib/io/qiodevice.cpp19
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qsettings.cpp6
-rw-r--r--src/corelib/io/qsettings.h9
-rw-r--r--src/corelib/io/qsettings_mac.cpp50
-rw-r--r--src/corelib/io/qsettings_win.cpp13
-rw-r--r--src/corelib/io/qsettings_winrt.cpp4
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm37
-rw-r--r--src/corelib/io/qtemporaryfile.cpp2
-rw-r--r--src/corelib/io/qtldurl.cpp6
-rw-r--r--src/corelib/io/qtldurl_p.h2
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/io/qurl.h2
-rw-r--r--src/corelib/kernel/qcore_foundation.mm6
-rw-r--r--src/corelib/kernel/qcore_mac.cpp24
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm11
-rw-r--r--src/corelib/kernel/qcore_mac_p.h6
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp28
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qcoreglobaldata.cpp4
-rw-r--r--src/corelib/kernel/qcoreglobaldata_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf.mm4
-rw-r--r--src/corelib/kernel/qfunctions_winrt.h8
-rw-r--r--src/corelib/kernel/qtimer.cpp2
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp5
-rw-r--r--src/corelib/statemachine/qabstractstate.h7
-rw-r--r--src/corelib/statemachine/qabstractstate_p.h8
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp5
-rw-r--r--src/corelib/statemachine/qabstracttransition.h7
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h2
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp5
-rw-r--r--src/corelib/statemachine/qeventtransition.h7
-rw-r--r--src/corelib/statemachine/qeventtransition_p.h2
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp4
-rw-r--r--src/corelib/statemachine/qfinalstate.h6
-rw-r--r--src/corelib/statemachine/qfinalstate_p.h4
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp5
-rw-r--r--src/corelib/statemachine/qhistorystate.h7
-rw-r--r--src/corelib/statemachine/qhistorystate_p.h7
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h2
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp5
-rw-r--r--src/corelib/statemachine/qsignaltransition.h7
-rw-r--r--src/corelib/statemachine/qsignaltransition_p.h2
-rw-r--r--src/corelib/statemachine/qstate.cpp5
-rw-r--r--src/corelib/statemachine/qstate.h7
-rw-r--r--src/corelib/statemachine/qstate_p.h4
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp5
-rw-r--r--src/corelib/statemachine/qstatemachine.h7
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h2
-rw-r--r--src/corelib/statemachine/statemachine.pri2
-rw-r--r--src/corelib/tools/qcommandlineoption.h2
-rw-r--r--src/corelib/tools/qcommandlineparser.h2
-rw-r--r--src/corelib/tools/qdatetime.cpp80
-rw-r--r--src/corelib/tools/qdatetime.h18
-rw-r--r--src/corelib/tools/qdatetime_p.h14
-rw-r--r--src/corelib/tools/qlist.cpp2
-rw-r--r--src/corelib/tools/qlocale_mac.mm40
-rw-r--r--src/corelib/tools/qsimd_p.h3
-rw-r--r--src/corelib/tools/qtimezone.h2
-rw-r--r--src/corelib/tools/qtimezoneprivate_mac.mm20
-rw-r--r--src/corelib/tools/qvector.cpp2
-rw-r--r--src/corelib/tools/tools.pri52
-rw-r--r--src/dbus/dbus.pro1
-rw-r--r--src/dbus/qdbusdemarshaller.cpp7
-rw-r--r--src/gui/configure.json41
-rw-r--r--src/gui/configure.pri19
-rw-r--r--src/gui/image/qimage_ssse3.cpp22
-rw-r--r--src/gui/image/qpixmap.cpp50
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp185
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h14
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h7
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/painting/qcolor.cpp1
-rw-r--r--src/gui/painting/qcolor.h2
-rw-r--r--src/gui/painting/qdrawhelper.cpp6
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp10
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp4
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp13
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp2
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h4
-rw-r--r--src/gui/text/qfontengine_ft.cpp6
-rw-r--r--src/gui/text/qstatictext.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp15
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h1
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp3
-rw-r--r--src/network/access/qnetworkcookiejar.cpp11
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp16
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp115
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h11
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/fontconfig.pri2
-rw-r--r--src/platformsupport/fontdatabases/fontdatabases.pri4
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm8
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm6
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp2
-rw-r--r--src/platformsupport/linuxaccessibility/dbusconnection.cpp2
-rw-r--r--src/platformsupport/platformsupport.pro7
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/dbusmenu.pri (renamed from src/platformsupport/dbusmenu/dbusmenu.pri)2
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp (renamed from src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor_p.h (renamed from src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp (renamed from src/platformsupport/dbusmenu/qdbusmenubar.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h (renamed from src/platformsupport/dbusmenu/qdbusmenubar_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp (renamed from src/platformsupport/dbusmenu/qdbusmenuconnection.cpp)8
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h (renamed from src/platformsupport/dbusmenu/qdbusmenuconnection_p.h)1
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuregistrarproxy.cpp (renamed from src/platformsupport/dbusmenu/qdbusmenuregistrarproxy.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuregistrarproxy_p.h (renamed from src/platformsupport/dbusmenu/qdbusmenuregistrarproxy_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp (renamed from src/platformsupport/dbusmenu/qdbusmenutypes.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes_p.h (renamed from src/platformsupport/dbusmenu/qdbusmenutypes_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp (renamed from src/platformsupport/dbusmenu/qdbusplatformmenu.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h (renamed from src/platformsupport/dbusmenu/qdbusplatformmenu_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/dbustray.pri (renamed from src/platformsupport/dbustray/dbustray.pri)2
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp (renamed from src/platformsupport/dbustray/qdbustrayicon.cpp)23
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h (renamed from src/platformsupport/dbustray/qdbustrayicon_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustraytypes.cpp (renamed from src/platformsupport/dbustray/qdbustraytypes.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustraytypes_p.h (renamed from src/platformsupport/dbustray/qdbustraytypes_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qstatusnotifieritemadaptor.cpp (renamed from src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qstatusnotifieritemadaptor_p.h (renamed from src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qxdgnotificationproxy.cpp (renamed from src/platformsupport/dbustray/qxdgnotificationproxy.cpp)0
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qxdgnotificationproxy_p.h (renamed from src/platformsupport/dbustray/qxdgnotificationproxy_p.h)0
-rw-r--r--src/platformsupport/themes/genericunix/genericunix.pri5
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp10
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm48
-rw-r--r--src/plugins/platforminputcontexts/compose/compose.pro6
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp2
-rw-r--r--src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h37
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp9
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm46
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm33
-rw-r--r--src/plugins/platforms/cocoa/qcocoainputcontext.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.mm24
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm8
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm14
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h3
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintdevice.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintersupport.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h50
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm219
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.mm16
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm37
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm7
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp4
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h1
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm1
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm11
-rw-r--r--src/plugins/platforms/platforms.pro2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.cpp11
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.h2
-rw-r--r--src/plugins/platforms/xcb/README10
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro1
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp21
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp24
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp48
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h4
-rw-r--r--src/plugins/platforms/xcb/xcb-static/xcb-static.pro3
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro3
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.cpp4
-rw-r--r--src/sql/configure.pri6
-rw-r--r--src/sql/kernel/qsqlrecord.cpp2
-rw-r--r--src/testlib/qtest.h28
-rw-r--r--src/testlib/qtest_network.h126
-rw-r--r--src/testlib/qtestcase.h54
-rw-r--r--src/testlib/testlib.pro1
-rw-r--r--src/tools/bootstrap/bootstrap.pro14
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp38
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp7
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h24
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc8
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp5
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp9
-rw-r--r--src/widgets/kernel/qapplication.cpp6
-rw-r--r--src/widgets/kernel/qformlayout.cpp15
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp14
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp4
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h8
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp5
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h8
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp5
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp5
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h7
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp5
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h7
-rw-r--r--src/widgets/statemachine/statemachine.pri7
-rw-r--r--src/widgets/styles/qdrawutil.cpp1
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp4
-rw-r--r--src/widgets/widgets/qdockwidget.cpp4
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm45
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp5
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h2
-rw-r--r--src/xml/sax/qxml.h7
227 files changed, 1671 insertions, 1228 deletions
diff --git a/src/3rdparty/atspi2/xml/Cache.xml b/src/3rdparty/atspi2/xml/Cache.xml
index 9d0c5801a9..01c52810ac 100644
--- a/src/3rdparty/atspi2/xml/Cache.xml
+++ b/src/3rdparty/atspi2/xml/Cache.xml
@@ -9,12 +9,12 @@
<signal name="AddAccessible">
<arg name="nodeAdded" type="((so)(so)a(so)assusau)"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiAccessibleCacheItem"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiAccessibleCacheItem"/>
</signal>
<signal name="RemoveAccessible">
<arg name="nodeRemoved" type="(so)"/>
- <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QSpiObjectReference"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QSpiObjectReference"/>
</signal>
</interface>
diff --git a/src/3rdparty/freetype_dependency.pri b/src/3rdparty/freetype_dependency.pri
index 012e4af6c3..cf86b66efd 100644
--- a/src/3rdparty/freetype_dependency.pri
+++ b/src/3rdparty/freetype_dependency.pri
@@ -1,6 +1,5 @@
qtConfig(system-freetype) {
- # pull in the proper freetype2 include directory
- include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
+ QMAKE_USE_PRIVATE += freetype/nolink
} else: qtConfig(freetype) {
INCLUDEPATH += $$PWD/freetype/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
diff --git a/src/3rdparty/sha3/KeccakF-1600-interface.h b/src/3rdparty/sha3/KeccakF-1600-interface.h
index ce2710eeb2..39caaaecbd 100644
--- a/src/3rdparty/sha3/KeccakF-1600-interface.h
+++ b/src/3rdparty/sha3/KeccakF-1600-interface.h
@@ -14,7 +14,11 @@ http://creativecommons.org/publicdomain/zero/1.0/
#ifndef _KeccakPermutationInterface_h_
#define _KeccakPermutationInterface_h_
+#include <private/qglobal_p.h>
+
+#if QT_CONFIG(sha3_fast)
#include "KeccakF-1600-int-set.h"
+#endif
static void KeccakInitialize( void );
static void KeccakInitializeState(unsigned char *state);
diff --git a/src/3rdparty/xkbcommon.pri b/src/3rdparty/xkbcommon.pri
index 12e7a4d8a3..af71b232d5 100644
--- a/src/3rdparty/xkbcommon.pri
+++ b/src/3rdparty/xkbcommon.pri
@@ -4,6 +4,8 @@ INCLUDEPATH += $$PWD/xkbcommon \
$$PWD/xkbcommon/src \
$$PWD/xkbcommon/src/xkbcomp
+include($$shadowed($$PWD/../gui/qtgui-config.pri))
+
DEFINES += DFLT_XKB_CONFIG_ROOT='\\"$$QMAKE_XKB_CONFIG_ROOT\\"'
### RMLVO names can be overwritten with environmental variables (see libxkbcommon documentation)
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
index 22ff1738c8..2728988362 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
@@ -258,16 +258,20 @@ public class QtActivity extends Activity
}
//---------------------------------------------------------------------------
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
+ protected void onCreateHook(Bundle savedInstanceState) {
m_loader.APPLICATION_PARAMETERS = APPLICATION_PARAMETERS;
m_loader.ENVIRONMENT_VARIABLES = ENVIRONMENT_VARIABLES;
m_loader.QT_ANDROID_THEMES = QT_ANDROID_THEMES;
m_loader.QT_ANDROID_DEFAULT_THEME = QT_ANDROID_DEFAULT_THEME;
m_loader.onCreate(savedInstanceState);
}
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ onCreateHook(savedInstanceState);
+ }
//---------------------------------------------------------------------------
@Override
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtService.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtService.java
index 71acf9683e..cdd6c1efea 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtService.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtService.java
@@ -50,11 +50,14 @@ public class QtService extends Service
/////////////////////////// Super class calls ////////////////////////////////////
/////////////// PLEASE DO NOT CHANGE THE FOLLOWING CODE //////////////////////////
//////////////////////////////////////////////////////////////////////////////////
+ protected void onCreateHook() {
+ m_loader.onCreate();
+ }
@Override
public void onCreate()
{
super.onCreate();
- m_loader.onCreate();
+ onCreateHook();
}
//---------------------------------------------------------------------------
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index b0c78f5122..c1bd37fd0c 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -353,6 +353,7 @@
},
"qeventtransition": {
"label": "QEventTransition class",
+ "condition": "features.statemachine",
"output": [ "publicFeature" ]
},
"sharedmemory": {
@@ -557,6 +558,30 @@
"purpose": "Provides a framework for gestures.",
"section": "Utilities",
"output": [ "publicFeature", "feature" ]
+ },
+ "sha3-fast": {
+ "label": "Speed optimized SHA3",
+ "purpose": "Optimizes SHA3 for speed instead of size.",
+ "section": "Utilities",
+ "output": [ "privateFeature" ]
+ },
+ "timezone": {
+ "label": "QTimeZone",
+ "purpose": "Provides support for timezone handling.",
+ "section": "Utilities",
+ "output": [ "publicFeature" ]
+ },
+ "commandlineparser": {
+ "label": "QCommandlineParser",
+ "purpose": "Provides support for command line parsing.",
+ "section": "Utilities",
+ "output": [ "publicFeature" ]
+ },
+ "topleveldomain": {
+ "label": "QUrl::topLevelDomain()",
+ "description": "Provides support for extracting the top level domain from URLs.",
+ "section": "Utilities",
+ "output": [ "publicFeature" ]
}
},
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index a3d816f0c3..dcdddeb04d 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1351,10 +1351,16 @@
/* Clang can not parse namespaced attributes in C mode, but defines __has_cpp_attribute */
# if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]]
+# elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
+# define Q_FALLTHROUGH() [[gnu::fallthrough]]
# endif
#endif
#ifndef Q_FALLTHROUGH
-# define Q_FALLTHROUGH() (void)0
+# if defined(Q_CC_GNU) && Q_CC_GNU >= 700
+# define Q_FALLTHROUGH() __attribute__((fallthrough))
+# else
+# define Q_FALLTHROUGH() (void)0
+#endif
#endif
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
new file mode 100644
index 0000000000..3b86e94cdd
--- /dev/null
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+// Despite its file name, this really is not a public header.
+// It is an implementation detail of the private bootstrap library.
+//
+
+#if 0
+// silence syncqt warnings
+#pragma qt_sync_skip_header_check
+#pragma qt_sync_stop_processing
+#endif
+
+#ifdef QT_BOOTSTRAPPED
+
+#ifndef QT_NO_EXCEPTIONS
+#define QT_NO_EXCEPTIONS
+#endif
+
+#define QT_NO_USING_NAMESPACE
+#define QT_NO_DEPRECATED
+
+#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
+#define QT_NO_DATASTREAM
+#define QT_NO_LIBRARY
+#define QT_FEATURE_library -1
+#define QT_NO_QOBJECT
+#define QT_NO_SYSTEMLOCALE
+#define QT_NO_THREAD
+#define QT_FEATURE_timezone -1
+#define QT_FEATURE_topleveldomain -1
+#define QT_NO_TRANSLATION
+#define QT_FEATURE_translation -1
+#define QT_NO_GEOM_VARIANT
+
+#if defined(QT_BUILD_QMAKE) || defined(QT_BUILD_CONFIGURE)
+#define QT_FEATURE_commandlineparser -1
+#define QT_NO_COMPRESS
+#define QT_JSON_READONLY
+#define QT_NO_TEXTCODEC
+#define QT_FEATURE_textcodec -1
+#else
+#define QT_NO_CODECS
+#define QT_FEATURE_codecs -1
+#define QT_FEATURE_commandlineparser 1
+#define QT_FEATURE_textcodec 1
+#endif
+
+#if defined(QT_BUILD_QMAKE)
+#define QT_NO_STANDARDPATHS
+#endif
+
+#endif // QT_BOOTSTRAPPED
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index c78e6f2482..1ed63aea9b 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -3381,7 +3381,7 @@ Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
pseudo random integers to be returned by qrand().
The sequence of random numbers generated is deterministic per thread. For example,
- if two threads call qsrand(1) and subsequently calls qrand(), the threads will get
+ if two threads call qsrand(1) and subsequently call qrand(), the threads will get
the same random number sequence.
\sa qrand()
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index dd8b6110b3..8b67f0d3ef 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -56,7 +56,9 @@
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-#ifndef QT_BOOTSTRAPPED
+#ifdef QT_BOOTSTRAPPED
+#include <QtCore/qconfig-bootstrapped.h>
+#else
#include <QtCore/qconfig.h>
#include <QtCore/qtcore-config.h>
#endif
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index edb568a2d6..5a66319164 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -558,7 +558,7 @@ public:
Key_Insert = 0x01000006,
Key_Delete = 0x01000007,
Key_Pause = 0x01000008,
- Key_Print = 0x01000009,
+ Key_Print = 0x01000009, // print screen
Key_SysReq = 0x0100000a,
Key_Clear = 0x0100000b,
Key_Home = 0x01000010, // cursor movement
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index d8df25dcc6..7768070e4f 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1761,17 +1761,6 @@
\value Key_Zoom
\value Key_Exit
\value Key_Cancel
- \value Key_MicVolumeUp
- \value Key_Find
- \value Key_Open
- \value Key_MicVolumeDown
- \value Key_New
- \value Key_Settings
- \value Key_Redo
- \value Key_Exit
- \value Key_Info
- \value Key_Undo
- \value Key_Guide
\sa QKeyEvent::key()
*/
@@ -2300,7 +2289,7 @@
\enum Qt::ItemSelectionMode
This enum is used in QGraphicsItem, QGraphicsScene and QGraphicsView to
- specify how items are selected, or how to determine if a shapes and items
+ specify how items are selected, or how to determine if shapes and items
collide.
\value ContainsItemShape The output list contains only items whose
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 6aaaa4c05a..c9f7672ac3 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -101,13 +101,13 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
if (suffix.length() > 0) {
// First step: is the extension known ?
- QCFType<CFStringRef> extensionRef = QCFString::toCFStringRef(suffix);
+ QCFType<CFStringRef> extensionRef = suffix.toCFString();
QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
return true;
// Second step: check if an application knows the package type
- QCFType<CFStringRef> path = QCFString::toCFStringRef(entry.filePath());
+ QCFType<CFStringRef> path = entry.filePath().toCFString();
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
UInt32 type, creator;
@@ -126,7 +126,7 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
if (application) {
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application);
CFStringRef identifier = CFBundleGetIdentifier(bundle);
- QString applicationId = QCFString::toQString(identifier);
+ QString applicationId = QString::fromCFString(identifier);
if (applicationId != QLatin1String("com.apple.finder"))
return true;
}
@@ -222,7 +222,7 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
if (!cfstr)
return QFileSystemEntry();
- return QFileSystemEntry(QCFString::toQString(cfstr));
+ return QFileSystemEntry(QString::fromCFString(cfstr));
}
#endif
return QFileSystemEntry();
@@ -412,7 +412,7 @@ QString QFileSystemEngine::bundleName(const QFileSystemEntry &entry)
if (QCFType<CFDictionaryRef> dict = CFBundleCopyInfoDictionaryForURL(url)) {
if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) {
if (CFGetTypeID(name) == CFStringGetTypeID())
- return QCFString::toQString((CFStringRef)name);
+ return QString::fromCFString((CFStringRef)name);
}
}
return QString();
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index beb8acb05f..a5558b62e7 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -87,7 +87,7 @@ bool QFseventsFileSystemWatcherEngine::checkDir(DirsByName::iterator &it)
if (res == -1) {
needsRestart |= derefPath(info.watchedPath);
emit emitDirectoryChanged(info.origPath, true);
- it = watchedDirectories.erase(it);
+ it = watchingState.watchedDirectories.erase(it);
} else if (st.st_ctimespec != info.ctime || st.st_mode != info.mode) {
info.ctime = st.st_ctimespec;
info.mode = st.st_mode;
@@ -138,7 +138,8 @@ bool QFseventsFileSystemWatcherEngine::rescanDirs(const QString &path)
{
bool needsRestart = false;
- for (DirsByName::iterator it = watchedDirectories.begin(); it != watchedDirectories.end(); ) {
+ for (DirsByName::iterator it = watchingState.watchedDirectories.begin();
+ it != watchingState.watchedDirectories.end(); ) {
if (it.key().startsWith(path))
needsRestart |= checkDir(it);
else
@@ -177,11 +178,12 @@ bool QFseventsFileSystemWatcherEngine::rescanFiles(const QString &path)
{
bool needsRestart = false;
- for (FilesByPath::iterator i = watchedFiles.begin(); i != watchedFiles.end(); ) {
+ for (FilesByPath::iterator i = watchingState.watchedFiles.begin();
+ i != watchingState.watchedFiles.end(); ) {
if (i.key().startsWith(path)) {
needsRestart |= rescanFiles(i.value());
if (i.value().isEmpty()) {
- i = watchedFiles.erase(i);
+ i = watchingState.watchedFiles.erase(i);
continue;
}
}
@@ -232,8 +234,8 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
if (eFlags & kFSEventStreamEventFlagRootChanged) {
// re-check everything:
- DirsByName::iterator dirIt = watchedDirectories.find(path);
- if (dirIt != watchedDirectories.end())
+ DirsByName::iterator dirIt = watchingState.watchedDirectories.find(path);
+ if (dirIt != watchingState.watchedDirectories.end())
needsRestart |= checkDir(dirIt);
needsRestart |= rescanFiles(path);
continue;
@@ -243,13 +245,13 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
needsRestart |= rescanDirs(path);
// check watched directories:
- DirsByName::iterator dirIt = watchedDirectories.find(path);
- if (dirIt != watchedDirectories.end())
+ DirsByName::iterator dirIt = watchingState.watchedDirectories.find(path);
+ if (dirIt != watchingState.watchedDirectories.end())
needsRestart |= checkDir(dirIt);
// check watched files:
- FilesByPath::iterator pIt = watchedFiles.find(path);
- if (pIt != watchedFiles.end())
+ FilesByPath::iterator pIt = watchingState.watchedFiles.find(path);
+ if (pIt != watchingState.watchedFiles.end())
needsRestart |= rescanFiles(pIt.value());
}
@@ -276,12 +278,11 @@ void QFseventsFileSystemWatcherEngine::doEmitDirectoryChanged(const QString &pat
emit directoryChanged(path, removed);
}
-void QFseventsFileSystemWatcherEngine::restartStream()
+bool QFseventsFileSystemWatcherEngine::restartStream()
{
- QMacAutoReleasePool pool;
QMutexLocker locker(&lock);
stopStream();
- startStream();
+ return startStream();
}
QFseventsFileSystemWatcherEngine *QFseventsFileSystemWatcherEngine::create(QObject *parent)
@@ -311,6 +312,7 @@ QFseventsFileSystemWatcherEngine::~QFseventsFileSystemWatcherEngine()
{
QMacAutoReleasePool pool;
+ // Stop the stream in case we have to wait for the lock below to be acquired.
if (stream)
FSEventStreamStop(stream);
@@ -334,8 +336,10 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QMutexLocker locker(&lock);
+ bool wasRunning = stream != Q_NULLPTR;
bool needsRestart = false;
+ WatchingState oldState = watchingState;
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
@@ -356,7 +360,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
const bool isDir = S_ISDIR(st.st_mode);
if (isDir) {
- if (watchedDirectories.contains(realPath))
+ if (watchingState.watchedDirectories.contains(realPath))
continue;
directories->append(origPath);
watchedPath = realPath;
@@ -371,17 +375,18 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
parentPath = watchedPath;
}
- for (PathRefCounts::const_iterator i = watchedPaths.begin(), ei = watchedPaths.end(); i != ei; ++i) {
+ for (PathRefCounts::const_iterator i = watchingState.watchedPaths.begin(),
+ ei = watchingState.watchedPaths.end(); i != ei; ++i) {
if (watchedPath.startsWith(i.key())) {
watchedPath = i.key();
break;
}
}
- PathRefCounts::iterator it = watchedPaths.find(watchedPath);
- if (it == watchedPaths.end()) {
+ PathRefCounts::iterator it = watchingState.watchedPaths.find(watchedPath);
+ if (it == watchingState.watchedPaths.end()) {
needsRestart = true;
- watchedPaths.insert(watchedPath, 1);
+ watchingState.watchedPaths.insert(watchedPath, 1);
DEBUG("Adding '%s' to watchedPaths", qPrintable(watchedPath));
} else {
++it.value();
@@ -392,18 +397,25 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
DirInfo dirInfo;
dirInfo.dirInfo = info;
dirInfo.entries = scanForDirEntries(realPath);
- watchedDirectories.insert(realPath, dirInfo);
+ watchingState.watchedDirectories.insert(realPath, dirInfo);
DEBUG("-- Also adding '%s' to watchedDirectories", qPrintable(realPath));
} else {
- watchedFiles[parentPath].insert(realPath, info);
+ watchingState.watchedFiles[parentPath].insert(realPath, info);
DEBUG("-- Also adding '%s' to watchedFiles", qPrintable(realPath));
}
}
if (needsRestart) {
stopStream();
- if (!startStream())
+ if (!startStream()) {
+ // ok, something went wrong, let's try to restore the previous state
+ watchingState = qMove(oldState);
+ // and because we don't know which path caused the issue (if any), fail on all of them
p = paths;
+
+ if (wasRunning)
+ startStream();
+ }
}
return p;
@@ -419,6 +431,7 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
bool needsRestart = false;
+ WatchingState oldState = watchingState;
QStringList p = paths;
QMutableListIterator<QString> it(p);
while (it.hasNext()) {
@@ -431,10 +444,10 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
realPath = fi.canonicalFilePath();
if (fi.isDir()) {
- DirsByName::iterator dirIt = watchedDirectories.find(realPath);
- if (dirIt != watchedDirectories.end()) {
+ DirsByName::iterator dirIt = watchingState.watchedDirectories.find(realPath);
+ if (dirIt != watchingState.watchedDirectories.end()) {
needsRestart |= derefPath(dirIt->dirInfo.watchedPath);
- watchedDirectories.erase(dirIt);
+ watchingState.watchedDirectories.erase(dirIt);
directories->removeAll(origPath);
it.remove();
DEBUG("Removed directory '%s'", qPrintable(realPath));
@@ -442,15 +455,15 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
} else {
QFileInfo fi(realPath);
QString parentPath = fi.path();
- FilesByPath::iterator pIt = watchedFiles.find(parentPath);
- if (pIt != watchedFiles.end()) {
+ FilesByPath::iterator pIt = watchingState.watchedFiles.find(parentPath);
+ if (pIt != watchingState.watchedFiles.end()) {
InfoByName &filesInDir = pIt.value();
InfoByName::iterator fIt = filesInDir.find(realPath);
if (fIt != filesInDir.end()) {
needsRestart |= derefPath(fIt->watchedPath);
filesInDir.erase(fIt);
if (filesInDir.isEmpty())
- watchedFiles.erase(pIt);
+ watchingState.watchedFiles.erase(pIt);
files->removeAll(origPath);
it.remove();
DEBUG("Removed file '%s'", qPrintable(realPath));
@@ -461,26 +474,33 @@ QStringList QFseventsFileSystemWatcherEngine::removePaths(const QStringList &pat
locker.unlock();
- if (needsRestart)
- restartStream();
+ if (needsRestart) {
+ if (!restartStream()) {
+ watchingState = qMove(oldState);
+ startStream();
+ }
+ }
return p;
}
+// Returns false if FSEventStream* calls failed for some mysterious reason, true if things got a
+// thumbs-up.
bool QFseventsFileSystemWatcherEngine::startStream()
{
Q_ASSERT(stream == 0);
- QMacAutoReleasePool pool;
- if (stream) // This shouldn't happen, but let's be nice and handle it.
+ if (stream) // Ok, this really shouldn't happen, esp. not after the assert. But let's be nice in release mode and still handle it.
stopStream();
- if (watchedPaths.isEmpty())
- return false;
+ QMacAutoReleasePool pool;
- DEBUG() << "Starting stream with paths" << watchedPaths.keys();
+ if (watchingState.watchedPaths.isEmpty())
+ return true; // we succeeded in doing nothing
- NSMutableArray *pathsToWatch = [NSMutableArray arrayWithCapacity:watchedPaths.size()];
- for (PathRefCounts::const_iterator i = watchedPaths.begin(), ei = watchedPaths.end(); i != ei; ++i)
+ DEBUG() << "Starting stream with paths" << watchingState.watchedPaths.keys();
+
+ NSMutableArray *pathsToWatch = [NSMutableArray arrayWithCapacity:watchingState.watchedPaths.size()];
+ for (PathRefCounts::const_iterator i = watchingState.watchedPaths.begin(), ei = watchingState.watchedPaths.end(); i != ei; ++i)
[pathsToWatch addObject:i.key().toNSString()];
struct FSEventStreamContext callBackInfo = {
@@ -504,7 +524,7 @@ bool QFseventsFileSystemWatcherEngine::startStream()
latency,
FSEventStreamCreateFlags(0));
- if (!stream) {
+ if (!stream) { // nope, no way to know what went wrong, so just fail
DEBUG() << "Failed to create stream!";
return false;
}
@@ -514,7 +534,7 @@ bool QFseventsFileSystemWatcherEngine::startStream()
if (FSEventStreamStart(stream)) {
DEBUG() << "Stream started successfully with sinceWhen =" << lastReceivedEvent;
return true;
- } else {
+ } else { // again, no way to know what went wrong, so just clean up and fail
DEBUG() << "Stream failed to start!";
FSEventStreamInvalidate(stream);
FSEventStreamRelease(stream);
@@ -525,6 +545,7 @@ bool QFseventsFileSystemWatcherEngine::startStream()
void QFseventsFileSystemWatcherEngine::stopStream(bool isStopped)
{
+ QMacAutoReleasePool pool;
if (stream) {
if (!isStopped)
FSEventStreamStop(stream);
@@ -554,9 +575,9 @@ QFseventsFileSystemWatcherEngine::InfoByName QFseventsFileSystemWatcherEngine::s
bool QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath)
{
- PathRefCounts::iterator it = watchedPaths.find(watchedPath);
- if (it != watchedPaths.end() && --it.value() < 1) {
- watchedPaths.erase(it);
+ PathRefCounts::iterator it = watchingState.watchedPaths.find(watchedPath);
+ if (it != watchingState.watchedPaths.end() && --it.value() < 1) {
+ watchingState.watchedPaths.erase(it);
DEBUG("Removing '%s' from watchedPaths.", qPrintable(watchedPath));
return true;
}
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
index dc4e5bf38b..1b0b8ae15c 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h
+++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h
@@ -87,7 +87,7 @@ Q_SIGNALS:
private slots:
void doEmitFileChanged(const QString &path, bool removed);
void doEmitDirectoryChanged(const QString &path, bool removed);
- void restartStream();
+ bool restartStream();
private:
struct Info {
@@ -118,6 +118,19 @@ private:
typedef QHash<QString, DirInfo> DirsByName;
typedef QHash<QString, qint64> PathRefCounts;
+ struct WatchingState {
+ // These fields go hand-in-hand. FSEvents watches paths, and there is no use in watching
+ // the same path multiple times. So, the "refcount" on a path is the number of watched
+ // files that have the same path, plus the number of directories that have the same path.
+ //
+ // If the stream fails to start after adding files/directories, the watcher will try to
+ // keep watching files/directories that it was already watching. It does that by restoring
+ // the previous WatchingState and restarting the stream.
+ FilesByPath watchedFiles;
+ DirsByName watchedDirectories;
+ PathRefCounts watchedPaths;
+ };
+
QFseventsFileSystemWatcherEngine(QObject *parent);
bool startStream();
void stopStream(bool isStopped = false);
@@ -131,10 +144,8 @@ private:
QMutex lock;
dispatch_queue_t queue;
FSEventStreamRef stream;
- FilesByPath watchedFiles;
- DirsByName watchedDirectories;
- PathRefCounts watchedPaths;
FSEventStreamEventId lastReceivedEvent;
+ WatchingState watchingState;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index c560bc7a03..52a78ad1c4 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -120,6 +120,14 @@ static void checkWarnMessage(const QIODevice *device, const char *function, cons
} \
} while (0)
+#define CHECK_MAXBYTEARRAYSIZE(function) \
+ do { \
+ if (maxSize >= MaxByteArraySize) { \
+ checkWarnMessage(this, #function, "maxSize argument exceeds QByteArray size limit"); \
+ maxSize = MaxByteArraySize - 1; \
+ } \
+ } while (0)
+
#define CHECK_WRITABLE(function, returnType) \
do { \
if ((d->openMode & WriteOnly) == 0) { \
@@ -1178,10 +1186,7 @@ QByteArray QIODevice::read(qint64 maxSize)
}
CHECK_MAXLEN(read, result);
- if (maxSize >= MaxByteArraySize) {
- checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit");
- maxSize = MaxByteArraySize - 1;
- }
+ CHECK_MAXBYTEARRAYSIZE(read);
result.resize(int(maxSize));
qint64 readBytes = read(result.data(), result.size());
@@ -1402,17 +1407,13 @@ QByteArray QIODevice::readLine(qint64 maxSize)
QByteArray result;
CHECK_MAXLEN(readLine, result);
+ CHECK_MAXBYTEARRAYSIZE(readLine);
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::readLine(%lld), d->pos = %lld, d->buffer.size() = %lld\n",
this, maxSize, d->pos, d->buffer.size());
#endif
- if (maxSize >= MaxByteArraySize) {
- qWarning("QIODevice::read: maxSize argument exceeds QByteArray size limit");
- maxSize = MaxByteArraySize - 1;
- }
-
result.resize(int(maxSize));
qint64 readBytes = 0;
if (!result.size()) {
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 1d425653a3..b39816dd7d 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -418,7 +418,7 @@ void QProcessPrivate::startProcess()
}
if (url) {
const QCFString str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
- encodedProgramName += (QDir::separator() + QDir(program).relativeFilePath(QCFString::toQString(str))).toUtf8();
+ encodedProgramName += (QDir::separator() + QDir(program).relativeFilePath(QString::fromCFString(str))).toUtf8();
}
}
#endif
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index b67afe0e0f..675b375b22 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -427,7 +427,9 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
case QVariant::Double:
case QVariant::KeySequence: {
result = v.toString();
- if (result.startsWith(QLatin1Char('@')))
+ if (result.contains(QChar::Null))
+ result = QLatin1String("@String(") + result + QLatin1Char(')');
+ else if (result.startsWith(QLatin1Char('@')))
result.prepend(QLatin1Char('@'));
break;
}
@@ -487,6 +489,8 @@ QVariant QSettingsPrivate::stringToVariant(const QString &s)
if (s.endsWith(QLatin1Char(')'))) {
if (s.startsWith(QLatin1String("@ByteArray("))) {
return QVariant(s.midRef(11, s.size() - 12).toLatin1());
+ } else if (s.startsWith(QLatin1String("@String("))) {
+ return QVariant(s.midRef(8, s.size() - 9).toString());
} else if (s.startsWith(QLatin1String("@Variant("))
|| s.startsWith(QLatin1String("@DateTime("))) {
#ifndef QT_NO_DATASTREAM
diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h
index 21fb9519de..edd59026ed 100644
--- a/src/corelib/io/qsettings.h
+++ b/src/corelib/io/qsettings.h
@@ -80,6 +80,9 @@ public:
AccessError,
FormatError
};
+#ifndef QT_NO_QOBJECT
+ Q_ENUM(Status)
+#endif
enum Format {
NativeFormat,
@@ -108,11 +111,17 @@ public:
CustomFormat15,
CustomFormat16
};
+#ifndef QT_NO_QOBJECT
+ Q_ENUM(Format)
+#endif
enum Scope {
UserScope,
SystemScope
};
+#ifndef QT_NO_QOBJECT
+ Q_ENUM(Scope)
+#endif
#ifndef QT_NO_QOBJECT
explicit QSettings(const QString &organization,
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 4ad5a7b398..a31dfc5366 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -83,12 +83,12 @@ static QString rotateSlashesDotsAndMiddots(const QString &key, int shift)
static QCFType<CFStringRef> macKey(const QString &key)
{
- return QCFString::toCFStringRef(rotateSlashesDotsAndMiddots(key, Macify));
+ return rotateSlashesDotsAndMiddots(key, Macify).toCFString();
}
static QString qtKey(CFStringRef cfkey)
{
- return rotateSlashesDotsAndMiddots(QCFString::toQString(cfkey), Qtify);
+ return rotateSlashesDotsAndMiddots(QString::fromCFString(cfkey), Qtify);
}
static QCFType<CFPropertyListRef> macValue(const QVariant &value);
@@ -160,7 +160,7 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
}
}
- cfkeys[numUniqueKeys] = QCFString::toCFStringRef(key);
+ cfkeys[numUniqueKeys] = key.toCFString();
cfvalues[numUniqueKeys] = singleton ? macValue(values.constFirst()) : macList(values);
++numUniqueKeys;
}
@@ -175,17 +175,12 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
break;
case QVariant::DateTime:
{
- /*
- CFDate, unlike QDateTime, doesn't store timezone information.
- */
- QDateTime dt = value.toDateTime();
- if (dt.timeSpec() == Qt::LocalTime) {
- QDateTime reference;
- reference.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970));
- result = CFDateCreate(kCFAllocatorDefault, CFAbsoluteTime(reference.secsTo(dt)));
- } else {
+ QDateTime dateTime = value.toDateTime();
+ // CFDate, unlike QDateTime, doesn't store timezone information
+ if (dateTime.timeSpec() == Qt::LocalTime)
+ result = dateTime.toCFDate();
+ else
goto string_case;
- }
}
break;
case QVariant::Bool:
@@ -214,7 +209,11 @@ static QCFType<CFPropertyListRef> macValue(const QVariant &value)
case QVariant::String:
string_case:
default:
- result = QCFString::toCFStringRef(QSettingsPrivate::variantToString(value));
+ QString string = QSettingsPrivate::variantToString(value);
+ if (string.contains(QChar::Null))
+ result = string.toUtf8().toCFData();
+ else
+ result = string.toCFString();
}
return result;
}
@@ -230,7 +229,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
Sorted grossly from most to least frequent type.
*/
if (typeId == CFStringGetTypeID()) {
- return QSettingsPrivate::stringToVariant(QCFString::toQString(static_cast<CFStringRef>(cfvalue)));
+ return QSettingsPrivate::stringToVariant(QString::fromCFString(static_cast<CFStringRef>(cfvalue)));
} else if (typeId == CFNumberGetTypeID()) {
CFNumberRef cfnumber = static_cast<CFNumberRef>(cfvalue);
if (CFNumberIsFloatType(cfnumber)) {
@@ -266,9 +265,16 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
} else if (typeId == CFBooleanGetTypeID()) {
return (bool)CFBooleanGetValue(static_cast<CFBooleanRef>(cfvalue));
} else if (typeId == CFDataGetTypeID()) {
- CFDataRef cfdata = static_cast<CFDataRef>(cfvalue);
- return QByteArray(reinterpret_cast<const char *>(CFDataGetBytePtr(cfdata)),
- CFDataGetLength(cfdata));
+ QByteArray byteArray = QByteArray::fromRawCFData(static_cast<CFDataRef>(cfvalue));
+
+ // Fast-path for QByteArray, so that we don't have to go
+ // though the expensive and lossy conversion via UTF-8.
+ if (!byteArray.startsWith('@'))
+ return byteArray;
+
+ const QString str = QString::fromUtf8(byteArray.constData(), byteArray.size());
+ return QSettingsPrivate::stringToVariant(str);
+
} else if (typeId == CFDictionaryGetTypeID()) {
CFDictionaryRef cfdict = static_cast<CFDictionaryRef>(cfvalue);
CFTypeID arrayTypeId = CFArrayGetTypeID();
@@ -279,7 +285,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
QMultiMap<QString, QVariant> map;
for (int i = 0; i < size; ++i) {
- QString key = QCFString::toQString(static_cast<CFStringRef>(keys[i]));
+ QString key = QString::fromCFString(static_cast<CFStringRef>(keys[i]));
if (CFGetTypeID(values[i]) == arrayTypeId) {
CFArrayRef cfarray = static_cast<CFArrayRef>(values[i]);
@@ -292,9 +298,7 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
}
return map;
} else if (typeId == CFDateGetTypeID()) {
- QDateTime dt;
- dt.setSecsSinceEpoch(qint64(kCFAbsoluteTimeIntervalSince1970));
- return dt.addSecs((int)CFDateGetAbsoluteTime(static_cast<CFDateRef>(cfvalue)));
+ return QDateTime::fromCFDate(static_cast<CFDateRef>(cfvalue));
}
return QVariant();
}
@@ -571,7 +575,7 @@ QString QMacSettingsPrivate::fileName() const
if (scope == QSettings::UserScope)
result = QDir::homePath();
result += QLatin1String("/Library/Preferences/");
- result += QCFString::toQString(domains[0].applicationOrSuiteId);
+ result += QString::fromCFString(domains[0].applicationOrSuiteId);
result += QLatin1String(".plist");
return result;
}
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 3f06ab7043..1c10548cbc 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -667,15 +667,6 @@ void QWinSettingsPrivate::remove(const QString &uKey)
}
}
-static bool stringContainsNullChar(const QString &s)
-{
- for (int i = 0; i < s.length(); ++i) {
- if (s.at(i).unicode() == 0)
- return true;
- }
- return false;
-}
-
void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
{
if (writeHandle() == 0) {
@@ -704,7 +695,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
QStringList l = variantListToStringList(value.toList());
QStringList::const_iterator it = l.constBegin();
for (; it != l.constEnd(); ++it) {
- if ((*it).length() == 0 || stringContainsNullChar(*it)) {
+ if ((*it).length() == 0 || it->contains(QChar::Null)) {
type = REG_BINARY;
break;
}
@@ -748,7 +739,7 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
// If the string does not contain '\0', we can use REG_SZ, the native registry
// string type. Otherwise we use REG_BINARY.
QString s = variantToString(value);
- type = stringContainsNullChar(s) ? REG_BINARY : REG_SZ;
+ type = s.contains(QChar::Null) ? REG_BINARY : REG_SZ;
if (type == REG_BINARY) {
regValueBuff = QByteArray((const char*)s.utf16(), s.length() * 2);
} else {
diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp
index 708287ce5e..209b56d920 100644
--- a/src/corelib/io/qsettings_winrt.cpp
+++ b/src/corelib/io/qsettings_winrt.cpp
@@ -402,7 +402,7 @@ void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value)
QStringList::const_iterator it = l.constBegin();
bool containsNull = false;
for (; it != l.constEnd(); ++it) {
- if ((*it).length() == 0 || it->indexOf(QChar::Null) != -1) {
+ if ((*it).length() == 0 || it->contains(QChar::Null)) {
// We can only store as binary
containsNull = true;
break;
@@ -445,7 +445,7 @@ void QWinRTSettingsPrivate::set(const QString &uKey, const QVariant &value)
break;
default: {
const QString s = variantToString(value);
- if (s.indexOf(QChar::Null) != -1) {
+ if (s.contains(QChar::Null)) {
hr = valueStatics->CreateUInt8Array(s.length() * 2, (BYTE*) s.utf16(), &val);
} else {
HStringReference ref((const wchar_t*)s.utf16(), s.size());
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index dc3d7737b6..a293d4862f 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -168,36 +168,11 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type,
QString QStandardPaths::writableLocation(StandardLocation type)
{
- if (isTestModeEnabled()) {
- const QString qttestDir = QDir::homePath() + QLatin1String("/.qttest");
- QString path;
- switch (type) {
- case GenericDataLocation:
- case AppDataLocation:
- case AppLocalDataLocation:
- path = qttestDir + QLatin1String("/Application Support");
- if (type != GenericDataLocation)
- appendOrganizationAndApp(path);
- return path;
- case GenericCacheLocation:
- case CacheLocation:
- path = qttestDir + QLatin1String("/Cache");
- if (type == CacheLocation)
- appendOrganizationAndApp(path);
- return path;
- case GenericConfigLocation:
- case ConfigLocation:
- case AppConfigLocation:
- path = qttestDir + QLatin1String("/Preferences");
- if (type == AppConfigLocation)
- appendOrganizationAndApp(path);
- return path;
- default:
- break;
- }
- }
+ QString location = baseWritableLocation(type, NSUserDomainMask, true);
+ if (isTestModeEnabled())
+ location = location.replace(QDir::homePath(), QDir::homePath() + QLatin1String("/.qttest"));
- return baseWritableLocation(type, NSUserDomainMask, true);
+ return location;
}
QStringList QStandardPaths::standardLocations(StandardLocation type)
@@ -230,13 +205,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (mainBundle) {
CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle);
CFStringRef cfBundlePath = CFURLCopyPath(bundleUrl);
- QString bundlePath = QCFString::toQString(cfBundlePath);
+ QString bundlePath = QString::fromCFString(cfBundlePath);
CFRelease(cfBundlePath);
CFRelease(bundleUrl);
CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl);
- QString resourcesPath = QCFString::toQString(cfResourcesPath);
+ QString resourcesPath = QString::fromCFString(cfResourcesPath);
CFRelease(cfResourcesPath);
CFRelease(resourcesUrl);
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index c430c7714a..7aae128796 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -665,7 +665,7 @@ QString QTemporaryFile::fileTemplate() const
/*!
Sets the static portion of the file name to \a name. If the file
- template ends in XXXXXX that will automatically be replaced with
+ template contains XXXXXX that will automatically be replaced with
the unique part of the filename, otherwise a filename will be
determined automatically based on the static portion specified.
diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp
index dd0ee6068d..96543bbbfd 100644
--- a/src/corelib/io/qtldurl.cpp
+++ b/src/corelib/io/qtldurl.cpp
@@ -37,6 +37,10 @@
**
****************************************************************************/
+#include <qglobal.h>
+
+#if QT_CONFIG(topleveldomain)
+
#include "qplatformdefs.h"
#include "qurl.h"
#include "private/qurltlds_p.h"
@@ -125,3 +129,5 @@ Q_CORE_EXPORT bool qIsEffectiveTLD(const QStringRef &domain)
}
QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/io/qtldurl_p.h b/src/corelib/io/qtldurl_p.h
index b9fbdebbc5..4636f18874 100644
--- a/src/corelib/io/qtldurl_p.h
+++ b/src/corelib/io/qtldurl_p.h
@@ -55,6 +55,8 @@
#include "QtCore/qurl.h"
#include "QtCore/qstring.h"
+QT_REQUIRE_CONFIG(topleveldomain);
+
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT QString qTopLevelDomain(const QString &domain);
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 42a742213b..c165aef5a2 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3117,6 +3117,7 @@ bool QUrl::hasFragment() const
return d->hasFragment();
}
+#if QT_CONFIG(topleveldomain)
/*!
\since 4.8
@@ -3151,6 +3152,7 @@ QString QUrl::topLevelDomain(ComponentFormattingOptions options) const
}
return tld;
}
+#endif
/*!
Returns the result of the merge of this URL with \a relative. This
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index bce271fcb1..a554a3b07e 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -235,7 +235,9 @@ public:
void setHost(const QString &host, ParsingMode mode = DecodedMode);
QString host(ComponentFormattingOptions = FullyDecoded) const;
+#if QT_CONFIG(topleveldomain)
QString topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const;
+#endif
void setPort(int port);
int port(int defaultPort = -1) const;
diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm
index 2291017a5d..f5ccd1c1f2 100644
--- a/src/corelib/kernel/qcore_foundation.mm
+++ b/src/corelib/kernel/qcore_foundation.mm
@@ -375,8 +375,8 @@ QDateTime QDateTime::fromCFDate(CFDateRef date)
{
if (!date)
return QDateTime();
- return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>((CFDateGetAbsoluteTime(date)
- + kCFAbsoluteTimeIntervalSince1970) * 1000));
+ CFAbsoluteTime sSinceEpoch = kCFAbsoluteTimeIntervalSince1970 + CFDateGetAbsoluteTime(date);
+ return QDateTime::fromMSecsSinceEpoch(qRound64(sSinceEpoch * 1000));
}
/*!
@@ -404,7 +404,7 @@ QDateTime QDateTime::fromNSDate(const NSDate *date)
{
if (!date)
return QDateTime();
- return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>([date timeIntervalSince1970] * 1000));
+ return QDateTime::fromMSecsSinceEpoch(qRound64([date timeIntervalSince1970] * 1000));
}
/*!
diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp
index 10b8d03d1c..c689f47d8f 100644
--- a/src/corelib/kernel/qcore_mac.cpp
+++ b/src/corelib/kernel/qcore_mac.cpp
@@ -43,37 +43,17 @@
QT_BEGIN_NAMESPACE
-QString QCFString::toQString(CFStringRef str)
-{
- if(!str)
- return QString();
- CFIndex length = CFStringGetLength(str);
- const UniChar *chars = CFStringGetCharactersPtr(str);
- if (chars)
- return QString(reinterpret_cast<const QChar *>(chars), length);
-
- QVarLengthArray<UniChar> buffer(length);
- CFStringGetCharacters(str, CFRangeMake(0, length), buffer.data());
- return QString(reinterpret_cast<const QChar *>(buffer.constData()), length);
-}
-
QCFString::operator QString() const
{
if (string.isEmpty() && type)
- const_cast<QCFString*>(this)->string = toQString(type);
+ const_cast<QCFString*>(this)->string = QString::fromCFString(type);
return string;
}
-CFStringRef QCFString::toCFStringRef(const QString &string)
-{
- return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(string.unicode()),
- string.length());
-}
-
QCFString::operator CFStringRef() const
{
if (!type)
- const_cast<QCFString*>(this)->type = toCFStringRef(string);
+ const_cast<QCFString*>(this)->type = string.toCFString();
return type;
}
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index 42f5699928..231afb991c 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -49,17 +49,6 @@
QT_BEGIN_NAMESPACE
-NSString *QCFString::toNSString(const QString &string)
-{
- // The const cast below is safe: CfStringRef is immutable and so is NSString.
- return [const_cast<NSString *>(reinterpret_cast<const NSString *>(toCFStringRef(string))) autorelease];
-}
-
-QString QCFString::toQString(const NSString *nsstr)
-{
- return toQString(reinterpret_cast<CFStringRef>(nsstr));
-}
-
// -------------------------------------------------------------------------
QDebug operator<<(QDebug dbg, const NSObject *nsObject)
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 8a710a8a1f..d0edef33a2 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -126,12 +126,6 @@ public:
inline QCFString(const QCFType<CFStringRef> &other) : QCFType<CFStringRef>(other) {}
operator QString() const;
operator CFStringRef() const;
- static QString toQString(CFStringRef cfstr);
- static CFStringRef toCFStringRef(const QString &str);
-#ifdef __OBJC__
- static QString toQString(const NSString *nsstr);
- static NSString *toNSString(const QString &string);
-#endif
private:
QString string;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 0413e06665..adefea4f09 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -150,7 +150,7 @@ QString QCoreApplicationPrivate::macMenuBarName()
QString bundleName;
CFTypeRef string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("CFBundleName"));
if (string)
- bundleName = QCFString::toQString(static_cast<CFStringRef>(string));
+ bundleName = QString::fromCFString(static_cast<CFStringRef>(string));
return bundleName;
}
#endif
@@ -1260,18 +1260,30 @@ int QCoreApplication::exec()
self->d_func()->aboutToQuitEmitted = false;
int returnCode = eventLoop.exec();
threadData->quitNow = false;
- if (self) {
- self->d_func()->in_exec = false;
- if (!self->d_func()->aboutToQuitEmitted)
- emit self->aboutToQuit(QPrivateSignal());
- self->d_func()->aboutToQuitEmitted = true;
- sendPostedEvents(0, QEvent::DeferredDelete);
- }
+
+ if (self)
+ self->d_func()->execCleanup();
return returnCode;
}
+// Cleanup after eventLoop is done executing in QCoreApplication::exec().
+// This is for use cases in which QCoreApplication is instantiated by a
+// library and not by an application executable, for example, Active X
+// servers.
+
+void QCoreApplicationPrivate::execCleanup()
+{
+ threadData->quitNow = false;
+ in_exec = false;
+ if (!aboutToQuitEmitted)
+ emit q_func()->aboutToQuit(QCoreApplication::QPrivateSignal());
+ aboutToQuitEmitted = true;
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+}
+
+
/*!
Tells the application to exit with a return code.
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 445bae01b4..3601add098 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -145,6 +145,8 @@ public:
static inline void clearApplicationFilePath() { delete cachedApplicationFilePath; cachedApplicationFilePath = 0; }
#ifndef QT_NO_QOBJECT
+ void execCleanup();
+
bool in_exec;
bool aboutToQuitEmitted;
bool threadData_clean;
diff --git a/src/corelib/kernel/qcoreglobaldata.cpp b/src/corelib/kernel/qcoreglobaldata.cpp
index e5fb50715c..e2087b9e64 100644
--- a/src/corelib/kernel/qcoreglobaldata.cpp
+++ b/src/corelib/kernel/qcoreglobaldata.cpp
@@ -45,15 +45,19 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QCoreGlobalData, globalInstance)
QCoreGlobalData::QCoreGlobalData()
+#if QT_CONFIG(textcodec)
: codecForLocale(0)
+#endif
{
}
QCoreGlobalData::~QCoreGlobalData()
{
+#if QT_CONFIG(textcodec)
codecForLocale = 0;
for (QList<QTextCodec *>::const_iterator it = allCodecs.constBegin(); it != allCodecs.constEnd(); ++it)
delete *it;
+#endif
}
QCoreGlobalData *QCoreGlobalData::instance()
diff --git a/src/corelib/kernel/qcoreglobaldata_p.h b/src/corelib/kernel/qcoreglobaldata_p.h
index 32b5becf4f..c3c2f7b4a4 100644
--- a/src/corelib/kernel/qcoreglobaldata_p.h
+++ b/src/corelib/kernel/qcoreglobaldata_p.h
@@ -71,9 +71,11 @@ struct QCoreGlobalData {
QMap<QString, QStringList> dirSearchPaths;
QReadWriteLock dirSearchPathsLock;
+#if QT_CONFIG(textcodec)
QList<QTextCodec*> allCodecs;
QAtomicPointer<QTextCodec> codecForLocale;
QTextCodecCache codecCache;
+#endif
static QCoreGlobalData *instance();
};
diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm
index eecc72fd94..9ac48f144d 100644
--- a/src/corelib/kernel/qeventdispatcher_cf.mm
+++ b/src/corelib/kernel/qeventdispatcher_cf.mm
@@ -117,7 +117,7 @@ static CFStringRef runLoopMode(NSDictionary *dictionary)
if (CFStringCompare(mode, [self currentMode], 0) == kCFCompareEqualTo)
m_runLoopModes.pop();
else
- qWarning("Tried to pop run loop mode '%s' that was never pushed!", qPrintable(QCFString::toQString(mode)));
+ qWarning("Tried to pop run loop mode '%s' that was never pushed!", qPrintable(QString::fromCFString(mode)));
Q_ASSERT(m_runLoopModes.size() >= 1);
}
@@ -285,7 +285,7 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
CFTimeInterval duration = (m_processEvents.flags & QEventLoop::WaitForMoreEvents) ?
kCFTimeIntervalDistantFuture : kCFTimeIntervalMinimum;
- qEventDispatcherDebug() << "Calling CFRunLoopRunInMode = " << qPrintable(QCFString::toQString(mode))
+ qEventDispatcherDebug() << "Calling CFRunLoopRunInMode = " << qPrintable(QString::fromCFString(mode))
<< " for " << duration << " ms, processing single source = " << returnAfterSingleSourceHandled; qIndent();
SInt32 result = CFRunLoopRunInMode(mode, duration, returnAfterSingleSourceHandled);
diff --git a/src/corelib/kernel/qfunctions_winrt.h b/src/corelib/kernel/qfunctions_winrt.h
index e0777b8df8..9b33f8b120 100644
--- a/src/corelib/kernel/qfunctions_winrt.h
+++ b/src/corelib/kernel/qfunctions_winrt.h
@@ -180,7 +180,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
t.start();
switch (awaitStyle) {
case ProcessMainThreadEvents:
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
+ while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QCoreApplication::processEvents();
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@@ -188,7 +188,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
break;
case ProcessThreadEvents:
if (QAbstractEventDispatcher *dispatcher = QThread::currentThread()->eventDispatcher()) {
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
+ while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
dispatcher->processEvents(QEventLoop::AllEvents);
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@@ -198,7 +198,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
// fall through
default:
case YieldThread:
- while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == Started) {
+ while (SUCCEEDED(hr = asyncInfo->get_Status(&status)) && status == AsyncStatus::Started) {
QThread::yieldCurrentThread();
if (timeout && t.hasExpired(timeout))
return ERROR_TIMEOUT;
@@ -206,7 +206,7 @@ static inline HRESULT _await_impl(const Microsoft::WRL::ComPtr<T> &asyncOp, Awai
break;
}
- if (FAILED(hr) || status != Completed) {
+ if (FAILED(hr) || status != AsyncStatus::Completed) {
HRESULT ec;
hr = asyncInfo->get_ErrorCode(&ec);
if (FAILED(hr))
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 8ba494ec3d..6d39233aa7 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -611,6 +611,8 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiv
A single-shot timer fires only once, non-single-shot timers fire
every \l interval milliseconds.
+ The default value for this property is \c false.
+
\sa interval, singleShot()
*/
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 13b669d3f6..13bf41faa9 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qabstractstate.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qabstractstate_p.h"
#include "qstate.h"
#include "qstate_p.h"
@@ -237,5 +234,3 @@ bool QAbstractState::event(QEvent *e)
}
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index 24e312ac5b..02c7d9e830 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -42,10 +42,9 @@
#include <QtCore/qobject.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QState;
class QStateMachine;
@@ -84,8 +83,6 @@ private:
Q_DECLARE_PRIVATE(QAbstractState)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qabstractstate_p.h b/src/corelib/statemachine/qabstractstate_p.h
index 552125f95a..11befc187e 100644
--- a/src/corelib/statemachine/qabstractstate_p.h
+++ b/src/corelib/statemachine/qabstractstate_p.h
@@ -51,13 +51,11 @@
// We mean it.
//
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <private/qobject_p.h>
#include <QtCore/qabstractstate.h>
+QT_REQUIRE_CONFIG(statemachine);
+
QT_BEGIN_NAMESPACE
class QStateMachine;
@@ -98,6 +96,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STATEMACHINE
-
#endif // QABSTRACTSTATE_P_H
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 42d1342e10..8c30d5f11c 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qabstracttransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qabstracttransition_p.h"
#include "qabstractstate.h"
#include "qhistorystate.h"
@@ -434,5 +431,3 @@ bool QAbstractTransition::event(QEvent *e)
}
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index 41acaa643b..b86d26e969 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -44,10 +44,9 @@
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QEvent;
class QAbstractState;
@@ -113,8 +112,6 @@ private:
Q_DECLARE_PRIVATE(QAbstractTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index fd7a9dc311..e11514670e 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -57,6 +57,8 @@
#include <QtCore/qvector.h>
#include <QtCore/qsharedpointer.h>
+QT_REQUIRE_CONFIG(statemachine);
+
QT_BEGIN_NAMESPACE
class QAbstractState;
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index ecf40e9c9c..cd0cfe2f85 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qeventtransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qeventtransition_p.h"
#include "qstate.h"
#include "qstate_p.h"
@@ -255,5 +252,3 @@ bool QEventTransition::event(QEvent *e)
}
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 454ad1199c..3c66e72658 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -43,10 +43,9 @@
#include <QtCore/qabstracttransition.h>
#include <QtCore/qcoreevent.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(qeventtransition);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QEventTransitionPrivate;
class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
@@ -81,8 +80,6 @@ private:
Q_DECLARE_PRIVATE(QEventTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qeventtransition_p.h b/src/corelib/statemachine/qeventtransition_p.h
index 020a2f9cba..e30e12bc8d 100644
--- a/src/corelib/statemachine/qeventtransition_p.h
+++ b/src/corelib/statemachine/qeventtransition_p.h
@@ -53,6 +53,8 @@
#include "private/qabstracttransition_p.h"
+QT_REQUIRE_CONFIG(qeventtransition);
+
QT_BEGIN_NAMESPACE
class QEventTransition;
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
index efcb364794..bef9fc4239 100644
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ b/src/corelib/statemachine/qfinalstate.cpp
@@ -39,8 +39,6 @@
#include "qfinalstate_p.h"
-#ifndef QT_NO_STATEMACHINE
-
QT_BEGIN_NAMESPACE
/*!
@@ -139,5 +137,3 @@ bool QFinalState::event(QEvent *e)
}
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index 9b6b193231..1563bef397 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -42,9 +42,9 @@
#include <QtCore/qabstractstate.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QFinalStatePrivate;
class Q_CORE_EXPORT QFinalState : public QAbstractState
@@ -68,8 +68,6 @@ private:
Q_DECLARE_PRIVATE(QFinalState)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qfinalstate_p.h b/src/corelib/statemachine/qfinalstate_p.h
index 74640289f1..57de703fe9 100644
--- a/src/corelib/statemachine/qfinalstate_p.h
+++ b/src/corelib/statemachine/qfinalstate_p.h
@@ -48,7 +48,7 @@
#include "qfinalstate.h"
#include "private/qabstractstate_p.h"
-#ifndef QT_NO_STATEMACHINE
+QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
@@ -63,6 +63,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STATEMACHINE
-
#endif // QFINALSTATE_P_H
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index 338c89c688..b1c5a92d00 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qhistorystate.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qhistorystate_p.h"
QT_BEGIN_NAMESPACE
@@ -313,5 +310,3 @@ bool QHistoryState::event(QEvent *e)
*/
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index 89d4d7a9e4..c20053abf6 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -42,10 +42,9 @@
#include <QtCore/qabstractstate.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QAbstractTransition;
class QHistoryStatePrivate;
@@ -91,8 +90,6 @@ private:
Q_DECLARE_PRIVATE(QHistoryState)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h
index ae9ed431cb..4a4442d7dd 100644
--- a/src/corelib/statemachine/qhistorystate_p.h
+++ b/src/corelib/statemachine/qhistorystate_p.h
@@ -52,13 +52,12 @@
//
#include "private/qabstractstate_p.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtCore/qabstracttransition.h>
#include <QtCore/qhistorystate.h>
#include <QtCore/qlist.h>
+QT_REQUIRE_CONFIG(statemachine);
+
QT_BEGIN_NAMESPACE
class QHistoryStatePrivate : public QAbstractStatePrivate
@@ -95,6 +94,4 @@ protected:
QT_END_NAMESPACE
-#endif // QT_NO_STATEMACHINE
-
#endif // QHISTORYSTATE_P_H
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
index 92b1ee3b70..271f6317bd 100644
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ b/src/corelib/statemachine/qsignaleventgenerator_p.h
@@ -54,6 +54,8 @@
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qobject.h>
+QT_REQUIRE_CONFIG(statemachine);
+
QT_BEGIN_NAMESPACE
class QStateMachine;
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index c4ba8e5315..3b219bda53 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qsignaltransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qsignaltransition_p.h"
#include "qstate.h"
#include "qstate_p.h"
@@ -287,5 +284,3 @@ void QSignalTransitionPrivate::callOnTransition(QEvent *e)
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index d7cf8584da..97c2916d9a 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -43,10 +43,9 @@
#include <QtCore/qabstracttransition.h>
#include <QtCore/qmetaobject.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QSignalTransitionPrivate;
class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition
@@ -95,8 +94,6 @@ private:
Q_DECLARE_PRIVATE(QSignalTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h
index 6820bf3bcb..f270a5be4a 100644
--- a/src/corelib/statemachine/qsignaltransition_p.h
+++ b/src/corelib/statemachine/qsignaltransition_p.h
@@ -53,6 +53,8 @@
#include "private/qabstracttransition_p.h"
+QT_REQUIRE_CONFIG(statemachine);
+
QT_BEGIN_NAMESPACE
class QSignalTransition;
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index cae6474c32..48456424cf 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qstate_p.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qhistorystate.h"
#include "qhistorystate_p.h"
#include "qabstracttransition.h"
@@ -602,5 +599,3 @@ bool QState::event(QEvent *e)
*/
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 7a9dc9c132..33f84c2de0 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -44,10 +44,9 @@
#include <QtCore/qlist.h>
#include <QtCore/qmetaobject.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QAbstractTransition;
class QSignalTransition;
@@ -130,8 +129,6 @@ private:
Q_DECLARE_PRIVATE(QState)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index 913657e53b..7fb40392e7 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -59,7 +59,7 @@
#include <QtCore/qpointer.h>
#include <QtCore/qvariant.h>
-#ifndef QT_NO_STATEMACHINE
+QT_REQUIRE_CONFIG(statemachine);
QT_BEGIN_NAMESPACE
@@ -124,6 +124,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STATEMACHINE
-
#endif
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index db395b24dd..433f595611 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qstatemachine.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine_p.h"
@@ -3235,5 +3232,3 @@ QT_END_NAMESPACE
#include "qstatemachine.moc"
#include "moc_qstatemachine.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 031d9ceee2..4f31252eed 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -48,10 +48,9 @@
#include <QtCore/qset.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(statemachine);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QStateMachinePrivate;
class QAbstractAnimation;
@@ -183,8 +182,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_killDelayedEventTimer(int, int))
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 45634e27fb..9418813afd 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -63,6 +63,8 @@
#include <QtCore/qvector.h>
#include <private/qfreelist_p.h>
+QT_REQUIRE_CONFIG(statemachine);
+
QT_BEGIN_NAMESPACE
class QEvent;
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
index 52df10a3bc..ee701ebc37 100644
--- a/src/corelib/statemachine/statemachine.pri
+++ b/src/corelib/statemachine/statemachine.pri
@@ -1,3 +1,5 @@
+!qtConfig(statemachine): return()
+
HEADERS += $$PWD/qstatemachine.h \
$$PWD/qstatemachine_p.h \
$$PWD/qsignaleventgenerator_p.h \
diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h
index 6ebaab3d48..4dcae03ad9 100644
--- a/src/corelib/tools/qcommandlineoption.h
+++ b/src/corelib/tools/qcommandlineoption.h
@@ -43,6 +43,8 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qshareddata.h>
+QT_REQUIRE_CONFIG(commandlineparser);
+
QT_BEGIN_NAMESPACE
class QCommandLineOptionPrivate;
diff --git a/src/corelib/tools/qcommandlineparser.h b/src/corelib/tools/qcommandlineparser.h
index 51bab66ca7..4584c384cc 100644
--- a/src/corelib/tools/qcommandlineparser.h
+++ b/src/corelib/tools/qcommandlineparser.h
@@ -45,6 +45,8 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qcommandlineoption.h>
+QT_REQUIRE_CONFIG(commandlineparser);
+
QT_BEGIN_NAMESPACE
class QCommandLineParserPrivate;
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index ac8054ce82..50b9f0decb 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -46,7 +46,9 @@
#include "qset.h"
#include "qlocale.h"
#include "qdatetime.h"
+#if QT_CONFIG(timezone)
#include "qtimezoneprivate_p.h"
+#endif
#include "qregexp.h"
#include "qdebug.h"
#ifndef Q_OS_WIN
@@ -1328,7 +1330,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format)
QDate QDate::fromString(const QString &string, const QString &format)
{
QDate date;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString);
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
if (dt.parseFormat(format))
@@ -2017,7 +2019,7 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
QTime QTime::fromString(const QString &string, const QString &format)
{
QTime time;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString);
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
if (dt.parseFormat(format))
@@ -2576,7 +2578,7 @@ static void refreshDateTime(QDateTimeData &d)
QTime testTime;
Q_ASSERT(spec == Qt::TimeZone || spec == Qt::LocalTime);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
// If not valid time zone then is invalid
if (spec == Qt::TimeZone) {
if (!d->m_timeZone.isValid())
@@ -2584,7 +2586,7 @@ static void refreshDateTime(QDateTimeData &d)
else
epochMSecs = QDateTimePrivate::zoneMSecsToEpochMSecs(msecs, d->m_timeZone, &testDate, &testTime);
}
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
// If not valid date and time then is invalid
if (!(status & QDateTimePrivate::ValidDate) || !(status & QDateTimePrivate::ValidTime)) {
@@ -2676,9 +2678,9 @@ static void setTimeSpec(QDateTimeData &d, Qt::TimeSpec spec, int offsetSeconds)
d.detach();
d->m_status = status & ~QDateTimePrivate::ShortData;
d->m_offsetFromUtc = offsetSeconds;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
d->m_timeZone = QTimeZone();
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
}
}
@@ -2889,7 +2891,7 @@ QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime &toTim
return result;
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
inline QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime &toTime,
const QTimeZone &toTimeZone)
{
@@ -2918,7 +2920,7 @@ inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QT
return zoneMSecs - (data.standardTimeOffset * 1000);
}
}
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
/*****************************************************************************
QDateTime member functions
@@ -3112,7 +3114,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec, in
{
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
/*!
\since 5.2
@@ -3128,7 +3130,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, const QTimeZone &time
: d(QDateTimePrivate::create(date, time, timeZone))
{
}
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
/*!
Constructs a copy of the \a other datetime.
@@ -3248,7 +3250,7 @@ Qt::TimeSpec QDateTime::timeSpec() const
return getSpec(d);
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
/*!
\since 5.2
@@ -3276,7 +3278,7 @@ QTimeZone QDateTime::timeZone() const
}
return QTimeZone();
}
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
/*!
\since 5.2
@@ -3339,15 +3341,15 @@ QString QDateTime::timeZoneAbbreviation() const
{
switch (getSpec(d)) {
case Qt::UTC:
- return QTimeZonePrivate::utcQString();
+ return QLatin1String("UTC");
case Qt::OffsetFromUTC:
- return QTimeZonePrivate::utcQString() + toOffsetString(Qt::ISODate, d->m_offsetFromUtc);
+ return QLatin1String("UTC") + toOffsetString(Qt::ISODate, d->m_offsetFromUtc);
case Qt::TimeZone:
-#ifdef QT_BOOTSTRAPPED
+#if !QT_CONFIG(timezone)
break;
#else
return d->m_timeZone.d->abbreviation(toMSecsSinceEpoch());
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
case Qt::LocalTime: {
QString abbrev;
auto status = extractDaylightStatus(getStatus(d));
@@ -3376,11 +3378,11 @@ bool QDateTime::isDaylightTime() const
case Qt::OffsetFromUTC:
return false;
case Qt::TimeZone:
-#ifdef QT_BOOTSTRAPPED
+#if !QT_CONFIG(timezone)
break;
#else
return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch());
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
case Qt::LocalTime: {
auto status = extractDaylightStatus(getStatus(d));
if (status == QDateTimePrivate::UnknownDaylightTime)
@@ -3464,7 +3466,7 @@ void QDateTime::setOffsetFromUtc(int offsetSeconds)
checkValidDateTime(d);
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
/*!
\since 5.2
@@ -3484,7 +3486,7 @@ void QDateTime::setTimeZone(const QTimeZone &toZone)
d->m_timeZone = toZone;
refreshDateTime(d);
}
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
/*!
\since 4.7
@@ -3517,7 +3519,7 @@ qint64 QDateTime::toMSecsSinceEpoch() const
}
case Qt::TimeZone:
-#ifdef QT_BOOTSTRAPPED
+#if !QT_CONFIG(timezone)
return 0;
#else
return QDateTimePrivate::zoneMSecsToEpochMSecs(d->m_msecs, d->m_timeZone);
@@ -3615,7 +3617,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
break;
case Qt::TimeZone:
Q_ASSERT(!d.isShort());
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
// Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
// but all affected times afterwards will have DST applied.
d.detach();
@@ -3628,7 +3630,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
| QDateTimePrivate::ValidDate
| QDateTimePrivate::ValidTime
| QDateTimePrivate::ValidDateTime;
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
break;
case Qt::LocalTime: {
QDate dt;
@@ -3905,10 +3907,10 @@ static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date,
if (spec == Qt::LocalTime) {
QDateTimePrivate::DaylightStatus status = QDateTimePrivate::UnknownDaylightTime;
localMSecsToEpochMSecs(timeToMSecs(*date, *time), &status, date, time);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
} else if (spec == Qt::TimeZone) {
QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(*date, *time), d->m_timeZone, date, time);
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
}
}
@@ -4168,7 +4170,7 @@ QDateTime QDateTime::toOffsetFromUtc(int offsetSeconds) const
return fromMSecsSinceEpoch(toMSecsSinceEpoch(), Qt::OffsetFromUTC, offsetSeconds);
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
/*!
\since 5.2
@@ -4190,7 +4192,7 @@ QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const
return fromMSecsSinceEpoch(toMSecsSinceEpoch(), timeZone);
}
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
/*!
Returns \c true if this datetime is equal to the \a other datetime;
@@ -4449,7 +4451,7 @@ QDateTime QDateTime::fromTime_t(uint seconds, Qt::TimeSpec spec, int offsetSecon
return fromMSecsSinceEpoch((qint64)seconds * 1000, spec, offsetSeconds);
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
/*!
\since 5.2
\deprecated
@@ -4542,7 +4544,7 @@ QDateTime QDateTime::fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec, int offs
return fromMSecsSinceEpoch(secs * 1000, spec, offsetSeconds);
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
/*!
\since 5.2
@@ -4931,7 +4933,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
QDateTime QDateTime::fromString(const QString &string, const QString &format)
{
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QTime time;
QDate date;
@@ -5075,10 +5077,10 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
out << dateAndTime << qint8(dateTime.timeSpec());
if (dateTime.timeSpec() == Qt::OffsetFromUTC)
out << qint32(dateTime.offsetFromUtc());
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
else if (dateTime.timeSpec() == Qt::TimeZone)
out << dateTime.timeZone();
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
} else if (out.version() == QDataStream::Qt_5_0) {
@@ -5135,9 +5137,9 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
qint8 ts = 0;
Qt::TimeSpec spec = Qt::LocalTime;
qint32 offset = 0;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QTimeZone tz;
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
if (in.version() >= QDataStream::Qt_5_2) {
@@ -5147,11 +5149,11 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
if (spec == Qt::OffsetFromUTC) {
in >> offset;
dateTime = QDateTime(dt, tm, spec, offset);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
} else if (spec == Qt::TimeZone) {
in >> tz;
dateTime = QDateTime(dt, tm, tz);
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
} else {
dateTime = QDateTime(dt, tm, spec);
}
@@ -5177,7 +5179,7 @@ QDataStream &operator>>(QDataStream &in, QDateTime &dateTime)
break;
case QDateTimePrivate::TimeZone:
spec = Qt::TimeZone;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
// FIXME: need to use a different constructor !
#endif
break;
@@ -5234,9 +5236,9 @@ QDebug operator<<(QDebug dbg, const QDateTime &date)
dbg << ' ' << date.offsetFromUtc() << 's';
break;
case Qt::TimeZone:
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
dbg << ' ' << date.timeZone().id();
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
break;
case Qt::LocalTime:
break;
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index ebf9b45570..c7f14ed40a 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -253,9 +253,9 @@ public:
QDateTime(const QDate &, const QTime &, Qt::TimeSpec spec = Qt::LocalTime);
// ### Qt 6: Merge with above with default offsetSeconds = 0
QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec, int offsetSeconds);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QDateTime(const QDate &date, const QTime &time, const QTimeZone &timeZone);
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
QDateTime(const QDateTime &other) Q_DECL_NOTHROW;
QDateTime(QDateTime &&other) Q_DECL_NOTHROW;
~QDateTime();
@@ -274,9 +274,9 @@ public:
QTime time() const;
Qt::TimeSpec timeSpec() const;
int offsetFromUtc() const;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QTimeZone timeZone() const;
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
QString timeZoneAbbreviation() const;
bool isDaylightTime() const;
@@ -287,9 +287,9 @@ public:
void setTime(const QTime &time);
void setTimeSpec(Qt::TimeSpec spec);
void setOffsetFromUtc(int offsetSeconds);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
void setTimeZone(const QTimeZone &toZone);
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
void setMSecsSinceEpoch(qint64 msecs);
void setSecsSinceEpoch(qint64 secs);
@@ -307,9 +307,9 @@ public:
inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); }
inline QDateTime toUTC() const { return toTimeSpec(Qt::UTC); }
QDateTime toOffsetFromUtc(int offsetSeconds) const;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QDateTime toTimeZone(const QTimeZone &toZone) const;
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
qint64 daysTo(const QDateTime &) const;
qint64 secsTo(const QDateTime &) const;
@@ -348,7 +348,7 @@ public:
static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetFromUtc = 0);
static QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spe = Qt::LocalTime, int offsetFromUtc = 0);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone);
static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone);
#endif
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index 38a084b257..eb33dddbb7 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -58,7 +58,9 @@
#include "QtCore/qdatetime.h"
#include "QtCore/qpair.h"
+#if QT_CONFIG(timezone)
#include "qtimezone.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -118,22 +120,22 @@ public:
static QDateTime::Data create(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
int offsetSeconds);
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
static QDateTime::Data create(const QDate &toDate, const QTime &toTime, const QTimeZone & timeZone);
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
qint64 m_msecs;
StatusFlags m_status;
int m_offsetFromUtc;
mutable QAtomicInt ref;
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
QTimeZone m_timeZone;
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(timezone)
static qint64 zoneMSecsToEpochMSecs(qint64 msecs, const QTimeZone &zone,
QDate *localDate = 0, QTime *localTime = 0);
-#endif // QT_BOOTSTRAPPED
+#endif // timezone
static inline qint64 minJd() { return QDate::minJd(); }
static inline qint64 maxJd() { return QDate::maxJd(); }
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 1762da2c8f..5f26e704c4 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -370,7 +370,7 @@ void **QListData::erase(void **xi)
application must interface with a C API.
\note Iterators into a QLinkedList and references into
- heap-allocating QLists remain valid long as the referenced items
+ heap-allocating QLists remain valid as long as the referenced items
remain in the container. This is not true for iterators and
references into a QVector and non-heap-allocating QLists.
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 4f6efc8832..8587716446 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -76,7 +76,7 @@ static QByteArray getMacLocaleName()
|| (result != "C" && !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry))) {
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
CFStringRef locale = CFLocaleGetIdentifier(l);
- result = QCFString::toQString(locale).toUtf8();
+ result = QString::fromCFString(locale).toUtf8();
}
return result;
}
@@ -96,7 +96,7 @@ static QString macMonthName(int month, bool short_format)
: kCFDateFormatterMonthSymbols));
if (values != 0) {
CFStringRef cfstring = static_cast<CFStringRef>(CFArrayGetValueAtIndex(values, month));
- return QCFString::toQString(cfstring);
+ return QString::fromCFString(cfstring);
}
return QString();
}
@@ -114,7 +114,7 @@ static QString macDayName(int day, bool short_format)
: kCFDateFormatterWeekdaySymbols));
if (values != 0) {
CFStringRef cfstring = static_cast<CFStringRef>(CFArrayGetValueAtIndex(values, day % 7));
- return QCFString::toQString(cfstring);
+ return QString::fromCFString(cfstring);
}
return QString();
}
@@ -293,7 +293,7 @@ QString getMacDateFormat(CFDateFormatterStyle style)
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(kCFAllocatorDefault,
l, style, kCFDateFormatterNoStyle);
- return macToQtFormat(QCFString::toQString(CFDateFormatterGetFormat(formatter)));
+ return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter)));
}
static QString getMacTimeFormat(CFDateFormatterStyle style)
@@ -301,21 +301,21 @@ static QString getMacTimeFormat(CFDateFormatterStyle style)
QCFType<CFLocaleRef> l = CFLocaleCopyCurrent();
QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(kCFAllocatorDefault,
l, kCFDateFormatterNoStyle, style);
- return macToQtFormat(QCFString::toQString(CFDateFormatterGetFormat(formatter)));
+ return macToQtFormat(QString::fromCFString(CFDateFormatterGetFormat(formatter)));
}
static QString getCFLocaleValue(CFStringRef key)
{
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
CFTypeRef value = CFLocaleGetValue(locale, key);
- return QCFString::toQString(CFStringRef(static_cast<CFTypeRef>(value)));
+ return QString::fromCFString(CFStringRef(static_cast<CFTypeRef>(value)));
}
static QLocale::MeasurementSystem macMeasurementSystem()
{
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
CFStringRef system = static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleMeasurementSystem));
- if (QCFString::toQString(system) == QLatin1String("Metric")) {
+ if (QString::fromCFString(system) == QLatin1String("Metric")) {
return QLocale::MetricSystem;
} else {
return QLocale::ImperialSystem;
@@ -337,13 +337,13 @@ static QString macCurrencySymbol(QLocale::CurrencySymbolFormat format)
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
switch (format) {
case QLocale::CurrencyIsoCode:
- return QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode)));
+ return QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode)));
case QLocale::CurrencySymbol:
- return QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencySymbol)));
+ return QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencySymbol)));
case QLocale::CurrencyDisplayName: {
CFStringRef code = static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleCurrencyCode));
QCFType<CFStringRef> value = CFLocaleCopyDisplayNameForPropertyValue(locale, kCFLocaleCurrencyCode, code);
- return QCFString::toQString(value);
+ return QString::fromCFString(value);
}
default:
break;
@@ -382,10 +382,10 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &
CFNumberFormatterCreate(NULL, locale, kCFNumberFormatterCurrencyStyle);
if (!arg.symbol.isEmpty()) {
CFNumberFormatterSetProperty(currencyFormatter, kCFNumberFormatterCurrencySymbol,
- QCFString::toCFStringRef(arg.symbol));
+ arg.symbol.toCFString());
}
QCFType<CFStringRef> result = CFNumberFormatterCreateStringWithNumber(NULL, currencyFormatter, value);
- return QCFString::toQString(result);
+ return QString::fromCFString(result);
}
static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str)
@@ -394,12 +394,12 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
switch (type) {
case QSystemLocale::StringToStandardQuotation:
- begin = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationBeginDelimiterKey)));
- end = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationEndDelimiterKey)));
+ begin = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationBeginDelimiterKey)));
+ end = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleQuotationEndDelimiterKey)));
return QString(begin % str % end);
case QSystemLocale::StringToAlternateQuotation:
- begin = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationBeginDelimiterKey)));
- end = QCFString::toQString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationEndDelimiterKey)));
+ begin = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationBeginDelimiterKey)));
+ end = QString::fromCFString(static_cast<CFStringRef>(CFLocaleGetValue(locale, kCFLocaleAlternateQuotationEndDelimiterKey)));
return QString(begin % str % end);
default:
break;
@@ -468,7 +468,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
QCFType<CFDateFormatterRef> formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterLongStyle, kCFDateFormatterLongStyle);
QCFType<CFStringRef> value = static_cast<CFStringRef>(CFDateFormatterCopyProperty(formatter,
(type == AMText ? kCFDateFormatterAMSymbol : kCFDateFormatterPMSymbol)));
- return QCFString::toQString(value);
+ return QString::fromCFString(value);
}
case FirstDayOfWeek:
return QVariant(macFirstDayOfWeek());
@@ -491,15 +491,15 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
const int cnt = CFArrayGetCount(languages.as<CFArrayRef>());
result.reserve(cnt);
for (int i = 0; i < cnt; ++i) {
- const QString lang = QCFString::toQString(
+ const QString lang = QString::fromCFString(
static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i)));
result.append(lang);
}
} else if (typeId == CFStringGetTypeID()) {
- result = QStringList(QCFString::toQString(languages.as<CFStringRef>()));
+ result = QStringList(QString::fromCFString(languages.as<CFStringRef>()));
} else {
qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt.io",
- qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId))));
+ qPrintable(QString::fromCFString(CFCopyTypeIDDescription(typeId))));
}
return QVariant(result);
}
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 2fd4be00a5..3b6c85ca8a 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -471,6 +471,9 @@ static inline quint64 qCpuFeatures()
#define ALIGNMENT_PROLOGUE_32BYTES(ptr, i, length) \
for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((8 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x7)) & 0x7))); ++i)
+#define SIMD_EPILOGUE(i, length, max) \
+ for (int _i = 0; _i < max && i < length; ++i, ++_i)
+
QT_END_NAMESPACE
#endif // QSIMD_P_H
diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h
index db99f07f44..083f87f39f 100644
--- a/src/corelib/tools/qtimezone.h
+++ b/src/corelib/tools/qtimezone.h
@@ -45,6 +45,8 @@
#include <QtCore/qlocale.h>
#include <QtCore/qdatetime.h>
+QT_REQUIRE_CONFIG(timezone);
+
QT_BEGIN_NAMESPACE
class QTimeZonePrivate;
diff --git a/src/corelib/tools/qtimezoneprivate_mac.mm b/src/corelib/tools/qtimezoneprivate_mac.mm
index 77c04ac20c..5dfffeaf36 100644
--- a/src/corelib/tools/qtimezoneprivate_mac.mm
+++ b/src/corelib/tools/qtimezoneprivate_mac.mm
@@ -90,7 +90,7 @@ QTimeZonePrivate *QMacTimeZonePrivate::clone()
void QMacTimeZonePrivate::init(const QByteArray &ianaId)
{
if (availableTimeZoneIds().contains(ianaId)) {
- m_nstz = [[NSTimeZone timeZoneWithName:QCFString::toNSString(QString::fromUtf8(ianaId))] retain];
+ m_nstz = [[NSTimeZone timeZoneWithName:QString::fromUtf8(ianaId).toNSString()] retain];
if (m_nstz)
m_id = ianaId;
}
@@ -98,7 +98,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId)
QString QMacTimeZonePrivate::comment() const
{
- return QCFString::toQString([m_nstz description]);
+ return QString::fromNSString([m_nstz description]);
}
QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
@@ -140,9 +140,9 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
break;
}
- NSString *macLocaleCode = QCFString::toNSString(locale.name());
+ NSString *macLocaleCode = locale.name().toNSString();
NSLocale *macLocale = [[NSLocale alloc] initWithLocaleIdentifier:macLocaleCode];
- const QString result = QCFString::toQString([m_nstz localizedName:style locale:macLocale]);
+ const QString result = QString::fromNSString([m_nstz localizedName:style locale:macLocale]);
[macLocale release];
return result;
}
@@ -150,7 +150,7 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QString QMacTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const
{
const NSTimeInterval seconds = atMSecsSinceEpoch / 1000.0;
- return QCFString::toQString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]);
+ return QString::fromNSString([m_nstz abbreviationForDate:[NSDate dateWithTimeIntervalSince1970:seconds]]);
}
int QMacTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const
@@ -191,7 +191,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::data(qint64 forMSecsSinceEpoch) cons
data.offsetFromUtc = [m_nstz secondsFromGMTForDate:date];
data.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:date];
data.standardTimeOffset = data.offsetFromUtc - data.daylightTimeOffset;
- data.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:date]);
+ data.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:date]);
return data;
}
@@ -220,7 +220,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
tran.offsetFromUtc = [m_nstz secondsFromGMTForDate:nextDate];
tran.daylightTimeOffset = [m_nstz daylightSavingTimeOffsetForDate:nextDate];
tran.standardTimeOffset = tran.offsetFromUtc - tran.daylightTimeOffset;
- tran.abbreviation = QCFString::toQString([m_nstz abbreviationForDate:nextDate]);
+ tran.abbreviation = QString::fromNSString([m_nstz abbreviationForDate:nextDate]);
return tran;
}
@@ -253,18 +253,18 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const
{
// Reset the cached system tz then return the name
[NSTimeZone resetSystemTimeZone];
- return QCFString::toQString([[NSTimeZone systemTimeZone] name]).toUtf8();
+ return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8();
}
QList<QByteArray> QMacTimeZonePrivate::availableTimeZoneIds() const
{
NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator];
- QByteArray tzid = QCFString::toQString([enumerator nextObject]).toUtf8();
+ QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
QList<QByteArray> list;
while (!tzid.isEmpty()) {
list << tzid;
- tzid = QCFString::toQString([enumerator nextObject]).toUtf8();
+ tzid = QString::fromNSString([enumerator nextObject]).toUtf8();
}
std::sort(list.begin(), list.end());
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index ef1c9c17b0..0ea47b1a1a 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -77,7 +77,7 @@
application must interface with a C API.
\note Iterators into a QLinkedList and references into
- heap-allocating QLists remain valid long as the referenced items
+ heap-allocating QLists remain valid as long as the referenced items
remain in the container. This is not true for iterators and
references into a QVector and non-heap-allocating QLists.
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index e3d89651e4..47b0b2d4be 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -15,8 +15,6 @@ HEADERS += \
tools/qbytedata_p.h \
tools/qcache.h \
tools/qchar.h \
- tools/qcommandlineoption.h \
- tools/qcommandlineparser.h \
tools/qcollator.h \
tools/qcollator_p.h \
tools/qcontainerfwd.h \
@@ -67,9 +65,6 @@ HEADERS += \
tools/qstringmatcher.h \
tools/qtextboundaryfinder.h \
tools/qtimeline.h \
- tools/qtimezone.h \
- tools/qtimezoneprivate_p.h \
- tools/qtimezoneprivate_data_p.h \
tools/qtools_p.h \
tools/qunicodetables_p.h \
tools/qunicodetools_p.h \
@@ -85,8 +80,6 @@ SOURCES += \
tools/qbytearraylist.cpp \
tools/qbytearraymatcher.cpp \
tools/qcollator.cpp \
- tools/qcommandlineoption.cpp \
- tools/qcommandlineparser.cpp \
tools/qcryptographichash.cpp \
tools/qdatetime.cpp \
tools/qdatetimeparser.cpp \
@@ -116,8 +109,6 @@ SOURCES += \
tools/qstringlist.cpp \
tools/qtextboundaryfinder.cpp \
tools/qtimeline.cpp \
- tools/qtimezone.cpp \
- tools/qtimezoneprivate.cpp \
tools/qunicodetools.cpp \
tools/qvector.cpp \
tools/qvsnprintf.cpp \
@@ -128,18 +119,13 @@ msvc: NO_PCH_SOURCES += tools/qvector_msvc.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
!nacl:mac: {
- OBJECTIVE_SOURCES += tools/qlocale_mac.mm \
- tools/qtimezoneprivate_mac.mm \
-}
-else:android {
- SOURCES += tools/qlocale_unix.cpp tools/qtimezoneprivate_android.cpp
+ SOURCES += tools/qlocale_mac.mm
}
else:unix {
- SOURCES += tools/qlocale_unix.cpp tools/qtimezoneprivate_tz.cpp
+ SOURCES += tools/qlocale_unix.cpp
}
else:win32 {
- SOURCES += tools/qlocale_win.cpp \
- tools/qtimezoneprivate_win.cpp
+ SOURCES += tools/qlocale_win.cpp
winphone: LIBS_PRIVATE += -lWindowsPhoneGlobalizationUtil
winrt-*-msvc2013: LIBS += advapi32.lib
} else:integrity {
@@ -157,8 +143,7 @@ qtConfig(icu) {
include($$PWD/../../3rdparty/icu_dependency.pri)
SOURCES += tools/qlocale_icu.cpp \
- tools/qcollator_icu.cpp \
- tools/qtimezoneprivate_icu.cpp
+ tools/qcollator_icu.cpp
DEFINES += QT_USE_ICU
} else: win32 {
SOURCES += tools/qcollator_win.cpp
@@ -168,6 +153,26 @@ qtConfig(icu) {
SOURCES += tools/qcollator_posix.cpp
}
+qtConfig(timezone) {
+ HEADERS += \
+ tools/qtimezone.h \
+ tools/qtimezoneprivate_p.h \
+ tools/qtimezoneprivate_data_p.h
+ SOURCES += \
+ tools/qtimezone.cpp \
+ tools/qtimezoneprivate.cpp
+ !nacl:darwin: \
+ SOURCES += tools/qtimezoneprivate_mac.mm
+ else: android: \
+ SOURCES += tools/qtimezoneprivate_android.cpp
+ else: unix: \
+ SOURCES += tools/qtimezoneprivate_tz.cpp
+ else: win32: \
+ SOURCES += tools/qtimezoneprivate_win.cpp
+ qtConfig(icu): \
+ SOURCES += tools/qtimezoneprivate_icu.cpp
+}
+
qtConfig(regularexpression) {
include($$PWD/../../3rdparty/pcre_dependency.pri)
@@ -175,6 +180,15 @@ qtConfig(regularexpression) {
SOURCES += tools/qregularexpression.cpp
}
+qtConfig(commandlineparser) {
+ HEADERS += \
+ tools/qcommandlineoption.h \
+ tools/qcommandlineparser.h
+ SOURCES += \
+ tools/qcommandlineoption.cpp \
+ tools/qcommandlineparser.cpp
+}
+
INCLUDEPATH += ../3rdparty/harfbuzz/src
HEADERS += ../3rdparty/harfbuzz/src/harfbuzz.h
SOURCES += ../3rdparty/harfbuzz/src/harfbuzz-buffer.c \
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 43050dcea2..3da35b1741 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -3,7 +3,6 @@ QT = core-private
MODULE_CONFIG = dbusadaptors dbusinterfaces
DEFINES += DBUS_API_SUBJECT_TO_CHANGE
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS
qtConfig(dbus-linked) {
QMAKE_USE_PRIVATE += dbus
DEFINES += QT_LINKED_LIBDBUS
diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp
index 567c827f7e..57684897c6 100644
--- a/src/dbus/qdbusdemarshaller.cpp
+++ b/src/dbus/qdbusdemarshaller.cpp
@@ -39,6 +39,9 @@
#include "qdbusargument_p.h"
#include "qdbusconnection.h"
+
+#include <qscopedpointer.h>
+
#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -423,12 +426,12 @@ QDBusDemarshaller *QDBusDemarshaller::endCommon()
QDBusArgument QDBusDemarshaller::duplicate()
{
- QDBusDemarshaller *d = new QDBusDemarshaller(capabilities);
+ QScopedPointer<QDBusDemarshaller> d(new QDBusDemarshaller(capabilities));
d->iterator = iterator;
d->message = q_dbus_message_ref(message);
q_dbus_message_iter_next(&iterator);
- return QDBusArgumentPrivate::create(d);
+ return QDBusArgumentPrivate::create(d.take());
}
QT_END_NAMESPACE
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 376359ba37..318efe5401 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -54,6 +54,14 @@
"-lbcm_host"
]
},
+ "direct2d": {
+ "label": "Direct 2D",
+ "export": "",
+ "test": "qpa/direct2d",
+ "sources": [
+ "-ld2d1 -ldwrite -ld3d11"
+ ]
+ },
"directfb": {
"label": "DirectFB",
"test": "qpa/directfb",
@@ -87,10 +95,10 @@
},
"freetype": {
"label": "FreeType",
- "export": "",
"test": "unix/freetype",
"sources": [
- "-lfreetype"
+ { "type": "pkgConfig", "args": "freetype2" },
+ { "type": "freetype", "libs": "-lfreetype" }
]
},
"fontconfig": {
@@ -98,7 +106,7 @@
"test": "unix/fontconfig",
"sources": [
{ "type": "pkgConfig", "args": "fontconfig freetype2" },
- "-lfontconfig -lfreetype"
+ { "type": "freetype", "libs": "-lfontconfig -lfreetype" }
]
},
"gbm": {
@@ -294,12 +302,6 @@
},
"tests": {
- "direct2d": {
- "label": "Direct 2D",
- "type": "compile",
- "test": "qpa/direct2d",
- "use": "direct2d"
- },
"directwrite2": {
"label": "DirectWrite 2",
"type": "compile",
@@ -356,6 +358,12 @@
"type": "compile",
"test": "unix/evdev"
},
+ "libinput_axis_api": {
+ "label": "axis API in libinput",
+ "type": "compile",
+ "test": "unix/libinput_axis_api",
+ "use": "libinput"
+ },
"linuxfb": {
"label": "LinuxFB",
"type": "compile",
@@ -436,7 +444,7 @@
"direct2d": {
"label": "Direct 2D",
"autoDetect": false,
- "condition": "tests.direct2d",
+ "condition": "config.win32 && libs.direct2d",
"output": [ "privateFeature" ]
},
"evdev": {
@@ -446,6 +454,8 @@
},
"freetype": {
"label": "FreeType",
+ "purpose": "Supports the FreeType 2 font engine (and its supported font formats).",
+ "section": "Fonts",
"output": [ "privateFeature", "feature" ]
},
"system-freetype": {
@@ -499,6 +509,11 @@
"condition": "features.libudev && libs.libinput",
"output": [ "privateFeature" ]
},
+ "libinput-axis-api": {
+ "label": "axis API in libinput",
+ "condition": "tests.libinput_axis_api",
+ "output": [ "privateFeature" ]
+ },
"lgmon": {
"label": "lgmon",
"emitIf": "config.qnx",
@@ -922,12 +937,6 @@
"condition": "features.temporaryfile",
"output": [ "publicFeature", "feature" ]
},
- "freetype": {
- "label": "Freetype Font Engine",
- "purpose": "Supports the FreeType 2 font engine (and its supported font formats).",
- "section": "Fonts",
- "output": [ "publicFeature", "feature" ]
- },
"desktopservices": {
"label": "QDesktopServices",
"purpose": "Provides methods for accessing common desktop services.",
diff --git a/src/gui/configure.pri b/src/gui/configure.pri
index d79c5a6bba..ee5c7730df 100644
--- a/src/gui/configure.pri
+++ b/src/gui/configure.pri
@@ -1,5 +1,20 @@
# custom tests
+defineTest(qtConfLibrary_freetype) {
+ TRY_INCLUDEPATHS = $$EXTRA_INCLUDEPATH $$QMAKE_INCDIR_X11
+ haiku: TRY_INCLUDEPATHS += /system/develop/headers
+ TRY_INCLUDEPATHS += $$QMAKE_DEFAULT_INCDIR
+ for (p, TRY_INCLUDEPATHS) {
+ includedir = $$p/freetype2
+ exists($$includedir) {
+ $${1}.includedir = "$$val_escape(includedir)"
+ export($${1}.includedir)
+ return(true)
+ }
+ }
+ return(false)
+}
+
# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
@@ -50,9 +65,11 @@ defineTest(qtConfTest_qpaDefaultPlatform) {
else: win32: name = windows
else: android: name = android
else: macos: name = cocoa
- else: ios: name = ios
+ else: if(ios|tvos): name = ios
+ else: watchos: name = minimal
else: qnx: name = qnx
else: integrity: name = integrityfb
+ else: haiku: name = haiku
else: name = xcb
$${1}.value = $$name
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
index 0fa0eecd80..9cdfba20e3 100644
--- a/src/gui/image/qimage_ssse3.cpp
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -50,15 +50,11 @@ QT_BEGIN_NAMESPACE
// dst must be at least len * 4 bytes
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len)
{
- quint32 *const end = dst + len;
+ int i = 0;
- // Prologue, align dst to 16 bytes. The alignment is done on dst because it has 4 store()
- // for each 3 load() of src.
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
- const int prologLength = qMin(len, offsetToAlignOn16Bytes);
-
- for (int i = 0; i < prologLength; ++i) {
- *dst++ = qRgb(src[0], src[1], src[2]);
+ // Prologue, align dst to 16 bytes.
+ ALIGNMENT_PROLOGUE_16BYTES(dst, i, len) {
+ dst[i] = qRgb(src[0], src[1], src[2]);
src += 3;
}
@@ -72,10 +68,9 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, con
const __m128i alphaMask = _mm_set1_epi32(0xff000000);
const __m128i *inVectorPtr = (const __m128i *)src;
- __m128i *dstVectorPtr = (__m128i *)dst;
+ __m128i *dstVectorPtr = (__m128i *)(dst + i);
- const int simdRoundCount = (len - prologLength) / 16; // one iteration in the loop converts 16 pixels
- for (int i = 0; i < simdRoundCount; ++i) {
+ for (; i < (len - 15); i += 16) { // one iteration in the loop converts 16 pixels
/*
RGB888 has 5 pixels per vector, + 1 byte from the next pixel. The idea here is
to load vectors of RGB888 and use palignr to select a vector out of two vectors.
@@ -117,10 +112,9 @@ Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, con
++dstVectorPtr;
}
src = (const uchar *)inVectorPtr;
- dst = (quint32 *)dstVectorPtr;
- while (dst != end) {
- *dst++ = qRgb(src[0], src[1], src[2]);
+ SIMD_EPILOGUE(i, len, 15) {
+ dst[i] = qRgb(src[0], src[1], src[2]);
src += 3;
}
}
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index a360debf5b..0aa05a04e2 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -760,39 +760,37 @@ QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode)
bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConversionFlags flags)
{
- if (fileName.isEmpty()) {
- data.reset();
- return false;
- }
-
- detach();
+ if (!fileName.isEmpty()) {
- QFileInfo info(fileName);
- QString key = QLatin1String("qt_pixmap")
- % info.absoluteFilePath()
- % HexString<uint>(info.lastModified().toSecsSinceEpoch())
- % HexString<quint64>(info.size())
- % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
+ QFileInfo info(fileName);
+ // Note: If no extension is provided, we try to match the
+ // file against known plugin extensions
+ if (info.completeSuffix().isEmpty() || info.exists()) {
- // Note: If no extension is provided, we try to match the
- // file against known plugin extensions
- if (!info.completeSuffix().isEmpty() && !info.exists()) {
- data.reset();
- return false;
- }
+ QString key = QLatin1String("qt_pixmap")
+ % info.absoluteFilePath()
+ % HexString<uint>(info.lastModified().toSecsSinceEpoch())
+ % HexString<quint64>(info.size())
+ % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
- if (QPixmapCache::find(key, this))
- return true;
+ if (QPixmapCache::find(key, this))
+ return true;
- if (!data)
- data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType);
+ data = QPlatformPixmap::create(0, 0, data ? data->pixelType() : QPlatformPixmap::PixmapType);
- if (data->fromFile(fileName, format, flags)) {
- QPixmapCache::insert(key, *this);
- return true;
+ if (data->fromFile(fileName, format, flags)) {
+ QPixmapCache::insert(key, *this);
+ return true;
+ }
+ }
}
- data.reset();
+ if (!isNull()) {
+ if (isQBitmap())
+ *this = QBitmap();
+ else
+ data.reset();
+ }
return false;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index cd67e9a875..fcb9c14406 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1667,7 +1667,7 @@ QResizeEvent::~QResizeEvent()
The event handler QWidget::closeEvent() receives close events. The
default implementation of this event handler accepts the close
event. If you do not want your widget to be hidden, or want some
- special handing, you should reimplement the event handler and
+ special handling, you should reimplement the event handler and
ignore() the event.
The \l{mainwindows/application#close event handler}{closeEvent() in the
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index bb778bc5fc..b799f75090 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -70,6 +70,63 @@ QWindowSystemInterfacePrivate::WindowSystemEventList QWindowSystemInterfacePriva
extern QPointer<QWindow> qt_last_mouse_receiver;
/*!
+ Handles a window system event asynchronously by posting the event to Qt Gui.
+
+ \sa postWindowSystemEvent()
+*/
+template<>
+bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::AsynchronousDelivery>(WindowSystemEvent *ev)
+{
+ QWindowSystemInterfacePrivate::postWindowSystemEvent(ev);
+ return true;
+}
+
+/*!
+ Handles a window system event synchronously.
+
+ If the event is delivered from another thread than the Qt main thread the
+ window system event queue is flushed, which may deliver other events as
+ well.
+
+ \sa processWindowSystemEvent()
+*/
+template<>
+bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::SynchronousDelivery>(WindowSystemEvent *ev)
+{
+ return QWindowSystemInterfacePrivate::processWindowSystemEvent(ev);
+}
+
+/*!
+ Handles a window system event.
+
+ By default this function posts the event on the window system event queue and
+ wakes the Gui event dispatcher. Qt Gui will then handle the event asynchonously
+ at a later point. The return value is not used in asynchronous mode and will
+ always be true.
+
+ In synchronous mode Qt Gui will process the event immediately. The return value
+ indicates if Qt accepted the event. If the event is delivered from another thread
+ than the Qt main thread the window system event queue is flushed, which may deliver
+ other events as well.
+
+ \sa flushWindowSystemEvents(), processWindowSystemEvent(), setSynchronousWindowSystemEvents()
+*/
+template<>
+bool QWindowSystemInterfacePrivate::handleWindowSystemEvent<QWindowSystemInterface::DefaultDelivery>(QWindowSystemInterfacePrivate::WindowSystemEvent *ev)
+{
+ if (synchronousWindowSystemEvents)
+ return handleWindowSystemEvent<QWindowSystemInterface::SynchronousDelivery>(ev);
+ else
+ return handleWindowSystemEvent<QWindowSystemInterface::AsynchronousDelivery>(ev);
+}
+
+#define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName, ...) \
+ template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::DefaultDelivery>(__VA_ARGS__); \
+ template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::SynchronousDelivery>(__VA_ARGS__); \
+ template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::AsynchronousDelivery>(__VA_ARGS__); \
+ template<typename Delivery> ReturnType QWindowSystemInterface::HandlerName(__VA_ARGS__)
+
+/*!
\class QWindowSystemInterface
\since 5.0
\internal
@@ -81,18 +138,18 @@ extern QPointer<QWindow> qt_last_mouse_receiver;
until sendWindowSystemEvents() is called by the event dispatcher.
*/
-void QWindowSystemInterface::handleEnterEvent(QWindow *tlw, const QPointF &local, const QPointF &global)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *tlw, const QPointF &local, const QPointF &global)
{
if (tlw) {
QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw, local, global);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
}
-void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw)
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleLeaveEvent, QWindow *tlw)
{
QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
/*!
@@ -104,15 +161,8 @@ void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw)
*/
void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local, const QPointF& global)
{
- bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
- if (wasSynchronous)
- setSynchronousWindowSystemEvents(false);
- handleLeaveEvent(leave);
+ handleLeaveEvent<AsynchronousDelivery>(leave);
handleEnterEvent(enter, local, global);
- if (wasSynchronous) {
- flushWindowSystemEvents();
- setSynchronousWindowSystemEvents(true);
- }
}
void QWindowSystemInterface::handleWindowActivated(QWindow *tlw, Qt::FocusReason r)
@@ -167,19 +217,19 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *tlw, bool *accepted)
\a w == 0 means that the event is in global coords only, \a local will be ignored in this case
*/
-void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleMouseEvent(w, time, local, global, b, mods, source);
+ handleMouseEvent<Delivery>(w, time, local, global, b, mods, source);
}
-void QWindowSystemInterface::handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
QWindowSystemInterfacePrivate::MouseEvent * e =
new QWindowSystemInterfacePrivate::MouseEvent(w, timestamp, QHighDpi::fromNativeLocalPosition(local, w), QHighDpi::fromNativePixels(global, w), b, mods, source);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
@@ -217,11 +267,7 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorepeat, count);
{
- // FIXME: Template handleWindowSystemEvent to support both sync and async delivery
- QScopedValueRollback<bool> syncRollback(QWindowSystemInterfacePrivate::synchronousWindowSystemEvents);
- QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = true;
-
- if (QWindowSystemInterfacePrivate::handleWindowSystemEvent(shortcutOverrideEvent))
+ if (QWindowSystemInterfacePrivate::handleWindowSystemEvent<SynchronousDelivery>(shortcutOverrideEvent))
return false;
}
}
@@ -248,13 +294,12 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
#endif
}
-
-bool QWindowSystemInterface::handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- return handleKeyEvent(w, time, t, k, mods, text, autorep, count);
+ return handleKeyEvent<Delivery>(w, time, t, k, mods, text, autorep, count);
}
-bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
#if defined(Q_OS_OSX)
if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(tlw, timestamp, k, mods, 0, 0, 0, text, autorep, count))
@@ -263,7 +308,7 @@ bool QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEven
QWindowSystemInterfacePrivate::KeyEvent * e =
new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count);
- return QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
@@ -394,6 +439,15 @@ void QWindowSystemInterfacePrivate::removeWindowSystemEvent(WindowSystemEvent *e
windowSystemEventQueue.remove(event);
}
+/*!
+ Posts a window system event to be handled asynchronously by Qt Gui.
+
+ This function posts the event on the window system event queue and wakes the
+ Gui event dispatcher. Qt Gui will then handle the event asynchonously at a
+ later point.
+
+ \sa flushWindowSystemEvents(), processWindowSystemEvent(), handleWindowSystemEvent()
+*/
void QWindowSystemInterfacePrivate::postWindowSystemEvent(WindowSystemEvent *ev)
{
windowSystemEventQueue.append(ev);
@@ -403,37 +457,32 @@ void QWindowSystemInterfacePrivate::postWindowSystemEvent(WindowSystemEvent *ev)
}
/*!
- Handles a window system event.
+ Processes a window system event synchronously.
- By default this function posts the event on the window system event queue and
- wakes the Gui event dispatcher. Qt Gui will then handle the event asynchonously
- at a later point. The return value is not used in asynchronous mode and will
- always be true.
+ Qt Gui will process the event immediately. The return value indicates if Qt
+ accepted the event.
- In synchronous mode Qt Gui will process the event immediately. The return value
- indicates if Qt accepted the event.
+ If the event is delivered from another thread than the Qt main thread the
+ window system event queue is flushed, which may deliver other events as
+ well.
- \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents()
+ \sa flushWindowSystemEvents(), postWindowSystemEvent(), handleWindowSystemEvent()
*/
-bool QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev)
+bool QWindowSystemInterfacePrivate::processWindowSystemEvent(WindowSystemEvent *ev)
{
bool accepted = true;
- if (synchronousWindowSystemEvents) {
- if (QThread::currentThread() == QGuiApplication::instance()->thread()) {
- // Process the event immediately on the current thread and return the accepted state.
- QGuiApplicationPrivate::processWindowSystemEvent(ev);
- accepted = ev->eventAccepted;
- delete ev;
- } else {
- // Post the event on the Qt main thread queue and flush the queue.
- // This will wake up the Gui thread which will process the event.
- // Return the accepted state for the last event on the queue,
- // which is the event posted by this function.
- postWindowSystemEvent(ev);
- accepted = QWindowSystemInterface::flushWindowSystemEvents();
- }
+ if (QThread::currentThread() == QGuiApplication::instance()->thread()) {
+ // Process the event immediately on the current thread and return the accepted state.
+ QGuiApplicationPrivate::processWindowSystemEvent(ev);
+ accepted = ev->eventAccepted;
+ delete ev;
} else {
+ // Post the event on the Qt main thread queue and flush the queue.
+ // This will wake up the Gui thread which will process the event.
+ // Return the accepted state for the last event on the queue,
+ // which is the event posted by this function.
postWindowSystemEvent(ev);
+ accepted = QWindowSystemInterface::flushWindowSystemEvents();
}
return accepted;
}
@@ -453,13 +502,6 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)
return QTouchDevicePrivate::isRegistered(device);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
- const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
-{
- unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchEvent(w, time, device, points, mods);
-}
-
QList<QTouchEvent::TouchPoint>
QWindowSystemInterfacePrivate::fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
const QWindow *window,
@@ -530,7 +572,14 @@ QList<QWindowSystemInterface::TouchPoint>
return newList;
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTouchDevice *device,
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *w, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
+{
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleTouchEvent<Delivery>(w, time, device, points, mods);
+}
+
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *tlw, ulong timestamp, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
if (!points.size()) // Touch events must have at least one point
@@ -544,7 +593,7 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTo
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, QTouchDevice *device,
@@ -634,7 +683,7 @@ bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl
// deferredFlushWindowSystemEvents from the Gui thread.
QMutexLocker locker(&QWindowSystemInterfacePrivate::flushEventMutex);
QWindowSystemInterfacePrivate::FlushEventsEvent *e = new QWindowSystemInterfacePrivate::FlushEventsEvent(flags);
- QWindowSystemInterfacePrivate::postWindowSystemEvent(e);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<SynchronousDelivery>(e);
QWindowSystemInterfacePrivate::eventsFlushed.wait(&QWindowSystemInterfacePrivate::flushEventMutex);
} else {
sendWindowSystemEvents(flags);
@@ -872,20 +921,13 @@ Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QWindowSystemInterface::TouchPo
Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp)
{
- bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
- QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
const qreal factor = QHighDpiScaling::factor(w);
- QWindowSystemInterface::handleMouseEvent(w, timestamp, local * factor,
- global * factor, b, mods);
- QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
+ QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(w, timestamp, local * factor, global * factor, b, mods);
}
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
{
- bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
- QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- QWindowSystemInterface::handleKeyEvent(w, t, k, mods, text, autorep, count);
- QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
+ QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(w, t, k, mods, text, autorep, count);
}
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
@@ -940,11 +982,8 @@ Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)
{
- bool wasSynchronous = QWindowSystemInterfacePrivate::synchronousWindowSystemEvents;
- QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- QWindowSystemInterface::handleTouchEvent(w, device,
- QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods);
- QWindowSystemInterface::setSynchronousWindowSystemEvents(wasSynchronous);
+ QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(w, device,
+ QWindowSystemInterfacePrivate::toNativeTouchPoints(points, w), mods);
}
QWindowSystemEventHandler::~QWindowSystemEventHandler()
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index e7e47ac6d9..6fade3cc4c 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -72,9 +72,15 @@ class QPlatformDropQtResponse;
class Q_GUI_EXPORT QWindowSystemInterface
{
public:
+ struct SynchronousDelivery {};
+ struct AsynchronousDelivery {};
+ struct DefaultDelivery {};
+
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
@@ -88,7 +94,9 @@ public:
static bool handleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode,
quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static bool handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static bool handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
static bool handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers,
@@ -135,8 +143,11 @@ public:
static void registerTouchDevice(const QTouchDevice *device);
static void unregisterTouchDevice(const QTouchDevice *device);
static bool isTouchDeviceRegistered(const QTouchDevice *device);
+
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
@@ -145,7 +156,10 @@ public:
// rect is relative to parent
static void handleGeometryChange(QWindow *w, const QRect &newRect, const QRect &oldRect = QRect());
static void handleCloseEvent(QWindow *w, bool *accepted = Q_NULLPTR);
+
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleEnterEvent(QWindow *w, const QPointF &local = QPointF(), const QPointF& global = QPointF());
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleLeaveEvent(QWindow *w);
static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local = QPointF(), const QPointF& global = QPointF());
static void handleWindowActivated(QWindow *w, Qt::FocusReason r = Qt::OtherFocusReason);
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index f471e1f550..7c9b1f2852 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -491,9 +491,14 @@ public:
static WindowSystemEvent *getNonUserInputWindowSystemEvent();
static WindowSystemEvent *peekWindowSystemEvent(EventType t);
static void removeWindowSystemEvent(WindowSystemEvent *event);
- static void postWindowSystemEvent(WindowSystemEvent *ev);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static bool handleWindowSystemEvent(WindowSystemEvent *ev);
+private:
+ static void postWindowSystemEvent(WindowSystemEvent *ev);
+ static bool processWindowSystemEvent(WindowSystemEvent *ev);
+
+public:
static QElapsedTimer eventTime;
static bool synchronousWindowSystemEvents;
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index ceaad61e13..53349dcef4 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -112,6 +112,8 @@ void QBackingStore::flush(const QRegion &region, QWindow *win, const QPoint &off
}
#endif
+ Q_ASSERT(win == this->window() || this->window()->isAncestorOf(win, QWindow::ExcludeTransients));
+
d_ptr->platformBackingStore->flush(win, QHighDpi::toNativeLocalRegion(region, win),
QHighDpi::toNativeLocalPosition(offset, win));
}
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 05790c4504..e3dbf663e1 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -131,6 +131,7 @@ static bool get_hex_rgb(const QChar *str, int len, QRgb *rgb)
char tmp[16];
for (int i = 0; i < len; ++i)
tmp[i] = str[i].toLatin1();
+ tmp[len] = 0;
return get_hex_rgb(tmp, len, rgb);
}
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index eda1ac89c7..22fcbcb2a8 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -73,7 +73,7 @@ public:
QColor(QRgb rgb) Q_DECL_NOTHROW;
QColor(QRgba64 rgba64) Q_DECL_NOTHROW;
inline QColor(const QString& name);
- QColor(const char *aname) : QColor(QLatin1String(aname)) {}
+ inline QColor(const char *aname) : QColor(QLatin1String(aname)) {}
inline QColor(QLatin1String name);
QColor(Spec spec) Q_DECL_NOTHROW;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 3e01d34cb2..928a56fd2f 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -603,7 +603,7 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *
buffer += 2;
}
- for (; i < count; ++i) {
+ SIMD_EPILOGUE(i, count, 3) {
uint s = *src++;
if (RGBA)
s = RGBA2ARGB(s);
@@ -766,7 +766,7 @@ static inline void qConvertA2RGB30PMToARGB64PM_sse2(QRgba64 *buffer, const uint
buffer += 2;
}
- for (; i < count; ++i)
+ SIMD_EPILOGUE(i, count, 3)
*buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++);
}
#endif
@@ -1397,7 +1397,7 @@ static inline void qConvertARGB64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *b
}
}
- for (; i < count; ++i)
+ SIMD_EPILOGUE(i, count, 15)
*dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++);
}
#endif
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index 01ffd54918..acc9bc7ba1 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -201,7 +201,7 @@ inline static void BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_AVX2(quint32 *dst,
_mm256_store_si256((__m256i *)&dst[x], dstVector);
}
}
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 7)
blend_pixel(dst[x], src[x], const_alpha);
}
@@ -267,7 +267,7 @@ void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
// 2) interpolate pixels with AVX2
for (; x < (w - 7); x += 8) {
const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
- if (!_mm256_testc_si256(srcVector, _mm256_setzero_si256())) {
+ if (!_mm256_testz_si256(srcVector, srcVector)) {
__m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
_mm256_store_si256((__m256i *)&dst[x], dstVector);
@@ -275,7 +275,7 @@ void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
}
// 3) Epilogue
- for (; x < w; ++x)
+ SIMD_EPILOGUE(x, w, 7)
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
srcPixels += sbpl;
@@ -322,7 +322,7 @@ void QT_FASTCALL comp_func_Source_avx2(uint *dst, const uint *src, int length, u
}
// 3) Epilogue
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 7)
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
}
}
@@ -353,7 +353,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_avx2(uint *destPixels, int length, u
dstVector = _mm256_add_epi8(colorVector, dstVector);
_mm256_store_si256((__m256i *)&dst[x], dstVector);
}
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 7)
destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
}
}
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index f5b794ace6..d51b43961c 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -817,7 +817,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, u
vst1q_u32(&dst[x], colorPlusBlendedPixels);
}
- for (;x < length; ++x)
+ SIMD_EPILOGUE(x, length, 3)
destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
}
}
@@ -869,7 +869,7 @@ void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uin
vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high));
}
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 3)
dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
}
}
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 03abeed440..5ff08e8153 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -126,9 +126,8 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
_mm_store_si128((__m128i *)&dst[x], result);
}
}
- for (; x<w; ++x) {
+ SIMD_EPILOGUE(x, w, 3)
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
- }
dst = (quint32 *)(((uchar *) dst) + dbpl);
src = (const quint32 *)(((const uchar *) src) + sbpl);
}
@@ -177,7 +176,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin
}
// 3) Epilogue:
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 3)
dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
} else {
const int one_minus_const_alpha = 255 - const_alpha;
@@ -201,7 +200,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin
}
// 3) Epilogue:
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 3)
dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
}
}
@@ -232,7 +231,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u
}
// 3) Epilogue
- for (; x < length; ++x)
+ SIMD_EPILOGUE(x, length, 3)
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
}
}
@@ -313,7 +312,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u
dstVector = _mm_add_epi8(colorVector, dstVector);
_mm_store_si128((__m128i *)&dst[x], dstVector);
}
- for (;x < length; ++x)
+ SIMD_EPILOGUE(x, length, 3)
destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
}
}
@@ -592,7 +591,7 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask);
}
- for (; x<w; x++) {
+ SIMD_EPILOGUE(x, w, 3) {
uint s = src[(basex + x*ix) >> 16];
dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
}
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 2026a4e656..45ecc8b422 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -215,7 +215,7 @@ static inline void store_uint24_ssse3(uchar *dst, const uint *src, int len)
dst24 = reinterpret_cast<quint24*>(dstVectorPtr);
src = reinterpret_cast<const uint*>(inVectorPtr);
- for (; i < len; ++i)
+ SIMD_EPILOGUE(i, len, 15)
*dst24++ = quint24(*src++);
}
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index 7affc63b32..93e4b9f572 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -178,7 +178,7 @@ QT_BEGIN_NAMESPACE
const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); \
BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask) \
} \
- for (; x < length; ++x) { \
+ SIMD_EPILOGUE(x, length, 3) { \
blend_pixel(dst[x], src[x]); \
} \
}
@@ -219,7 +219,7 @@ QT_BEGIN_NAMESPACE
_mm_store_si128((__m128i *)&dst[x], result); \
} \
} \
- for (; x < length; ++x) { \
+ SIMD_EPILOGUE(x, length, 3) { \
blend_pixel(dst[x], src[x], const_alpha); \
} \
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 62941b6cac..d6af6d21a2 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -781,8 +781,14 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
FT_Select_Size(face, i);
if (face->size->metrics.ascender + face->size->metrics.descender > 0) {
+ FT_Pos leading = metrics.height - metrics.ascender + metrics.descender;
metrics.ascender = face->size->metrics.ascender;
metrics.descender = face->size->metrics.descender;
+ if (metrics.descender > 0
+ && QString::fromUtf8(face->family_name) == QLatin1String("Courier New")) {
+ metrics.descender *= -1;
+ }
+ metrics.height = metrics.ascender - metrics.descender + leading;
}
FT_Set_Char_Size(face, xsize, ysize, 0, 0);
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index a10071490e..dbc2e6e558 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -622,6 +622,8 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
if (textWidth >= 0.0)
line.setLineWidth(textWidth);
+ else
+ line.setLineWidth(QFIXED_MAX);
height += leading;
line.setPosition(QPointF(0.0, height));
height += line.height();
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 5dbeccff7f..742b01dd1f 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2067,6 +2067,9 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
font = font.resolve(fnt);
}
engine = font.d->engineForScript(script);
+ if (engine)
+ engine->ref.ref();
+
QTextCharFormat::VerticalAlignment valign = f.verticalAlignment();
if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
if (font.pointSize() != -1)
@@ -2074,16 +2077,14 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
else
font.setPixelSize((font.pixelSize() * 2) / 3);
scaledEngine = font.d->engineForScript(script);
+ if (scaledEngine)
+ scaledEngine->ref.ref();
}
- if (engine)
- engine->ref.ref();
if (feCache.prevFontEngine)
releaseCachedFontEngine(feCache.prevFontEngine);
feCache.prevFontEngine = engine;
- if (scaledEngine)
- scaledEngine->ref.ref();
if (feCache.prevScaledFontEngine)
releaseCachedFontEngine(feCache.prevScaledFontEngine);
feCache.prevScaledFontEngine = scaledEngine;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 8e5cfd9497..6f837de27f 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -674,8 +674,7 @@ bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket)
HttpMessagePair messagePair = highPriorityQueue.takeLast();
if (!messagePair.second->d_func()->requestIsPrepared)
prepareRequest(messagePair);
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
+ updateChannel(i, messagePair);
return true;
}
@@ -684,13 +683,21 @@ bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket)
HttpMessagePair messagePair = lowPriorityQueue.takeLast();
if (!messagePair.second->d_func()->requestIsPrepared)
prepareRequest(messagePair);
- channels[i].request = messagePair.first;
- channels[i].reply = messagePair.second;
+ updateChannel(i, messagePair);
return true;
}
return false;
}
+void QHttpNetworkConnectionPrivate::updateChannel(int i, const HttpMessagePair &messagePair)
+{
+ channels[i].request = messagePair.first;
+ channels[i].reply = messagePair.second;
+ // Now that reply is assigned a channel, correct reply to channel association
+ // previously set in queueRequest.
+ channels[i].reply->d_func()->connectionChannel = &channels[i];
+}
+
QHttpNetworkRequest QHttpNetworkConnectionPrivate::predictNextRequest() const
{
if (!highPriorityQueue.isEmpty())
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index cad0ab1ac4..430c715717 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -210,6 +210,7 @@ public:
void requeueRequest(const HttpMessagePair &pair); // e.g. after pipeline broke
bool dequeueRequest(QAbstractSocket *socket);
void prepareRequest(HttpMessagePair &request);
+ void updateChannel(int i, const HttpMessagePair &messagePair);
QHttpNetworkRequest predictNextRequest() const;
void fillPipeline(QAbstractSocket *socket);
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index b6a9b80511..205490b830 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -1111,6 +1111,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
connection->d_func()->dequeueRequest(socket);
if (reply) {
reply->setSpdyWasUsed(false);
+ Q_ASSERT(reply->d_func()->connectionChannel == this);
emit reply->encrypted();
}
if (reply)
@@ -1137,8 +1138,6 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
connection->d_func()->pauseConnection();
if (pendingEncrypt && !reply)
connection->d_func()->dequeueRequest(socket);
- if (reply) // a reply was actually dequeued.
- reply->d_func()->connectionChannel = this; // set correct channel like in sendRequest() and queueRequest();
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP) {
if (reply)
emit reply->sslErrors(errors);
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp
index 429b71eb21..0540cb740f 100644
--- a/src/network/access/qnetworkcookiejar.cpp
+++ b/src/network/access/qnetworkcookiejar.cpp
@@ -335,11 +335,20 @@ bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl
if (!isParentDomain(domain, host) && !isParentDomain(host, domain))
return false; // not accepted
+ if (domain.startsWith(QLatin1Char('.')))
+ domain = domain.mid(1);
+
+#if QT_CONFIG(topleveldomain)
// the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2
// redundant; the "leading dot" rule has been relaxed anyway, see QNetworkCookie::normalize()
// we remove the leading dot for this check if it's present
- if (qIsEffectiveTLD(domain.startsWith('.') ? domain.remove(0, 1) : domain))
+ if (qIsEffectiveTLD(domain))
return false; // not accepted
+#else
+ // provide minimal checking by not accepting cookies on real TLDs
+ if (!domain.contains(QLatin1Char('.')))
+ return false;
+#endif
return true;
}
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 76a2d2df9f..c13a472b90 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -104,7 +104,7 @@ static bool isHostExcluded(CFDictionaryRef dict, const QString &host)
CFIndex size = CFArrayGetCount(exclusionList);
for (CFIndex i = 0; i < size; ++i) {
CFStringRef cfentry = (CFStringRef)CFArrayGetValueAtIndex(exclusionList, i);
- QString entry = QCFString::toQString(cfentry);
+ QString entry = QString::fromCFString(cfentry);
if (isIpAddress && ipAddress.isInSubnet(QHostAddress::parseSubnet(entry))) {
return true; // excluded
@@ -133,7 +133,7 @@ static QNetworkProxy proxyFromDictionary(CFDictionaryRef dict, QNetworkProxy::Pr
&& (protoPort = (CFNumberRef)CFDictionaryGetValue(dict, portKey))) {
int enabled;
if (CFNumberGetValue(protoEnabled, kCFNumberIntType, &enabled) && enabled) {
- QString host = QCFString::toQString(protoHost);
+ QString host = QString::fromCFString(protoHost);
int port;
CFNumberGetValue(protoPort, kCFNumberIntType, &port);
@@ -168,9 +168,9 @@ static QNetworkProxy proxyFromDictionary(CFDictionaryRef dict)
proxyType = QNetworkProxy::Socks5Proxy;
}
- hostName = QCFString::toQString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyHostNameKey));
- user = QCFString::toQString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyUsernameKey));
- password = QCFString::toQString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyPasswordKey));
+ hostName = QString::fromCFString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyHostNameKey));
+ user = QString::fromCFString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyUsernameKey));
+ password = QString::fromCFString((CFStringRef)CFDictionaryGetValue(dict, kCFProxyPasswordKey));
CFNumberRef portNumber = (CFNumberRef)CFDictionaryGetValue(dict, kCFProxyPortNumberKey);
if (portNumber) {
@@ -229,7 +229,7 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
QCFType<CFDataRef> pacData;
QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
if (!pacUrl) {
- qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
+ qWarning("Invalid PAC URL \"%s\"", qPrintable(QString::fromCFString(cfPacLocation)));
return result;
}
@@ -259,9 +259,9 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
CFRunLoopRunInMode(pacRunLoopMode, 1000, /*returnAfterSourceHandled*/ true);
if (!pacInfo.proxies) {
- QString pacLocation = QCFString::toQString(cfPacLocation);
+ QString pacLocation = QString::fromCFString(cfPacLocation);
QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacInfo.error);
- qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
+ qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QString::fromCFString(pacErrorDescription)));
return result;
}
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 6b71912838..bd9b443602 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -84,6 +84,69 @@ typedef IAsyncOperationWithProgress<IBuffer *, UINT32> IAsyncBufferOperation;
QT_BEGIN_NAMESPACE
+static inline QString qt_QStringFromHString(const HString &string)
+{
+ UINT32 length;
+ PCWSTR rawString = string.GetRawBuffer(&length);
+ return QString::fromWCharArray(rawString, length);
+}
+
+class SocketEngineWorker : public QObject
+{
+ Q_OBJECT
+signals:
+ void newDatagramsReceived(const QList<WinRtDatagram> &datagram);
+
+public slots:
+ Q_INVOKABLE void notifyAboutNewDatagrams()
+ {
+ QMutexLocker locker(&mutex);
+ QList<WinRtDatagram> datagrams = pendingDatagrams;
+ pendingDatagrams.clear();
+ emit newDatagramsReceived(datagrams);
+ }
+
+public:
+ HRESULT OnNewDatagramReceived(IDatagramSocket *, IDatagramSocketMessageReceivedEventArgs *args)
+ {
+ WinRtDatagram datagram;
+ QHostAddress returnAddress;
+ ComPtr<IHostName> remoteHost;
+ HRESULT hr = args->get_RemoteAddress(&remoteHost);
+ RETURN_OK_IF_FAILED("Could not obtain remote host");
+ HString remoteHostString;
+ hr = remoteHost->get_CanonicalName(remoteHostString.GetAddressOf());
+ RETURN_OK_IF_FAILED("Could not obtain remote host's canonical name");
+ returnAddress.setAddress(qt_QStringFromHString(remoteHostString));
+ datagram.header.senderAddress = returnAddress;
+ HString remotePort;
+ hr = args->get_RemotePort(remotePort.GetAddressOf());
+ RETURN_OK_IF_FAILED("Could not obtain remote port");
+ datagram.header.senderPort = qt_QStringFromHString(remotePort).toInt();
+
+ ComPtr<IDataReader> reader;
+ hr = args->GetDataReader(&reader);
+ RETURN_OK_IF_FAILED("Could not obtain data reader");
+ quint32 length;
+ hr = reader->get_UnconsumedBufferLength(&length);
+ RETURN_OK_IF_FAILED("Could not obtain unconsumed buffer length");
+ datagram.data.resize(length);
+ hr = reader->ReadBytes(length, reinterpret_cast<BYTE *>(datagram.data.data()));
+ RETURN_OK_IF_FAILED("Could not read datagram");
+ QMutexLocker locker(&mutex);
+ // Notify the engine about new datagrams being present at the next event loop iteration
+ if (pendingDatagrams.isEmpty())
+ QMetaObject::invokeMethod(this, "notifyAboutNewDatagrams", Qt::QueuedConnection);
+ pendingDatagrams << datagram;
+
+ return S_OK;
+ }
+
+private:
+ QList<WinRtDatagram> pendingDatagrams;
+ QMutex mutex;
+};
+
static QByteArray socketDescription(const QAbstractSocketEngine *s)
{
QByteArray result;
@@ -159,13 +222,6 @@ struct SocketGlobal
};
Q_GLOBAL_STATIC(SocketGlobal, g)
-static inline QString qt_QStringFromHString(const HString &string)
-{
- UINT32 length;
- PCWSTR rawString = string.GetRawBuffer(&length);
- return QString::fromWCharArray(rawString, length);
-}
-
#define READ_BUFFER_SIZE 65536
template <typename T>
@@ -206,6 +262,7 @@ static qint64 writeIOStream(ComPtr<IOutputStream> stream, const char *data, qint
QNativeSocketEngine::QNativeSocketEngine(QObject *parent)
: QAbstractSocketEngine(*new QNativeSocketEnginePrivate(), parent)
{
+ qRegisterMetaType<WinRtDatagram>();
#ifndef QT_NO_SSL
Q_D(QNativeSocketEngine);
if (parent)
@@ -215,6 +272,7 @@ QNativeSocketEngine::QNativeSocketEngine(QObject *parent)
connect(this, SIGNAL(connectionReady()), SLOT(connectionNotification()), Qt::QueuedConnection);
connect(this, SIGNAL(readReady()), SLOT(readNotification()), Qt::QueuedConnection);
connect(this, SIGNAL(writeReady()), SLOT(writeNotification()), Qt::QueuedConnection);
+ connect(d->worker, &SocketEngineWorker::newDatagramsReceived, this, &QNativeSocketEngine::handleNewDatagrams, Qt::QueuedConnection);
}
QNativeSocketEngine::~QNativeSocketEngine()
@@ -585,7 +643,7 @@ qint64 QNativeSocketEngine::bytesAvailable() const
if (d->socketType != QAbstractSocket::TcpSocket)
return -1;
- return d->readBytes.size() - d->readBytes.pos();
+ return d->bytesAvailable;
}
qint64 QNativeSocketEngine::read(char *data, qint64 maxlen)
@@ -603,7 +661,9 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxlen)
}
QMutexLocker mutexLocker(&d->readMutex);
- return d->readBytes.read(data, maxlen);
+ qint64 b = d->readBytes.read(data, maxlen);
+ d->bytesAvailable = d->readBytes.size() - d->readBytes.pos();
+ return b;
}
qint64 QNativeSocketEngine::write(const char *data, qint64 len)
@@ -634,6 +694,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
{
#ifndef QT_NO_UDPSOCKET
Q_D(QNativeSocketEngine);
+ d->readMutex.lock();
if (d->socketType != QAbstractSocket::UdpSocket || d->pendingDatagrams.isEmpty()) {
if (header)
header->clear();
@@ -653,6 +714,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
} else {
readOrigin = datagram.data;
}
+ d->readMutex.unlock();
memcpy(data, readOrigin, qMin(maxlen, qint64(datagram.data.length())));
return readOrigin.length();
#else
@@ -880,6 +942,24 @@ void QNativeSocketEngine::establishRead()
Q_ASSERT_SUCCEEDED(hr);
}
+void QNativeSocketEngine::handleNewDatagrams(const QList<WinRtDatagram> &datagrams)
+{
+ Q_D(QNativeSocketEngine);
+ // Defer putting the datagrams into the list until the next event loop iteration
+ // (where the readyRead signal is emitted as well)
+ QMetaObject::invokeMethod(this, "putIntoPendingDatagramsList", Qt::QueuedConnection,
+ Q_ARG(QList<WinRtDatagram>, datagrams));
+ if (d->notifyOnRead)
+ emit readReady();
+}
+
+void QNativeSocketEngine::putIntoPendingDatagramsList(const QList<WinRtDatagram> &datagrams)
+{
+ Q_D(QNativeSocketEngine);
+ QMutexLocker locker(&d->readMutex);
+ d->pendingDatagrams.append(datagrams);
+}
+
bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol)
{
Q_UNUSED(socketProtocol);
@@ -899,8 +979,11 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
RETURN_FALSE_IF_FAILED("createNewSocket: Could not create socket instance");
socketDescriptor = qintptr(socket.Detach());
QEventDispatcherWinRT::runOnXamlThread([&hr, this]() {
- hr = udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(this, &QNativeSocketEnginePrivate::handleNewDatagram).Get(), &connectionToken);
- RETURN_OK_IF_FAILED("createNewSocket: Could not add \"message received\" callback")
+ hr = udpSocket()->add_MessageReceived(Callback<DatagramReceivedHandler>(worker, &SocketEngineWorker::OnNewDatagramReceived).Get(), &connectionToken);
+ if (FAILED(hr)) {
+ qErrnoWarning(hr, "createNewSocket: Could not add \"message received\" callback");
+ return hr;
+ }
return S_OK;
});
if (FAILED(hr))
@@ -931,6 +1014,7 @@ QNativeSocketEnginePrivate::QNativeSocketEnginePrivate()
, notifyOnException(false)
, closingDown(false)
, socketDescriptor(-1)
+ , worker(new SocketEngineWorker)
, sslSocket(Q_NULLPTR)
, connectionToken( { -1 } )
{
@@ -947,6 +1031,8 @@ QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate()
else if (socketType == QAbstractSocket::TcpSocket)
hr = tcpListener->remove_ConnectionReceived(connectionToken);
Q_ASSERT_SUCCEEDED(hr);
+
+ worker->deleteLater();
}
void QNativeSocketEnginePrivate::setError(QAbstractSocket::SocketError error, ErrorString errorString) const
@@ -1372,6 +1458,7 @@ HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *async
Q_ASSERT(readBytes.atEnd());
readBytes.write(reinterpret_cast<const char*>(data), qint64(bufferLength));
readBytes.seek(readPos);
+ bytesAvailable = readBytes.size() - readBytes.pos();
readMutex.unlock();
if (notifyOnRead)
@@ -1436,11 +1523,11 @@ HRESULT QNativeSocketEnginePrivate::handleNewDatagram(IDatagramSocket *socket, I
datagram.data.resize(length);
hr = reader->ReadBytes(length, reinterpret_cast<BYTE *>(datagram.data.data()));
RETURN_OK_IF_FAILED("Could not read datagram");
- pendingDatagrams.append(datagram);
- if (notifyOnRead)
- emit q->readReady();
+ emit q->newDatagramReceived(datagram);
return S_OK;
}
QT_END_NAMESPACE
+
+#include "qnativesocketengine_winrt.moc"
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index ef219e61df..605f3631b9 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -55,6 +55,7 @@
#include <QtCore/QEventLoop>
#include <QtCore/QBuffer>
#include <QtCore/QMutex>
+#include <QtCore/QAtomicInteger>
#include "QtNetwork/qhostaddress.h"
#include "private/qabstractsocketengine_p.h"
#include <wrl.h>
@@ -63,6 +64,7 @@
QT_BEGIN_NAMESPACE
class QNativeSocketEnginePrivate;
+class SocketEngineWorker;
struct WinRtDatagram {
QByteArray data;
@@ -137,11 +139,15 @@ signals:
void connectionReady();
void readReady();
void writeReady();
+ void newDatagramReceived(const WinRtDatagram &datagram);
private slots:
void establishRead();
+ void handleNewDatagrams(const QList<WinRtDatagram> &datagram);
private:
+ Q_INVOKABLE void putIntoPendingDatagramsList(const QList<WinRtDatagram> &datagrams);
+
Q_DECLARE_PRIVATE(QNativeSocketEngine)
Q_DISABLE_COPY(QNativeSocketEngine)
};
@@ -154,6 +160,7 @@ public:
~QNativeSocketEnginePrivate();
qintptr socketDescriptor;
+ SocketEngineWorker *worker;
bool notifyOnRead, notifyOnWrite, notifyOnException;
QAtomicInt closingDown;
@@ -210,6 +217,8 @@ private:
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32>> readOp;
QBuffer readBytes;
QMutex readMutex;
+ bool emitOnNewDatagram;
+ QAtomicInteger<int> bytesAvailable;
QList<WinRtDatagram> pendingDatagrams;
QList<ABI::Windows::Networking::Sockets::IStreamSocket *> pendingConnections;
@@ -228,4 +237,6 @@ private:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(WinRtDatagram)
+
#endif // QNATIVESOCKETENGINE_WINRT_P_H
diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
index 63097c33c1..911f0c884d 100644
--- a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
+++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
@@ -3,4 +3,4 @@ HEADERS += $$PWD/qfontconfigdatabase_p.h \
SOURCES += $$PWD/qfontconfigdatabase.cpp \
$$PWD/qfontenginemultifontconfig.cpp
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_FONTCONFIG
+QMAKE_USE += fontconfig/nolink
diff --git a/src/platformsupport/fontdatabases/fontdatabases.pri b/src/platformsupport/fontdatabases/fontdatabases.pri
index 1ea7f42204..d435359141 100644
--- a/src/platformsupport/fontdatabases/fontdatabases.pri
+++ b/src/platformsupport/fontdatabases/fontdatabases.pri
@@ -1,14 +1,14 @@
darwin {
include($$PWD/mac/coretext.pri)
} else {
- !win32|qtConfig(freetype) {
+ qtConfig(freetype) {
include($$PWD/basic/basic.pri)
}
unix {
CONFIG += qpa/genericunixfontdatabase
include($$PWD/genericunix/genericunix.pri)
- contains(QT_CONFIG,fontconfig) {
+ qtConfig(fontconfig) {
include($$PWD/fontconfig/fontconfig.pri)
}
}
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 16d65caf86..78a0c4d0c9 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -206,7 +206,7 @@ void QCoreTextFontDatabase::populateFontDatabase()
const int numberOfFamilies = CFArrayGetCount(familyNames);
for (int i = 0; i < numberOfFamilies; ++i) {
CFStringRef familyNameRef = (CFStringRef) CFArrayGetValueAtIndex(familyNames, i);
- QString familyName = QCFString::toQString(familyNameRef);
+ QString familyName = QString::fromCFString(familyNameRef);
// Don't populate internal fonts
if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort"))
@@ -505,9 +505,9 @@ static QString familyNameFromPostScriptName(NSString *psName)
{
QCFType<CTFontDescriptorRef> fontDescriptor = (CTFontDescriptorRef) CTFontDescriptorCreateWithNameAndSize((CFStringRef)psName, 12.0);
QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute);
- QString name = QCFString::toQString(familyName);
+ QString name = QString::fromCFString(familyName);
if (name.isEmpty())
- qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QCFString::toQString((CFStringRef)psName);
+ qWarning() << "QCoreTextFontDatabase: Failed to resolve family name for PostScript name " << QString::fromCFString((CFStringRef)psName);
return name;
}
@@ -537,7 +537,7 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
for (int i = 0; i < numCascades; ++i) {
CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
- fallbackList.append(QCFString::toQString(fallbackFamilyName));
+ fallbackList.append(QString::fromCFString(fallbackFamilyName));
}
#if defined(Q_OS_OSX)
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 0bc0416eec..7a06d5f1c9 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -213,7 +213,7 @@ void QCoreTextFontEngine::init()
face_id.index = 0;
QCFString name = CTFontCopyName(ctfont, kCTFontUniqueNameKey);
- face_id.filename = QCFString::toQString(name).toUtf8();
+ face_id.filename = QString::fromCFString(name).toUtf8();
QCFString family = CTFontCopyFamilyName(ctfont);
fontDef.family = family;
@@ -826,8 +826,8 @@ QFontEngine::Properties QCoreTextFontEngine::properties() const
QCFString psName, copyright;
psName = CTFontCopyPostScriptName(ctfont);
copyright = CTFontCopyName(ctfont, kCTFontCopyrightNameKey);
- result.postscriptName = QCFString::toQString(psName).toUtf8();
- result.copyright = QCFString::toQString(copyright).toUtf8();
+ result.postscriptName = QString::fromCFString(psName).toUtf8();
+ result.copyright = QString::fromCFString(copyright).toUtf8();
qreal emSquare = CTFontGetUnitsPerEm(ctfont);
qreal scale = emSquare / CTFontGetSize(ctfont);
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index 3b583ec99d..bdeac8db7e 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -96,7 +96,7 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
void QLibInputPointer::processAxis(libinput_event_pointer *e)
{
-#if QT_LIBRARY_VERSION(libinput) < QT_VERSION_CHECK(0, 8, 0)
+#if !QT_CONFIG(libinput_axis_api)
const double v = libinput_event_pointer_get_axis_value(e) * 120;
const Qt::Orientation ori = libinput_event_pointer_get_axis(e) == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL
? Qt::Vertical : Qt::Horizontal;
diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
index a3c2ecc084..3e2248a018 100644
--- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp
+++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp
@@ -49,7 +49,7 @@
#include "bus_interface.h"
#include <QtGui/qguiapplication.h>
-#include <qplatformnativeinterface.h>
+#include <qpa/qplatformnativeinterface.h>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro
index 19efa60f48..f9b57acaa8 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -22,13 +22,6 @@ include(linuxaccessibility/linuxaccessibility.pri)
include(clipboard/clipboard.pri)
include(platformcompositor/platformcompositor.pri)
-# dbus convenience for unix except darwin: the platform
-# plugins for these platforms do not use dbus and we
-# don't want to create a false dependency.
-unix:!darwin:qtConfig(dbus) {
- include(dbusmenu/dbusmenu.pri)
- include(dbustray/dbustray.pri)
-}
darwin: include(graphics/graphics.pri)
load(qt_module)
diff --git a/src/platformsupport/dbusmenu/dbusmenu.pri b/src/platformsupport/themes/genericunix/dbusmenu/dbusmenu.pri
index 2d0feca1a2..662ebfdae6 100644
--- a/src/platformsupport/dbusmenu/dbusmenu.pri
+++ b/src/platformsupport/themes/genericunix/dbusmenu/dbusmenu.pri
@@ -1,6 +1,6 @@
QT_FOR_PRIVATE += dbus
-INCLUDEPATH += $$PWD $$PWD/../../gui/kernel
+INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qdbusmenuadaptor_p.h \
diff --git a/src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp
index 354b9c3a2e..354b9c3a2e 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuadaptor.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp
diff --git a/src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor_p.h
index 6612f019a7..6612f019a7 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuadaptor_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor_p.h
diff --git a/src/platformsupport/dbusmenu/qdbusmenubar.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp
index 76d658f51a..76d658f51a 100644
--- a/src/platformsupport/dbusmenu/qdbusmenubar.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar.cpp
diff --git a/src/platformsupport/dbusmenu/qdbusmenubar_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h
index 8266a395f5..8266a395f5 100644
--- a/src/platformsupport/dbusmenu/qdbusmenubar_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h
diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
index 361146dc23..a9d758209a 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
@@ -95,6 +95,12 @@ bool QDBusMenuConnection::registerTrayIconMenu(QDBusTrayIcon *item)
return success;
}
+void QDBusMenuConnection::unregisterTrayIconMenu(QDBusTrayIcon *item)
+{
+ if (item->menu())
+ connection().unregisterObject(MenuBarPath);
+}
+
bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)
{
bool success = connection().registerService(item->instanceId());
@@ -124,7 +130,7 @@ bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)
bool QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)
{
- connection().unregisterObject(MenuBarPath);
+ unregisterTrayIconMenu(item);
connection().unregisterObject(StatusNotifierItemPath);
bool success = connection().unregisterService(item->instanceId());
if (!success)
diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
index 84eb2a6f3a..ae0595ae3b 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuconnection_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
@@ -72,6 +72,7 @@ public:
bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; }
#ifndef QT_NO_SYSTEMTRAYICON
bool registerTrayIconMenu(QDBusTrayIcon *item);
+ void unregisterTrayIconMenu(QDBusTrayIcon *item);
bool registerTrayIcon(QDBusTrayIcon *item);
bool unregisterTrayIcon(QDBusTrayIcon *item);
#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/platformsupport/dbusmenu/qdbusmenuregistrarproxy.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuregistrarproxy.cpp
index c59b5a675e..c59b5a675e 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuregistrarproxy.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuregistrarproxy.cpp
diff --git a/src/platformsupport/dbusmenu/qdbusmenuregistrarproxy_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuregistrarproxy_p.h
index c92de0a140..c92de0a140 100644
--- a/src/platformsupport/dbusmenu/qdbusmenuregistrarproxy_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuregistrarproxy_p.h
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp
index 82a13d2fa0..82a13d2fa0 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp
diff --git a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes_p.h
index fd6727d3be..fd6727d3be 100644
--- a/src/platformsupport/dbusmenu/qdbusmenutypes_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes_p.h
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp
index 15440a03cd..15440a03cd 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp
diff --git a/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
index 38c27e8051..38c27e8051 100644
--- a/src/platformsupport/dbusmenu/qdbusplatformmenu_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
diff --git a/src/platformsupport/dbustray/dbustray.pri b/src/platformsupport/themes/genericunix/dbustray/dbustray.pri
index 734ee5fb40..f703e24ba9 100644
--- a/src/platformsupport/dbustray/dbustray.pri
+++ b/src/platformsupport/themes/genericunix/dbustray/dbustray.pri
@@ -1,6 +1,6 @@
QT_FOR_PRIVATE += dbus
-INCLUDEPATH += $$PWD $$PWD/../../gui/kernel
+INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qdbustrayicon_p.h \
diff --git a/src/platformsupport/dbustray/qdbustrayicon.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
index 0369eaf144..a686a33464 100644
--- a/src/platformsupport/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
@@ -44,16 +44,16 @@
#include "qdbusmenuconnection_p.h"
#include "qstatusnotifieritemadaptor_p.h"
#include "qdbusmenuadaptor_p.h"
-#include "dbusmenu/qdbusplatformmenu_p.h"
+#include "qdbusplatformmenu_p.h"
#include "qxdgnotificationproxy_p.h"
-#include <qplatformmenu.h>
+#include <qpa/qplatformmenu.h>
#include <qstring.h>
#include <qdebug.h>
#include <qrect.h>
#include <qloggingcategory.h>
-#include <qplatformintegration.h>
-#include <qplatformservices.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformservices.h>
#include <qdbusconnectioninterface.h>
#include <private/qlockfile_p.h>
#include <private/qguiapplication_p.h>
@@ -214,20 +214,21 @@ QPlatformMenu *QDBusTrayIcon::createMenu() const
void QDBusTrayIcon::updateMenu(QPlatformMenu * menu)
{
qCDebug(qLcTray) << menu;
- bool needsRegistering = !m_menu;
- if (!m_menu)
- m_menu = qobject_cast<QDBusPlatformMenu *>(menu);
- if (!m_menuAdaptor) {
+ QDBusPlatformMenu *newMenu = qobject_cast<QDBusPlatformMenu *>(menu);
+ if (m_menu != newMenu) {
+ if (m_menu) {
+ dBusConnection()->unregisterTrayIconMenu(this);
+ delete m_menuAdaptor;
+ }
+ m_menu = newMenu;
m_menuAdaptor = new QDBusMenuAdaptor(m_menu);
// TODO connect(m_menu, , m_menuAdaptor, SIGNAL(ItemActivationRequested(int,uint)));
connect(m_menu, SIGNAL(propertiesUpdated(QDBusMenuItemList,QDBusMenuItemKeysList)),
m_menuAdaptor, SIGNAL(ItemsPropertiesUpdated(QDBusMenuItemList,QDBusMenuItemKeysList)));
connect(m_menu, SIGNAL(updated(uint,int)),
m_menuAdaptor, SIGNAL(LayoutUpdated(uint,int)));
- }
- m_menu->emitUpdated();
- if (needsRegistering)
dBusConnection()->registerTrayIconMenu(this);
+ }
}
void QDBusTrayIcon::showMessage(const QString &title, const QString &msg, const QIcon &icon,
diff --git a/src/platformsupport/dbustray/qdbustrayicon_p.h b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
index a383ef86fc..a383ef86fc 100644
--- a/src/platformsupport/dbustray/qdbustrayicon_p.h
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
diff --git a/src/platformsupport/dbustray/qdbustraytypes.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustraytypes.cpp
index fc0fa00655..fc0fa00655 100644
--- a/src/platformsupport/dbustray/qdbustraytypes.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustraytypes.cpp
diff --git a/src/platformsupport/dbustray/qdbustraytypes_p.h b/src/platformsupport/themes/genericunix/dbustray/qdbustraytypes_p.h
index 1bdc855c3c..1bdc855c3c 100644
--- a/src/platformsupport/dbustray/qdbustraytypes_p.h
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustraytypes_p.h
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp b/src/platformsupport/themes/genericunix/dbustray/qstatusnotifieritemadaptor.cpp
index d3c5454f01..d3c5454f01 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qstatusnotifieritemadaptor.cpp
diff --git a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h b/src/platformsupport/themes/genericunix/dbustray/qstatusnotifieritemadaptor_p.h
index 776e1b23ef..776e1b23ef 100644
--- a/src/platformsupport/dbustray/qstatusnotifieritemadaptor_p.h
+++ b/src/platformsupport/themes/genericunix/dbustray/qstatusnotifieritemadaptor_p.h
diff --git a/src/platformsupport/dbustray/qxdgnotificationproxy.cpp b/src/platformsupport/themes/genericunix/dbustray/qxdgnotificationproxy.cpp
index ef2aa799c8..ef2aa799c8 100644
--- a/src/platformsupport/dbustray/qxdgnotificationproxy.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qxdgnotificationproxy.cpp
diff --git a/src/platformsupport/dbustray/qxdgnotificationproxy_p.h b/src/platformsupport/themes/genericunix/dbustray/qxdgnotificationproxy_p.h
index 03899723ab..03899723ab 100644
--- a/src/platformsupport/dbustray/qxdgnotificationproxy_p.h
+++ b/src/platformsupport/themes/genericunix/dbustray/qxdgnotificationproxy_p.h
diff --git a/src/platformsupport/themes/genericunix/genericunix.pri b/src/platformsupport/themes/genericunix/genericunix.pri
index eed48257d0..27019b4aa2 100644
--- a/src/platformsupport/themes/genericunix/genericunix.pri
+++ b/src/platformsupport/themes/genericunix/genericunix.pri
@@ -1,2 +1,7 @@
HEADERS += $$PWD/qgenericunixthemes_p.h
SOURCES += $$PWD/qgenericunixthemes.cpp
+
+qtConfig(dbus) {
+ include(dbusmenu/dbusmenu.pri)
+ include(dbustray/dbustray.pri)
+}
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 296c282a47..db264d1b22 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -238,6 +238,7 @@ static QList<QSize> availableXdgFileIconSizes()
return QIcon::fromTheme(QStringLiteral("inode-directory")).availableSizes();
}
+#if QT_CONFIG(mimetype)
static QIcon xdgFileIcon(const QFileInfo &fileInfo)
{
QMimeDatabase mimeDatabase;
@@ -253,6 +254,7 @@ static QIcon xdgFileIcon(const QFileInfo &fileInfo)
const QString &genericIconName = mimeType.genericIconName();
return genericIconName.isEmpty() ? QIcon() : QIcon::fromTheme(genericIconName);
}
+#endif
#ifndef QT_NO_SETTINGS
class QKdeThemePrivate : public QPlatformThemePrivate
@@ -547,7 +549,11 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
QIcon QKdeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions) const
{
+#if QT_CONFIG(mimetype)
return xdgFileIcon(fileInfo);
+#else
+ return QIcon();
+#endif
}
const QPalette *QKdeTheme::palette(Palette type) const
@@ -708,7 +714,11 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
QIcon QGnomeTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions) const
{
+#if QT_CONFIG(mimetype)
return xdgFileIcon(fileInfo);
+#else
+ return QIcon();
+#endif
}
const QFont *QGnomeTheme::font(Font type) const
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 7ce5f28f99..7cf9365513 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -133,7 +133,7 @@ void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys,
{
for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) {
- QString changed = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(changedKeys, i));
+ QString changed = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(changedKeys, i));
if( changed.contains("/Network/Global/IPv4")) {
QCoreWlanEngine* wlanEngine = static_cast<QCoreWlanEngine*>(info);
wlanEngine->requestUpdate();
@@ -162,7 +162,7 @@ void QScanThread::run()
QMacAutoReleasePool pool;
QStringList found;
mutex.lock();
- CWInterface *currentInterface = [CWInterface interfaceWithName: QCFString::toNSString(interfaceName)];
+ CWInterface *currentInterface = [CWInterface interfaceWithName:interfaceName.toNSString()];
mutex.unlock();
const bool currentInterfaceServiceActive = currentInterface.serviceActive;
@@ -173,14 +173,14 @@ void QScanThread::run()
if (!err) {
for (CWNetwork *apNetwork in apSet) {
- const QString networkSsid = QCFString::toQString([apNetwork ssid]);
+ const QString networkSsid = QString::fromNSString([apNetwork ssid]);
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
found.append(id);
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
bool known = isKnownSsid(networkSsid);
if (currentInterfaceServiceActive) {
- if( networkSsid == QCFString::toQString( [currentInterface ssid])) {
+ if (networkSsid == QString::fromNSString([currentInterface ssid])) {
state = QNetworkConfiguration::Active;
}
}
@@ -223,7 +223,7 @@ void QScanThread::run()
}
if (currentInterfaceServiceActive) {
- if( networkSsid == QCFString::toQString([currentInterface ssid])) {
+ if (networkSsid == QString::fromNSString([currentInterface ssid])) {
state = QNetworkConfiguration::Active;
}
}
@@ -287,7 +287,7 @@ void QScanThread::getUserConfigurations()
NSSet *wifiInterfaces = [CWInterface interfaceNames];
for (NSString *ifName in wifiInterfaces) {
- CWInterface *wifiInterface = [CWInterface interfaceWithName: ifName];
+ CWInterface *wifiInterface = [CWInterface interfaceWithName:ifName];
NSString *nsInterfaceName = wifiInterface.ssid;
// add user configured system networks
@@ -299,10 +299,10 @@ void QScanThread::getUserConfigurations()
NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
for (NSString *ssidkey in thisSsidarray) {
- QString thisSsid = QCFString::toQString(ssidkey);
+ QString thisSsid = QString::fromNSString(ssidkey);
if(!userProfiles.contains(thisSsid)) {
QMap <QString,QString> map;
- map.insert(thisSsid, QCFString::toQString(nsInterfaceName));
+ map.insert(thisSsid, QString::fromNSString(nsInterfaceName));
userProfiles.insert(thisSsid, map);
}
}
@@ -315,18 +315,18 @@ void QScanThread::getUserConfigurations()
NSEnumerator *enumerator = [networkProfiles objectEnumerator];
CWNetworkProfile *wProfile;
while ((wProfile = [enumerator nextObject])) {
- QString networkName = QCFString::toQString([wProfile ssid]);
+ QString networkName = QString::fromNSString([wProfile ssid]);
if (!userProfiles.contains(networkName)) {
QMap<QString,QString> map;
- map.insert(networkName, QCFString::toQString(nsInterfaceName));
+ map.insert(networkName, QString::fromNSString(nsInterfaceName));
userProfiles.insert(networkName, map);
}
}
// 802.1X user profiles
QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
- NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile: QCFString::toNSString(userProfilePath)] autorelease];
+ NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:userProfilePath.toNSString()] autorelease];
if(eapDict != nil) {
NSString *profileStr= @"Profiles";
NSString *nameStr = @"UserDefinedName";
@@ -345,15 +345,15 @@ void QScanThread::getUserConfigurations()
QString ssid;
for (int i = 0; i < dictSize; i++) {
if([nameStr isEqualToString:keys[i]]) {
- networkName = QCFString::toQString(objects[i]);
+ networkName = QString::fromNSString(objects[i]);
}
if ([networkSsidStr isEqualToString:keys[i]]) {
- ssid = QCFString::toQString(objects[i]);
+ ssid = QString::fromNSString(objects[i]);
}
if (!userProfiles.contains(networkName)
&& !ssid.isEmpty()) {
QMap<QString,QString> map;
- map.insert(ssid, QCFString::toQString(nsInterfaceName));
+ map.insert(ssid, QString::fromNSString(nsInterfaceName));
userProfiles.insert(networkName, map);
}
}
@@ -476,7 +476,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
QString interfaceString = getInterfaceFromId(id);
CWInterface *wifiInterface =
- [CWInterface interfaceWithName: QCFString::toNSString(interfaceString)];
+ [CWInterface interfaceWithName:interfaceString.toNSString()];
if (wifiInterface.powerOn) {
NSError *err = nil;
@@ -498,7 +498,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
}
}
- NSSet *scanSet = [wifiInterface scanForNetworksWithName:QCFString::toNSString(wantedSsid) error:&err];
+ NSSet *scanSet = [wifiInterface scanForNetworksWithName:wantedSsid.toNSString() error:&err];
if(!err) {
for (CWNetwork *apNetwork in scanSet) {
@@ -533,11 +533,11 @@ void QCoreWlanEngine::connectToId(const QString &id)
return;
}
} else {
- qDebug() <<"associate ERROR"<< QCFString::toQString([err localizedDescription ]);
+ qDebug() <<"associate ERROR"<< QString::fromNSString([err localizedDescription ]);
}
} //end scan network
} else {
- qDebug() <<"scan ERROR"<< QCFString::toQString([err localizedDescription ]);
+ qDebug() <<"scan ERROR"<< QString::fromNSString([err localizedDescription ]);
}
emit connectionError(id, InterfaceLookupError);
}
@@ -559,7 +559,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
QMacAutoReleasePool pool;
CWInterface *wifiInterface =
- [CWInterface interfaceWithName: QCFString::toNSString(interfaceString)];
+ [CWInterface interfaceWithName:interfaceString.toNSString()];
disconnectedInterfaceString = interfaceString;
[wifiInterface disassociate];
@@ -574,9 +574,9 @@ void QCoreWlanEngine::checkDisconnect()
QMacAutoReleasePool pool;
CWInterface *wifiInterface =
- [CWInterface interfaceWithName: QCFString::toNSString(disconnectedInterfaceString)];
+ [CWInterface interfaceWithName:disconnectedInterfaceString.toNSString()];
- const QString networkSsid = QCFString::toQString([wifiInterface ssid]);
+ const QString networkSsid = QString::fromNSString([wifiInterface ssid]);
if (!networkSsid.isEmpty()) {
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
locker.unlock();
@@ -601,7 +601,7 @@ void QCoreWlanEngine::doRequestUpdate()
NSSet *wifiInterfaces = [CWInterface interfaceNames];
for (NSString *ifName in wifiInterfaces) {
- scanThread->interfaceName = QCFString::toQString(ifName);
+ scanThread->interfaceName = QString::fromNSString(ifName);
scanThread->start();
}
locker.unlock();
@@ -615,7 +615,7 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
bool haswifi = false;
if(hasWifi) {
QMacAutoReleasePool pool;
- CWInterface *defaultInterface = [CWInterface interfaceWithName: QCFString::toNSString(wifiDeviceName)];
+ CWInterface *defaultInterface = [CWInterface interfaceWithName:wifiDeviceName.toNSString()];
if (defaultInterface.powerOn) {
haswifi = true;
}
@@ -843,7 +843,7 @@ quint64 QCoreWlanEngine::startTime(const QString &identifier)
bool ok = false;
for(int i = 0; i < dictSize; i++) {
if([ssidStr isEqualToString:keys[i]]) {
- const QString ident = QString::number(qHash(QLatin1String("corewlan:") + QCFString::toQString(objects[i])));
+ const QString ident = QString::number(qHash(QLatin1String("corewlan:") + QString::fromNSString(objects[i])));
if(ident == identifier) {
ok = true;
}
diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro
index 17284874f6..2f53c5b416 100644
--- a/src/plugins/platforminputcontexts/compose/compose.pro
+++ b/src/plugins/platforminputcontexts/compose/compose.pro
@@ -2,8 +2,6 @@ TARGET = composeplatforminputcontextplugin
QT += core-private gui-private
-DEFINES += X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"'
-
SOURCES += $$PWD/qcomposeplatforminputcontextmain.cpp \
$$PWD/qcomposeplatforminputcontext.cpp \
$$PWD/generator/qtablegenerator.cpp \
@@ -18,6 +16,10 @@ HEADERS += $$PWD/qcomposeplatforminputcontext.h \
QMAKE_USE += xkbcommon
}
+include($$OUT_PWD/../../../gui/qtgui-config.pri)
+
+DEFINES += X11_PREFIX='\\"$$QMAKE_X11_PREFIX\\"'
+
OTHER_FILES += $$PWD/compose.json
PLUGIN_TYPE = platforminputcontexts
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
index f8fe671a2b..a4d7e504b7 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
@@ -645,6 +645,6 @@ void TableGenerator::orderComposeTable()
// Stable-sorting to ensure that the item that appeared before the other in the
// original container will still appear first after the sort. This property is
// needed to handle the cases when user re-defines already defined key sequence
- std::stable_sort(m_composeTable.begin(), m_composeTable.end(), Compare());
+ std::stable_sort(m_composeTable.begin(), m_composeTable.end(), ByKeys());
}
diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h
index bf9f16b3e4..4f58358f4e 100644
--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h
+++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h
@@ -45,7 +45,9 @@
#include <QtCore/QMap>
#include <QtCore/QString>
-#define QT_KEYSEQUENCE_MAX_LEN 6
+#include <algorithm>
+
+static Q_CONSTEXPR int QT_KEYSEQUENCE_MAX_LEN = 6;
//#define DEBUG_GENERATOR
@@ -65,25 +67,30 @@ Q_DECLARE_TYPEINFO(QComposeTableElement, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
#endif
-class Compare
+struct ByKeys
{
-public:
- bool operator () (const QComposeTableElement &lhs, const uint rhs[QT_KEYSEQUENCE_MAX_LEN])
+ using uint_array = uint[QT_KEYSEQUENCE_MAX_LEN];
+ using result_type = bool;
+
+ bool operator()(const uint_array &lhs, const uint_array &rhs) const Q_DECL_NOTHROW
+ {
+ return std::lexicographical_compare(lhs, lhs + QT_KEYSEQUENCE_MAX_LEN,
+ rhs, rhs + QT_KEYSEQUENCE_MAX_LEN);
+ }
+
+ bool operator()(const uint_array &lhs, const QComposeTableElement &rhs) const Q_DECL_NOTHROW
+ {
+ return operator()(lhs, rhs.keys);
+ }
+
+ bool operator()(const QComposeTableElement &lhs, const uint_array &rhs) const Q_DECL_NOTHROW
{
- for (size_t i = 0; i < QT_KEYSEQUENCE_MAX_LEN; i++) {
- if (lhs.keys[i] != rhs[i])
- return (lhs.keys[i] < rhs[i]);
- }
- return false;
+ return operator()(lhs.keys, rhs);
}
- bool operator () (const QComposeTableElement &lhs, const QComposeTableElement &rhs)
+ bool operator()(const QComposeTableElement &lhs, const QComposeTableElement &rhs) const Q_DECL_NOTHROW
{
- for (size_t i = 0; i < QT_KEYSEQUENCE_MAX_LEN; i++) {
- if (lhs.keys[i] != rhs.keys[i])
- return (lhs.keys[i] < rhs.keys[i]);
- }
- return false;
+ return operator()(lhs.keys, rhs.keys);
}
};
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
index 857f437661..6016d460fc 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.cpp
@@ -155,11 +155,8 @@ void QComposeInputContext::update(Qt::InputMethodQueries q)
static bool isDuplicate(const QComposeTableElement &lhs, const QComposeTableElement &rhs)
{
- for (size_t i = 0; i < QT_KEYSEQUENCE_MAX_LEN; i++) {
- if (lhs.keys[i] != rhs.keys[i])
- return false;
- }
- return true;
+ return std::equal(lhs.keys, lhs.keys + QT_KEYSEQUENCE_MAX_LEN,
+ QT_MAKE_CHECKED_ARRAY_ITERATOR(rhs.keys, QT_KEYSEQUENCE_MAX_LEN));
}
bool QComposeInputContext::checkComposeTable()
@@ -182,7 +179,7 @@ bool QComposeInputContext::checkComposeTable()
}
Q_ASSERT(!m_composeTable.isEmpty());
QVector<QComposeTableElement>::const_iterator it =
- std::lower_bound(m_composeTable.constBegin(), m_composeTable.constEnd(), m_composeBuffer, Compare());
+ std::lower_bound(m_composeTable.constBegin(), m_composeTable.constEnd(), m_composeBuffer, ByKeys());
// prevent dereferencing an 'end' iterator, which would result in a crash
if (it == m_composeTable.constEnd())
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index 1faa806480..b15c486e9d 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -359,7 +359,7 @@ id getValueAttribute(QAccessibleInterface *interface)
{
const QAccessible::Role qtrole = interface->role();
if (qtrole == QAccessible::StaticText) {
- return QCFString::toNSString(interface->text(QAccessible::Name));
+ return interface->text(QAccessible::Name).toNSString();
}
if (qtrole == QAccessible::EditableText) {
if (QAccessibleTextInterface *textInterface = interface->textInterface()) {
@@ -380,12 +380,12 @@ id getValueAttribute(QAccessibleInterface *interface)
// textInterface->textAfterOffset(0, QAccessible2::SentenceBoundary, &begin, &end);
text = textInterface->text(begin, end);
}
- return QCFString::toNSString(text);
+ return text.toNSString();
}
}
if (QAccessibleValueInterface *valueInterface = interface->valueInterface()) {
- return QCFString::toNSString(valueInterface->currentValue().toString());
+ return valueInterface->currentValue().toString().toNSString();
}
if (interface->state().checkable) {
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 7128fb72c3..9c410506b0 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -237,7 +237,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
if (QWindow *window = iface->window()) {
QCocoaWindow *win = static_cast<QCocoaWindow*>(window->handle());
- return win->qtView();
+ return qnsview_cast(win->view());
}
QAccessibleInterface *parent = iface->parent();
@@ -300,9 +300,9 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
} else if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) {
if (iface->role() == QAccessible::StaticText)
return nil;
- return QCFString::toNSString(iface->text(QAccessible::Name));
+ return iface->text(QAccessible::Name).toNSString();
} else if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute]) {
- return QCFString::toNSString(iface->text(QAccessible::Description));
+ return iface->text(QAccessible::Description).toNSString();
} else if ([attribute isEqualToString:NSAccessibilityEnabledAttribute]) {
return [NSNumber numberWithBool:!iface->state().disabled];
} else if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
@@ -439,7 +439,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
if ([attribute isEqualToString: NSAccessibilityAttributedStringForRangeParameterizedAttribute]) {
NSRange range = [parameter rangeValue];
QString text = iface->textInterface()->text(range.location, range.location + range.length);
- return [[NSAttributedString alloc] initWithString: text.toNSString()];
+ return [[NSAttributedString alloc] initWithString:text.toNSString()];
} else if ([attribute isEqualToString: NSAccessibilityRangeForPositionParameterizedAttribute]) {
NSPoint nsPoint = [parameter pointValue];
QPoint point(static_cast<int>(nsPoint.x), static_cast<int>(qt_mac_flipYCoordinate(nsPoint.y)));
@@ -532,7 +532,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
} else {
description = qAccessibleLocalizedActionDescription(qtAction);
}
- return QCFString::toNSString(description);
+ return description.toNSString();
}
- (void)accessibilityPerformAction:(NSString *)action {
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 4874fcf807..da755aa189 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -296,7 +296,7 @@ QT_END_NAMESPACE
Q_UNUSED(sender);
for (NSString *fileName in filenames) {
- QString qtFileName = QCFString::toQString(fileName);
+ QString qtFileName = QString::fromNSString(fileName);
if (inLaunch) {
// We need to be careful because Cocoa will be nice enough to take
// command line arguments and send them to us as events. Given the history
@@ -424,7 +424,7 @@ QT_END_NAMESPACE
{
Q_UNUSED(replyEvent);
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
- QWindowSystemInterface::handleFileOpenEvent(QUrl(QCFString::toQString(urlString)));
+ QWindowSystemInterface::handleFileOpenEvent(QUrl(QString::fromNSString(urlString)));
}
- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index af5418315c..a74995319b 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -40,6 +40,7 @@
#include "qcocoabackingstore.h"
#include "qcocoawindow.h"
+#include "qcocoahelpers.h"
QT_BEGIN_NAMESPACE
@@ -51,7 +52,7 @@ QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
QCocoaBackingStore::~QCocoaBackingStore()
{
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle()))
- [cocoaWindow->m_qtView clearBackingStore:this];
+ [qnsview_cast(cocoaWindow->view()) clearBackingStore:this];
}
QImage::Format QCocoaBackingStore::format() const
@@ -68,7 +69,7 @@ void QCocoaBackingStore::flush(QWindow *window, const QRegion &region, const QPo
return;
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle()))
- [cocoaWindow->m_qtView flushBackingStore:this region:region offset:offset];
+ [qnsview_cast(cocoaWindow->view()) flushBackingStore:this region:region offset:offset];
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 5f54110777..5c27cf8059 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -348,7 +348,7 @@ static inline void qt_mac_waitForMoreEvents(NSString *runLoopMode = NSDefaultRun
bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_D(QCocoaEventDispatcher);
- d->interrupt = false;
+ QBoolBlocker interruptBlocker(d->interrupt, false);
bool interruptLater = false;
QtCocoaInterruptDispatcher::cancelInterruptLater();
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index c0055852c2..7706f39198 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -146,14 +146,14 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
QFileInfo sel(selectFile);
if (sel.isDir() && !sel.isBundle()){
- mCurrentDir = [QCFString::toNSString(sel.absoluteFilePath()) retain];
+ mCurrentDir = [sel.absoluteFilePath().toNSString() retain];
mCurrentSelection = new QString;
} else {
- mCurrentDir = [QCFString::toNSString(sel.absolutePath()) retain];
+ mCurrentDir = [sel.absolutePath().toNSString() retain];
mCurrentSelection = new QString(sel.absoluteFilePath());
}
- [mSavePanel setTitle:QCFString::toNSString(options->windowTitle())];
+ [mSavePanel setTitle:options->windowTitle().toNSString()];
[self createPopUpButton:selectedVisualNameFilter hideDetails:options->testOption(QFileDialogOptions::HideNameFilterDetails)];
[self createTextField];
[self createAccessory];
@@ -204,12 +204,12 @@ static QString strippedText(QString s)
- (NSString *)strip:(const QString &)label
{
- return QCFString::toNSString(strippedText(label));
+ return strippedText(label).toNSString();
}
- (void)closePanel
{
- *mCurrentSelection = QCFString::toQString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
+ *mCurrentSelection = QString::fromNSString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
if ([mSavePanel respondsToSelector:@selector(close)])
[mSavePanel close];
if ([mSavePanel isSheet])
@@ -220,14 +220,14 @@ static QString strippedText(QString s)
{
if (mOpenPanel){
QFileInfo info(*mCurrentSelection);
- NSString *filepath = QCFString::toNSString(info.filePath());
+ NSString *filepath = info.filePath().toNSString();
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[self updateProperties];
QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder();
[mOpenPanel setAllowedFileTypes:nil];
- [mSavePanel setNameFieldStringValue:selectable ? QT_PREPEND_NAMESPACE(QCFString::toNSString)(info.fileName()) : @""];
+ [mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
[mOpenPanel beginWithCompletionHandler:^(NSInteger result){
mReturnCode = result;
@@ -240,12 +240,12 @@ static QString strippedText(QString s)
- (BOOL)runApplicationModalPanel
{
QFileInfo info(*mCurrentSelection);
- NSString *filepath = QCFString::toNSString(info.filePath());
+ NSString *filepath = info.filePath().toNSString();
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
[mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
- [mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
+ [mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
// Call processEvents in case the event dispatcher has been interrupted, and needs to do
// cleanup of modal sessions. Do this before showing the native dialog, otherwise it will
@@ -267,7 +267,7 @@ static QString strippedText(QString s)
- (void)showWindowModalSheet:(QWindow *)parent
{
QFileInfo info(*mCurrentSelection);
- NSString *filepath = QCFString::toNSString(info.filePath());
+ NSString *filepath = info.filePath().toNSString();
bool selectable = (mOptions->acceptMode() == QFileDialogOptions::AcceptSave)
|| [self panel:nil shouldShowFilename:filepath];
@@ -275,7 +275,7 @@ static QString strippedText(QString s)
QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder();
[mSavePanel setDirectoryURL: [NSURL fileURLWithPath:mCurrentDir]];
- [mSavePanel setNameFieldStringValue:selectable ? QCFString::toNSString(info.fileName()) : @""];
+ [mSavePanel setNameFieldStringValue:selectable ? info.fileName().toNSString() : @""];
NSWindow *nsparent = static_cast<NSWindow *>(qGuiApp->platformNativeInterface()->nativeResourceForWindow("nswindow", parent));
[mSavePanel beginSheetModalForWindow:nsparent completionHandler:^(NSInteger result){
@@ -322,7 +322,7 @@ static QString strippedText(QString s)
}
}
- QString qtFileName = QFileInfo(QCFString::toQString(filename)).fileName();
+ QString qtFileName = QFileInfo(QString::fromNSString(filename)).fileName();
// No filter means accept everything
bool nameMatches = mSelectedNameFilter->isEmpty();
// Check if the current file name filter accepts the file:
@@ -374,7 +374,7 @@ static QString strippedText(QString s)
if (filters.size() > 0){
for (int i=0; i<filters.size(); ++i) {
QString filter = hideDetails ? [self removeExtensions:filters.at(i)] : filters.at(i);
- [mPopUpButton addItemWithTitle:QCFString::toNSString(filter)];
+ [mPopUpButton addItemWithTitle:filter.toNSString()];
}
[mPopUpButton selectItemAtIndex:0];
[mSavePanel setAccessoryView:mAccessoryView];
@@ -408,13 +408,13 @@ static QString strippedText(QString s)
QList<QUrl> result;
NSArray* array = [mOpenPanel URLs];
for (NSUInteger i=0; i<[array count]; ++i) {
- QString path = QCFString::toQString([[array objectAtIndex:i] path]).normalized(QString::NormalizationForm_C);
+ QString path = QString::fromNSString([[array objectAtIndex:i] path]).normalized(QString::NormalizationForm_C);
result << QUrl::fromLocalFile(path);
}
return result;
} else {
QList<QUrl> result;
- QString filename = QCFString::toQString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
+ QString filename = QString::fromNSString([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C);
result << QUrl::fromLocalFile(filename.remove(QLatin1String("___qt_very_unlikely_prefix_")));
return result;
}
@@ -437,8 +437,8 @@ static QString strippedText(QString s)
[mSavePanel setCanCreateDirectories:!(mOptions->testOption(QFileDialogOptions::ReadOnly))];
[mOpenPanel setAllowsMultipleSelection:(fileMode == QFileDialogOptions::ExistingFiles)];
[mOpenPanel setResolvesAliases:!(mOptions->testOption(QFileDialogOptions::DontResolveSymlinks))];
- [mOpenPanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
- [mSavePanel setTitle:QCFString::toNSString(mOptions->windowTitle())];
+ [mOpenPanel setTitle:mOptions->windowTitle().toNSString()];
+ [mSavePanel setTitle:mOptions->windowTitle().toNSString()];
[mPopUpButton setHidden:chooseDirsOnly]; // TODO hide the whole sunken pane instead?
QStringList ext = [self acceptableExtensionsForSave];
@@ -457,7 +457,7 @@ static QString strippedText(QString s)
{
Q_UNUSED(sender);
if (mHelper && [mSavePanel isVisible]) {
- QString selection = QCFString::toQString([[mSavePanel URL] path]);
+ QString selection = QString::fromNSString([[mSavePanel URL] path]);
if (selection != mCurrentSelection) {
*mCurrentSelection = selection;
mHelper->QNSOpenSavePanelDelegate_selectionChanged(selection);
@@ -475,7 +475,7 @@ static QString strippedText(QString s)
[mCurrentDir release];
mCurrentDir = [path retain];
- mHelper->QNSOpenSavePanelDelegate_directoryEntered(QCFString::toQString(mCurrentDir));
+ mHelper->QNSOpenSavePanelDelegate_directoryEntered(QString::fromNSString(mCurrentDir));
}
/*
@@ -538,7 +538,7 @@ static QString strippedText(QString s)
(filterToUse == -1 && currentFilter.startsWith(selectedFilter)))
filterToUse = i;
QString filter = hideDetails ? [self removeExtensions:currentFilter] : currentFilter;
- [mPopUpButton addItemWithTitle:QCFString::toNSString(filter)];
+ [mPopUpButton addItemWithTitle:filter.toNSString()];
}
if (filterToUse != -1)
[mPopUpButton selectItemAtIndex:filterToUse];
@@ -610,7 +610,7 @@ void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_filterSelected(int menuInd
void QCocoaFileDialogHelper::setDirectory(const QUrl &directory)
{
if (mDelegate)
- [mDelegate->mSavePanel setDirectoryURL:[NSURL fileURLWithPath:QCFString::toNSString(directory.toLocalFile())]];
+ [mDelegate->mSavePanel setDirectoryURL:[NSURL fileURLWithPath:directory.toLocalFile().toNSString()]];
else
mDir = directory;
}
@@ -618,7 +618,7 @@ void QCocoaFileDialogHelper::setDirectory(const QUrl &directory)
QUrl QCocoaFileDialogHelper::directory() const
{
if (mDelegate) {
- QString path = QCFString::toQString([[mDelegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C);
+ QString path = QString::fromNSString([[mDelegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C);
return QUrl::fromLocalFile(path);
}
return mDir;
@@ -647,7 +647,7 @@ void QCocoaFileDialogHelper::setFilter()
if (!mDelegate)
return;
const SharedPointerFileDialogOptions &opts = options();
- [mDelegate->mSavePanel setTitle:QCFString::toNSString(opts->windowTitle())];
+ [mDelegate->mSavePanel setTitle:opts->windowTitle().toNSString()];
if (opts->isLabelExplicitlySet(QFileDialogOptions::Accept))
[mDelegate->mSavePanel setPrompt:[mDelegate strip:opts->labelText(QFileDialogOptions::Accept)]];
if (opts->isLabelExplicitlySet(QFileDialogOptions::FileName))
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index dc7dfb788f..214f44b548 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -162,7 +162,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
{
mHelper = helper;
- [mFontPanel setTitle:QCFString::toNSString(helper->options()->windowTitle())];
+ [mFontPanel setTitle:helper->options()->windowTitle().toNSString()];
if (mHelper->options()->testOption(QFontDialogOptions::NoButtons)) {
[self restoreOriginalContentView];
@@ -442,7 +442,7 @@ public:
}
QFontInfo fontInfo(font);
- nsFont = [mgr fontWithFamily:QCFString::toNSString(fontInfo.family())
+ nsFont = [mgr fontWithFamily:fontInfo.family().toNSString()
traits:mask
weight:weight
size:fontInfo.pointSize()];
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index ccb11f80f1..31b93be136 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -255,7 +255,7 @@ void QCocoaGLContext::setActiveWindow(QWindow *window)
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
cocoaWindow->setCurrentContext(this);
- [(QNSView *) cocoaWindow->contentView() setQCocoaGLContext:this];
+ [(QNSView *) cocoaWindow->view() setQCocoaGLContext:this];
}
void QCocoaGLContext::updateSurfaceFormat()
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 536a2d2d58..1b038a6b5e 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -55,6 +55,8 @@
#include <QtGui/qpalette.h>
#include <QtGui/qscreen.h>
+Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView));
+
QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQpaCocoaWindow)
@@ -74,6 +76,8 @@ NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions);
Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions);
Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions);
+QT_MANGLE_NAMESPACE(QNSView) *qnsview_cast(NSView *view);
+
// Misc
void qt_mac_transformProccessToForegroundApplication();
QString qt_mac_applicationName();
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 0c7c30579e..c57567bdd6 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -40,7 +40,7 @@
#include <qpa/qplatformtheme.h>
#include "qcocoahelpers.h"
-
+#include "qnsview.h"
#include <QtCore>
#include <QtGui>
@@ -70,7 +70,7 @@ QStringList qt_mac_NSArrayToQStringList(void *nsarray)
QStringList result;
NSArray *array = static_cast<NSArray *>(nsarray);
for (NSUInteger i=0; i<[array count]; ++i)
- result << QCFString::toQString([array objectAtIndex:i]);
+ result << QString::fromNSString([array objectAtIndex:i]);
return result;
}
@@ -143,7 +143,30 @@ Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions)
return actions;
}
+/*!
+ Returns the view cast to a QNSview if possible.
+
+ If the view is not a QNSView, nil is returned, which is safe to
+ send messages to, effectivly making [qnsview_cast(view) message]
+ a no-op.
+ For extra verbosity and clearer code, please consider checking
+ that window()->type() != Qt::ForeignWindow before using this cast.
+
+ Do not use this method soley to check for foreign windows, as
+ that will make the code harder to read for people not working
+ primarily on macOS, who do not know the difference between the
+ NSView and QNSView cases.
+*/
+QNSView *qnsview_cast(NSView *view)
+{
+ if (![view isKindOfClass:[QNSView class]]) {
+ qCWarning(lcQpaCocoaWindow) << "NSView is not QNSView, consider checking for Qt::ForeignWindow";
+ return nil;
+ }
+
+ return static_cast<QNSView *>(view);
+}
//
// Misc
@@ -161,7 +184,7 @@ void qt_mac_transformProccessToForegroundApplication()
// Officially it's supposed to be a string, a boolean makes sense, so we'll check.
// A number less so, but OK.
if (valueType == CFStringGetTypeID())
- forceTransform = !(QCFString::toQString(static_cast<CFStringRef>(value)).toInt());
+ forceTransform = !(QString::fromCFString(static_cast<CFStringRef>(value)).toInt());
else if (valueType == CFBooleanGetTypeID())
forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
else if (valueType == CFNumberGetTypeID()) {
@@ -179,7 +202,7 @@ void qt_mac_transformProccessToForegroundApplication()
if (valueType == CFBooleanGetTypeID())
forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
else if (valueType == CFStringGetTypeID())
- forceTransform = !(QCFString::toQString(static_cast<CFStringRef>(value)).toInt());
+ forceTransform = !(QString::fromCFString(static_cast<CFStringRef>(value)).toInt());
else if (valueType == CFNumberGetTypeID()) {
int valueAsInt;
CFNumberGetValue(static_cast<CFNumberRef>(value), kCFNumberIntType, &valueAsInt);
@@ -198,7 +221,7 @@ QString qt_mac_applicationName()
QString appName;
CFTypeRef string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("CFBundleName"));
if (string)
- appName = QCFString::toQString(static_cast<CFStringRef>(string));
+ appName = QString::fromCFString(static_cast<CFStringRef>(string));
if (appName.isEmpty()) {
QString arg0 = QGuiApplicationPrivate::instance()->appName();
diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.mm b/src/plugins/platforms/cocoa/qcocoainputcontext.mm
index 04d6d6b806..9e3d747cd7 100644
--- a/src/plugins/platforms/cocoa/qcocoainputcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoainputcontext.mm
@@ -41,6 +41,7 @@
#include "qcocoainputcontext.h"
#include "qcocoanativeinterface.h"
#include "qcocoawindow.h"
+#include "qcocoahelpers.h"
#include <Carbon/Carbon.h>
@@ -102,7 +103,8 @@ void QCocoaInputContext::reset()
if (!mWindow)
return;
- QNSView *view = static_cast<QCocoaWindow *>(mWindow->handle())->qtView();
+ QCocoaWindow *window = static_cast<QCocoaWindow *>(mWindow->handle());
+ QNSView *view = qnsview_cast(window->view());
if (!view)
return;
@@ -131,7 +133,7 @@ void QCocoaInputContext::updateLocale()
CFArrayRef languages = (CFArrayRef) TISGetInputSourceProperty(source, kTISPropertyInputSourceLanguages);
if (CFArrayGetCount(languages) > 0) {
CFStringRef langRef = (CFStringRef)CFArrayGetValueAtIndex(languages, 0);
- QString name = QCFString::toQString(langRef);
+ QString name = QString::fromCFString(langRef);
QLocale locale(name);
if (m_locale != locale) {
m_locale = locale;
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
index ebe547f64b..e7952ae1f6 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
@@ -251,16 +251,20 @@ static qt_mac_enum_mapper qt_mac_private_unicode[] = {
{ 0xF72B, QT_MAC_MAP_ENUM(Qt::Key_End) }, //NSEndFunctionKey
{ 0xF72C, QT_MAC_MAP_ENUM(Qt::Key_PageUp) }, //NSPageUpFunctionKey
{ 0xF72D, QT_MAC_MAP_ENUM(Qt::Key_PageDown) }, //NSPageDownFunctionKey
+ { 0xF72E, QT_MAC_MAP_ENUM(Qt::Key_Print) }, //NSPrintScreenFunctionKey
{ 0xF72F, QT_MAC_MAP_ENUM(Qt::Key_ScrollLock) }, //NSScrollLockFunctionKey
{ 0xF730, QT_MAC_MAP_ENUM(Qt::Key_Pause) }, //NSPauseFunctionKey
{ 0xF731, QT_MAC_MAP_ENUM(Qt::Key_SysReq) }, //NSSysReqFunctionKey
{ 0xF735, QT_MAC_MAP_ENUM(Qt::Key_Menu) }, //NSMenuFunctionKey
- { 0xF738, QT_MAC_MAP_ENUM(Qt::Key_Print) }, //NSPrintFunctionKey
+ { 0xF738, QT_MAC_MAP_ENUM(Qt::Key_Printer) }, //NSPrintFunctionKey
{ 0xF73A, QT_MAC_MAP_ENUM(Qt::Key_Clear) }, //NSClearDisplayFunctionKey
{ 0xF73D, QT_MAC_MAP_ENUM(Qt::Key_Insert) }, //NSInsertCharFunctionKey
{ 0xF73E, QT_MAC_MAP_ENUM(Qt::Key_Delete) }, //NSDeleteCharFunctionKey
{ 0xF741, QT_MAC_MAP_ENUM(Qt::Key_Select) }, //NSSelectFunctionKey
{ 0xF742, QT_MAC_MAP_ENUM(Qt::Key_Execute) }, //NSExecuteFunctionKey
+ { 0xF743, QT_MAC_MAP_ENUM(Qt::Key_Undo) }, //NSUndoFunctionKey
+ { 0xF744, QT_MAC_MAP_ENUM(Qt::Key_Redo) }, //NSRedoFunctionKey
+ { 0xF745, QT_MAC_MAP_ENUM(Qt::Key_Find) }, //NSFindFunctionKey
{ 0xF746, QT_MAC_MAP_ENUM(Qt::Key_Help) }, //NSHelpFunctionKey
{ 0xF747, QT_MAC_MAP_ENUM(Qt::Key_Mode_switch) }, //NSModeSwitchFunctionKey
{ 0, QT_MAC_MAP_ENUM(0) }
@@ -384,17 +388,12 @@ bool QCocoaKeyMapper::updateKeyboard()
iso639Code = static_cast<CFStringRef>(CFArrayGetValueAtIndex(array, 0)); // Actually a RFC3066bis, but it's close enough
if (iso639Code) {
- keyboardInputLocale = QLocale(QCFString::toQString(iso639Code));
+ keyboardInputLocale = QLocale(QString::fromCFString(iso639Code));
keyboardInputDirection = keyboardInputLocale.textDirection();
} else {
keyboardInputLocale = QLocale::c();
keyboardInputDirection = Qt::LeftToRight;
}
-
- const auto newMode = keyboard_mode;
- deleteLayouts();
- keyboard_mode = newMode;
-
return true;
}
@@ -417,8 +416,10 @@ void QCocoaKeyMapper::clearMappings()
void QCocoaKeyMapper::updateKeyMap(unsigned short macVirtualKey, QChar unicodeKey)
{
- updateKeyboard();
-
+ if (updateKeyboard()) {
+ // ### Qt 4 did this:
+ // QKeyMapper::changeKeyboard();
+ }
if (keyLayout[macVirtualKey])
return;
@@ -474,8 +475,9 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
for (int i = 1; i < 8; ++i) {
Qt::KeyboardModifiers neededMods = ModsTbl[i];
int key = kbItem->qtKey[i];
- if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
- ret << int(key + neededMods);
+ if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) {
+ ret << int(key + (keyMods & ~neededMods));
+ }
}
return ret;
}
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 4260b17772..566363e01f 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -285,7 +285,7 @@ void QCocoaMenu::setText(const QString &text)
{
QMacAutoReleasePool pool;
QString stripped = qt_mac_removeAmpersandEscapes(text);
- [m_nativeMenu setTitle:QCFString::toNSString(stripped)];
+ [m_nativeMenu setTitle:stripped.toNSString()];
}
void QCocoaMenu::setMinimumWidth(int width)
@@ -296,7 +296,7 @@ void QCocoaMenu::setMinimumWidth(int width)
void QCocoaMenu::setFont(const QFont &font)
{
if (font.resolve()) {
- NSFont *customMenuFont = [NSFont fontWithName:QCFString::toNSString(font.family())
+ NSFont *customMenuFont = [NSFont fontWithName:font.family().toNSString()
size:font.pointSize()];
m_nativeMenu.font = customMenuFont;
}
@@ -495,7 +495,7 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
QPoint pos = QPoint(targetRect.left(), targetRect.top() + targetRect.height());
QCocoaWindow *cocoaWindow = parentWindow ? static_cast<QCocoaWindow *>(parentWindow->handle()) : 0;
- NSView *view = cocoaWindow ? cocoaWindow->contentView() : nil;
+ NSView *view = cocoaWindow ? cocoaWindow->view() : nil;
NSMenuItem *nsItem = item ? ((QCocoaMenuItem *)item)->nsItem() : nil;
QScreen *screen = 0;
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index ea094c86ee..b8a64641a8 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -309,7 +309,7 @@ NSMenuItem *QCocoaMenuItem::sync()
}
if (!m_native) {
- m_native = [[NSMenuItem alloc] initWithTitle:QCFString::toNSString(m_text)
+ m_native = [[NSMenuItem alloc] initWithTitle:m_text.toNSString()
action:nil
keyEquivalent:@""];
[m_native setTag:reinterpret_cast<NSInteger>(this)];
@@ -331,20 +331,20 @@ NSMenuItem *QCocoaMenuItem::sync()
bool useAttributedTitle = false;
// Cocoa Font and title
if (m_font.resolve()) {
- NSFont *customMenuFont = [NSFont fontWithName:QCFString::toNSString(m_font.family())
+ NSFont *customMenuFont = [NSFont fontWithName:m_font.family().toNSString()
size:m_font.pointSize()];
if (customMenuFont) {
NSArray *keys = [NSArray arrayWithObjects:NSFontAttributeName, nil];
NSArray *objects = [NSArray arrayWithObjects:customMenuFont, nil];
NSDictionary *attributes = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
- NSAttributedString *str = [[[NSAttributedString alloc] initWithString:QCFString::toNSString(finalString)
+ NSAttributedString *str = [[[NSAttributedString alloc] initWithString:finalString.toNSString()
attributes:attributes] autorelease];
[m_native setAttributedTitle: str];
useAttributedTitle = true;
}
}
if (!useAttributedTitle) {
- [m_native setTitle: QCFString::toNSString(finalString)];
+ [m_native setTitle:finalString.toNSString()];
}
#ifndef QT_NO_SHORTCUT
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index 22e90f8dc8..01a3c04afb 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -314,13 +314,13 @@ QT_FORWARD_DECLARE_CLASS(QString)
{
#ifndef QT_NO_TRANSLATION
- [servicesItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(0))];
- [hideItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(1).arg(qt_mac_applicationName()))];
- [hideAllOthersItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(2))];
- [showAllItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(3))];
- [preferencesItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(4))];
- [quitItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()))];
- [aboutItem setTitle: QCFString::toNSString(qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()))];
+ [servicesItem setTitle:qt_mac_applicationmenu_string(0).toNSString()];
+ [hideItem setTitle:qt_mac_applicationmenu_string(1).arg(qt_mac_applicationName()).toNSString()];
+ [hideAllOthersItem setTitle:qt_mac_applicationmenu_string(2).toNSString()];
+ [showAllItem setTitle:qt_mac_applicationmenu_string(3).toNSString()];
+ [preferencesItem setTitle:qt_mac_applicationmenu_string(4).toNSString()];
+ [quitItem setTitle:qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()).toNSString()];
+ [aboutItem setTitle:qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()).toNSString()];
#endif
}
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index 7065a364bf..477165607c 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -120,9 +120,6 @@ private:
static CGImageRef qImageToCGImage(const QImage &image);
static QImage cgImageToQImage(CGImageRef image);
- // Embedding NSViews as child QWindows
- static void setWindowContentView(QPlatformWindow *window, void *nsViewContentView);
-
// Set a QWindow as a "guest" (subwindow) of a non-QWindow
static void setEmbeddedInForeignView(QPlatformWindow *window, bool embedded);
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 3ff37a8463..10435d0b1d 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -96,7 +96,7 @@ void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceS
return 0;
if (resourceString == "nsview") {
- return static_cast<QCocoaWindow *>(window->handle())->m_contentView;
+ return static_cast<QCocoaWindow *>(window->handle())->m_view;
#ifndef QT_NO_OPENGL
} else if (resourceString == "nsopenglcontext") {
return static_cast<QCocoaWindow *>(window->handle())->currentContext()->nsOpenGLContext();
@@ -125,8 +125,6 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::qImageToCGImage);
if (resource.toLower() == "cgimagetoqimage")
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::cgImageToQImage);
- if (resource.toLower() == "setwindowcontentview")
- return NativeResourceForIntegrationFunction(QCocoaNativeInterface::setWindowContentView);
if (resource.toLower() == "registertouchwindow")
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::registerTouchWindow);
if (resource.toLower() == "setembeddedinforeignview")
@@ -278,12 +276,6 @@ QImage QCocoaNativeInterface::cgImageToQImage(CGImageRef image)
return qt_mac_toQImage(image);
}
-void QCocoaNativeInterface::setWindowContentView(QPlatformWindow *window, void *contentView)
-{
- QCocoaWindow *cocoaPlatformWindow = static_cast<QCocoaWindow *>(window);
- cocoaPlatformWindow->setContentView(reinterpret_cast<NSView *>(contentView));
-}
-
void QCocoaNativeInterface::setEmbeddedInForeignView(QPlatformWindow *window, bool embedded)
{
QCocoaWindow *cocoaPlatformWindow = static_cast<QCocoaWindow *>(window);
diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
index d5fd523a37..39fcf285ed 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
+++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
@@ -71,13 +71,13 @@ QCocoaPrintDevice::QCocoaPrintDevice(const QString &id)
m_ppd(0)
{
if (!id.isEmpty()) {
- m_printer = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(id));
+ m_printer = PMPrinterCreateFromPrinterID(id.toCFString());
if (m_printer) {
- m_name = QCFString::toQString(PMPrinterGetName(m_printer));
- m_location = QCFString::toQString(PMPrinterGetLocation(m_printer));
+ m_name = QString::fromCFString(PMPrinterGetName(m_printer));
+ m_location = QString::fromCFString(PMPrinterGetLocation(m_printer));
CFStringRef cfMakeAndModel;
if (PMPrinterGetMakeAndModelName(m_printer, &cfMakeAndModel) == noErr)
- m_makeAndModel = QCFString::toQString(cfMakeAndModel);
+ m_makeAndModel = QString::fromCFString(cfMakeAndModel);
Boolean isRemote;
if (PMPrinterIsRemote(m_printer, &isRemote) == noErr)
m_isRemote = isRemote;
@@ -420,7 +420,7 @@ void QCocoaPrintDevice::loadMimeTypes() const
int count = CFArrayGetCount(mimeTypes);
for (int i = 0; i < count; ++i) {
CFStringRef mimeName = static_cast<CFStringRef>(const_cast<void *>(CFArrayGetValueAtIndex(mimeTypes, i)));
- QMimeType mimeType = db.mimeTypeForName(QCFString::toQString(mimeName));
+ QMimeType mimeType = db.mimeTypeForName(QString::fromCFString(mimeName));
if (mimeType.isValid())
m_mimeTypes.append(mimeType);
}
diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm
index f8fc23f681..c2f7d5b022 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintersupport.mm
+++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.mm
@@ -82,7 +82,7 @@ QStringList QCocoaPrinterSupport::availablePrintDeviceIds() const
CFIndex count = CFArrayGetCount(printerList);
for (CFIndex i = 0; i < count; ++i) {
PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(printerList, i)));
- list.append(QCFString::toQString(PMPrinterGetID(printer)));
+ list.append(QString::fromCFString(PMPrinterGetID(printer)));
}
}
return list;
@@ -96,7 +96,7 @@ QString QCocoaPrinterSupport::defaultPrintDeviceId() const
for (CFIndex i = 0; i < count; ++i) {
PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(printerList, i)));
if (PMPrinterIsDefault(printer))
- return QCFString::toQString(PMPrinterGetID(printer));
+ return QString::fromCFString(PMPrinterGetID(printer));
}
}
return QString();
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 9a543e893e..6af22facf9 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -270,7 +270,7 @@ void QCocoaSystemTrayIcon::updateToolTip(const QString &toolTip)
{
if (!m_sys)
return;
- [[[m_sys->item item] view] setToolTip:QCFString::toNSString(toolTip)];
+ [[[m_sys->item item] view] setToolTip:toolTip.toNSString()];
}
bool QCocoaSystemTrayIcon::isSystemTrayAvailable() const
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index d0879ed457..03ad15a381 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -303,7 +303,7 @@ protected:
{
QMacAutoReleasePool pool;
- NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo().canonicalFilePath())];
+ NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:fileInfo().canonicalFilePath().toNSString()];
if (!iconImage)
return QPixmap();
return qt_mac_toQPixmap(iconImage, size);
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index b016004b23..bd7b23bc1b 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -54,32 +54,6 @@
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
@@ -96,13 +70,13 @@ typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow;
@interface QT_MANGLE_NAMESPACE(QNSWindowHelper) : NSObject
{
QCocoaNSWindow *_window;
- QCocoaWindowPointer _platformWindow;
+ QPointer<QCocoaWindow> _platformWindow;
BOOL _grabbingMouse;
BOOL _releaseOnMouseUp;
}
@property (nonatomic, readonly) QCocoaNSWindow *window;
-@property (nonatomic, readonly) QCocoaWindowPointer platformWindow;
+@property (nonatomic, readonly) QCocoaWindow *platformWindow;
@property (nonatomic) BOOL grabbingMouse;
@property (nonatomic) BOOL releaseOnMouseUp;
@@ -169,8 +143,9 @@ QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
-class QCocoaWindow : public QPlatformWindow
+class QCocoaWindow : public QObject, public QPlatformWindow
{
+ Q_OBJECT
public:
QCocoaWindow(QWindow *tlw);
~QCocoaWindow();
@@ -207,9 +182,7 @@ public:
WId winId() const Q_DECL_OVERRIDE;
void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
- NSView *contentView() const;
- void setContentView(NSView *contentView);
- QNSView *qtView() const;
+ NSView *view() const;
NSWindow *nativeWindow() const;
void setEmbeddedInForeignView(bool subwindow);
@@ -285,14 +258,13 @@ public: // for QNSView
void removeMonitor();
- NSView *m_contentView;
- QNSView *m_qtView;
+ NSView *m_view;
QCocoaNSWindow *m_nsWindow;
- QCocoaWindowPointer m_forwardWindow;
+ QPointer<QCocoaWindow> 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
- bool m_contentViewIsToBeEmbedded; // true if the m_contentView is intended to be embedded in a "foreign" NSView hiearchy
+ bool m_viewIsEmbedded; // true if the m_view is actually embedded in a "foreign" NSView hiearchy
+ bool m_viewIsToBeEmbedded; // true if the m_view is intended to be embedded in a "foreign" NSView hiearchy
QCocoaWindow *m_parentCocoaWindow;
bool m_isNSWindowChild; // this window is a non-top level QWindow with a NSWindow.
@@ -350,10 +322,6 @@ 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 QCocoaWindowPointer,
- // preventing the use of dangling pointers.
- QObject sentinel;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 87a0991098..f87ddab455 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -90,16 +90,20 @@ static void qt_closePopups()
@implementation QNSWindowHelper
@synthesize window = _window;
-@synthesize platformWindow = _platformWindow;
@synthesize grabbingMouse = _grabbingMouse;
@synthesize releaseOnMouseUp = _releaseOnMouseUp;
+- (QCocoaWindow *)platformWindow
+{
+ return _platformWindow.data();
+}
+
- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow
{
self = [super init];
if (self) {
_window = window;
- _platformWindow.assign(platformWindow);
+ _platformWindow = platformWindow;
_window.delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:_platformWindow];
@@ -118,7 +122,7 @@ static void qt_closePopups()
QCocoaWindow *pw = self.platformWindow;
if (pw && pw->m_forwardWindow) {
if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) {
- QNSView *forwardView = pw->m_qtView;
+ QNSView *forwardView = qnsview_cast(pw->view());
if (theEvent.type == NSLeftMouseUp) {
[forwardView mouseUp:theEvent];
pw->m_forwardWindow.clear();
@@ -159,18 +163,14 @@ static void qt_closePopups()
NSPoint loc = [theEvent locationInWindow];
NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]];
NSRect contentFrame = [[self.window contentView] frame];
- if (NSMouseInRect(loc, windowFrame, NO) &&
- !NSMouseInRect(loc, contentFrame, NO))
- {
- QNSView *contentView = pw->m_qtView;
- [contentView handleFrameStrutMouseEvent: theEvent];
- }
+ if (NSMouseInRect(loc, windowFrame, NO) && !NSMouseInRect(loc, contentFrame, NO))
+ [qnsview_cast(pw->view()) handleFrameStrutMouseEvent:theEvent];
}
}
- (void)detachFromPlatformWindow
{
- self.platformWindow.clear();
+ _platformWindow.clear();
[self.window.delegate release];
self.window.delegate = nil;
}
@@ -191,7 +191,7 @@ static void qt_closePopups()
- (void)dealloc
{
_window = nil;
- self.platformWindow.clear();
+ _platformWindow.clear();
[super dealloc];
}
@@ -343,27 +343,14 @@ static void qt_closePopups()
@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)
: QPlatformWindow(tlw)
- , m_contentView(nil)
- , m_qtView(nil)
+ , m_view(nil)
, m_nsWindow(0)
- , m_contentViewIsEmbedded(false)
- , m_contentViewIsToBeEmbedded(false)
+ , m_viewIsEmbedded(false)
+ , m_viewIsToBeEmbedded(false)
, m_parentCocoaWindow(0)
, m_isNSWindowChild(false)
, m_effectivelyMaximized(false)
@@ -399,11 +386,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
QMacAutoReleasePool pool;
if (tlw->type() == Qt::ForeignWindow) {
- NSView *foreignView = (NSView *)WId(tlw->property("_q_foreignWinId").value<WId>());
- setContentView(foreignView);
+ m_view = (NSView *)WId(tlw->property("_q_foreignWinId").value<WId>());
} else {
- m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
- m_contentView = m_qtView;
+ m_view = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
// Enable high-dpi OpenGL for retina displays. Enabling has the side
// effect that Cocoa will start calling glViewport(0, 0, width, height),
// overriding any glViewport calls in application code. This is usually not a
@@ -412,14 +397,14 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
if (tlw->supportsOpenGL()) {
BOOL enable = qt_mac_resolveOption(YES, tlw, "_q_mac_wantsBestResolutionOpenGLSurface",
"QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
- [m_contentView setWantsBestResolutionOpenGLSurface:enable];
+ [m_view setWantsBestResolutionOpenGLSurface:enable];
}
BOOL enable = qt_mac_resolveOption(NO, tlw, "_q_mac_wantsLayer",
"QT_MAC_WANTS_LAYER");
- [m_contentView setWantsLayer:enable];
+ [m_view setWantsLayer:enable];
}
setGeometry(tlw->geometry());
- recreateWindow(parent());
+ recreateWindow(QPlatformWindow::parent());
tlw->setGeometry(geometry());
if (tlw->isTopLevel())
setWindowIcon(tlw->icon());
@@ -437,25 +422,23 @@ QCocoaWindow::~QCocoaWindow()
if (m_isNSWindowChild) {
if (m_parentCocoaWindow)
m_parentCocoaWindow->removeChildWindow(this);
- } else if ([m_contentView superview]) {
- [m_contentView removeFromSuperview];
+ } else if ([m_view superview]) {
+ [m_view removeFromSuperview];
}
removeMonitor();
// Make sure to disconnect observer in all case if view is valid
// to avoid notifications received when deleting when using Qt::AA_NativeWindows attribute
- if (m_qtView) {
- [[NSNotificationCenter defaultCenter] removeObserver:m_qtView];
- }
+ if (window()->type() != Qt::ForeignWindow)
+ [[NSNotificationCenter defaultCenter] removeObserver:m_view];
// The QNSView object may outlive the corresponding QCocoaWindow object,
// for example during app shutdown when the QNSView is embedded in a
// foregin NSView hiearchy. Clear the pointers to the QWindow/QCocoaWindow
// here to make sure QNSView does not dereference stale pointers.
- if (m_qtView) {
- [m_qtView clearQWindowPointers];
- }
+ if (window()->type() != Qt::ForeignWindow)
+ [qnsview_cast(m_view) clearQWindowPointers];
// While it is unlikely that this window will be in the popup stack
// during deletetion we clear any pointers here to make sure.
@@ -468,7 +451,7 @@ QCocoaWindow::~QCocoaWindow()
child->m_parentCocoaWindow = 0;
}
- [m_contentView release];
+ [m_view release];
[m_nsWindow release];
[m_windowCursor release];
}
@@ -509,12 +492,12 @@ QRect QCocoaWindow::geometry() const
// QWindows that are embedded in a NSView hiearchy may be considered
// top-level from Qt's point of view but are not from Cocoa's point
// of view. Embedded QWindows get global (screen) geometry.
- if (m_contentViewIsEmbedded) {
- NSPoint windowPoint = [m_contentView convertPoint:NSMakePoint(0, 0) toView:nil];
- NSRect screenRect = [[m_contentView window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
+ if (m_viewIsEmbedded) {
+ NSPoint windowPoint = [m_view convertPoint:NSMakePoint(0, 0) toView:nil];
+ NSRect screenRect = [[m_view window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
NSPoint screenPoint = screenRect.origin;
QPoint position = qt_mac_flipPoint(screenPoint).toPoint();
- QSize size = QRectF::fromCGRect(NSRectToCGRect([m_contentView bounds])).toRect().size();
+ QSize size = QRectF::fromCGRect(NSRectToCGRect([m_view bounds])).toRect().size();
return QRect(position, size);
}
@@ -526,9 +509,9 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::setCocoaGeometry" << window() << rect;
QMacAutoReleasePool pool;
- if (m_contentViewIsEmbedded) {
- if (m_qtView) {
- [m_qtView setFrame:NSMakeRect(0, 0, rect.width(), rect.height())];
+ if (m_viewIsEmbedded) {
+ if (window()->type() != Qt::ForeignWindow) {
+ [m_view setFrame:NSMakeRect(0, 0, rect.width(), rect.height())];
} else {
QPlatformWindow::setGeometry(rect);
}
@@ -548,10 +531,10 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
NSRect bounds = qt_mac_flipRect(rect);
[m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO];
} else {
- [m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
+ [m_view setFrame:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
- if (!m_qtView)
+ if (window()->type() == Qt::ForeignWindow)
QPlatformWindow::setGeometry(rect);
// will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
@@ -576,7 +559,7 @@ void QCocoaWindow::clipWindow(const NSRect &clipRect)
// Clipping top/left offsets the content. Move it back.
NSPoint contentViewOffset = NSMakePoint(qMax(CGFloat(0), NSMinX(clippedWindowRect) - NSMinX(windowFrame)),
qMax(CGFloat(0), NSMaxY(windowFrame) - NSMaxY(clippedWindowRect)));
- [m_contentView setBoundsOrigin:contentViewOffset];
+ [m_view setBoundsOrigin:contentViewOffset];
}
if (NSIsEmptyRect(clippedWindowRect)) {
@@ -662,7 +645,7 @@ void QCocoaWindow::setVisible(bool visible)
if (visible) {
// We need to recreate if the modality has changed as the style mask will need updating
if (m_windowModality != window()->modality() || isNativeWindowTypeInconsistent())
- recreateWindow(parent());
+ recreateWindow(QPlatformWindow::parent());
// Register popup windows. The Cocoa platform plugin will forward mouse events
// to them and close them when needed.
@@ -747,8 +730,8 @@ void QCocoaWindow::setVisible(bool visible)
// In some cases, e.g. QDockWidget, the content view is hidden before moving to its own
// Cocoa window, and then shown again. Therefore, we test for the view being hidden even
// if it's attached to an NSWindow.
- if ([m_contentView isHidden])
- [m_contentView setHidden:NO];
+ if ([m_view isHidden])
+ [m_view setHidden:NO];
} else {
// qDebug() << "close" << this;
#ifndef QT_NO_OPENGL
@@ -781,7 +764,7 @@ void QCocoaWindow::setVisible(bool visible)
[mainWindow makeKeyWindow];
}
} else {
- [m_contentView setHidden:YES];
+ [m_view setHidden:YES];
}
removeMonitor();
@@ -946,7 +929,7 @@ void QCocoaWindow::setWindowTitle(const QString &title)
if (!m_nsWindow)
return;
- CFStringRef windowTitle = QCFString::toCFStringRef(title);
+ CFStringRef windowTitle = title.toCFString();
[m_nsWindow setTitle: const_cast<NSString *>(reinterpret_cast<const NSString *>(windowTitle))];
CFRelease(windowTitle);
}
@@ -958,7 +941,7 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath)
return;
QFileInfo fi(filePath);
- [m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""];
+ [m_nsWindow setRepresentedFilename:fi.exists() ? filePath.toNSString() : @""];
}
void QCocoaWindow::setWindowIcon(const QIcon &icon)
@@ -969,7 +952,7 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon)
if (iconButton == nil) {
if (icon.isNull())
return;
- NSString *title = QCFString::toNSString(window()->title());
+ NSString *title = window()->title().toNSString();
[m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
}
@@ -1080,9 +1063,9 @@ bool QCocoaWindow::isOpaque() const
// When ordering below the window must be tranclucent.
static GLint openglSourfaceOrder = qt_mac_resolveOption(1, "QT_MAC_OPENGL_SURFACE_ORDER");
- bool translucent = (window()->format().alphaBufferSize() > 0
+ bool translucent = window()->format().alphaBufferSize() > 0
|| window()->opacity() < 1
- || (m_qtView && [m_qtView hasMask]))
+ || [qnsview_cast(m_view) hasMask]
|| (surface()->supportsOpenGL() && openglSourfaceOrder == -1);
return !translucent;
}
@@ -1141,8 +1124,8 @@ void QCocoaWindow::setMask(const QRegion &region)
if (m_nsWindow)
[m_nsWindow setBackgroundColor:[NSColor clearColor]];
- [m_qtView setMaskRegion:&region];
- [m_nsWindow setOpaque: isOpaque()];
+ [qnsview_cast(m_view) setMaskRegion:&region];
+ [m_nsWindow setOpaque:isOpaque()];
}
bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
@@ -1171,7 +1154,7 @@ bool QCocoaWindow::setMouseGrabEnabled(bool grab)
WId QCocoaWindow::winId() const
{
- return WId(m_contentView);
+ return WId(m_view);
}
void QCocoaWindow::setParent(const QPlatformWindow *parentWindow)
@@ -1179,38 +1162,16 @@ void QCocoaWindow::setParent(const QPlatformWindow *parentWindow)
qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::setParent" << window() << (parentWindow ? parentWindow->window() : 0);
// recreate the window for compatibility
- bool unhideAfterRecreate = parentWindow && !m_contentViewIsToBeEmbedded && ![m_contentView isHidden];
+ bool unhideAfterRecreate = parentWindow && !m_viewIsToBeEmbedded && ![m_view isHidden];
recreateWindow(parentWindow);
if (unhideAfterRecreate)
- [m_contentView setHidden:NO];
+ [m_view setHidden:NO];
setCocoaGeometry(geometry());
}
-NSView *QCocoaWindow::contentView() const
+NSView *QCocoaWindow::view() const
{
- return m_contentView;
-}
-
-void QCocoaWindow::setContentView(NSView *contentView)
-{
- // Remove and release the previous content view
- if (m_nsWindow)
- [m_nsWindow setContentView:nil];
- else
- [m_contentView removeFromSuperview];
-
- [m_contentView release];
-
- // Insert and retain the new content view
- [contentView retain];
- m_contentView = contentView;
- m_qtView = 0; // The new content view is not a QNSView.
- recreateWindow(parent()); // Adds the content view to parent NSView
-}
-
-QNSView *QCocoaWindow::qtView() const
-{
- return m_qtView;
+ return m_view;
}
NSWindow *QCocoaWindow::nativeWindow() const
@@ -1220,7 +1181,7 @@ NSWindow *QCocoaWindow::nativeWindow() const
void QCocoaWindow::setEmbeddedInForeignView(bool embedded)
{
- m_contentViewIsToBeEmbedded = embedded;
+ m_viewIsToBeEmbedded = embedded;
// Release any previosly created NSWindow.
[m_nsWindow closeAndRelease];
m_nsWindow = 0;
@@ -1237,7 +1198,7 @@ void QCocoaWindow::windowDidMove()
if (m_isNSWindowChild)
return;
- [m_qtView updateGeometry];
+ [qnsview_cast(m_view) updateGeometry];
}
void QCocoaWindow::windowDidResize()
@@ -1249,14 +1210,14 @@ void QCocoaWindow::windowDidResize()
return;
clipChildWindows();
- [m_qtView updateGeometry];
+ [qnsview_cast(m_view) updateGeometry];
}
void QCocoaWindow::windowDidEndLiveResize()
{
if (m_synchedWindowState == Qt::WindowMaximized && ![m_nsWindow isZoomed]) {
m_effectivelyMaximized = false;
- [m_qtView notifyWindowStateChanged:Qt::WindowNoState];
+ [qnsview_cast(m_view) notifyWindowStateChanged:Qt::WindowNoState];
}
}
@@ -1332,8 +1293,8 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
bool usesNSPanel = [m_nsWindow isKindOfClass:[QNSPanel class]];
// No child QNSWindow should notify its QNSView
- if (m_nsWindow && m_qtView && m_parentCocoaWindow && !oldParentCocoaWindow)
- [[NSNotificationCenter defaultCenter] removeObserver:m_qtView
+ if (m_nsWindow && (window()->type() != Qt::ForeignWindow) && m_parentCocoaWindow && !oldParentCocoaWindow)
+ [[NSNotificationCenter defaultCenter] removeObserver:m_view
name:nil object:m_nsWindow];
// Remove current window (if any)
@@ -1351,8 +1312,8 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
// Only non-child QNSWindows should notify their QNSViews
// (but don't register more than once).
- if (m_qtView && (noPreviousWindow || (wasNSWindowChild && !m_isNSWindowChild)))
- [[NSNotificationCenter defaultCenter] addObserver:m_qtView
+ if ((window()->type() != Qt::ForeignWindow) && (noPreviousWindow || (wasNSWindowChild && !m_isNSWindowChild)))
+ [[NSNotificationCenter defaultCenter] addObserver:m_view
selector:@selector(windowNotification:)
name:nil // Get all notifications
object:m_nsWindow];
@@ -1360,13 +1321,13 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
if (oldParentCocoaWindow) {
if (!m_isNSWindowChild || oldParentCocoaWindow != m_parentCocoaWindow)
oldParentCocoaWindow->removeChildWindow(this);
- m_forwardWindow.assign(oldParentCocoaWindow);
+ m_forwardWindow = oldParentCocoaWindow;
}
setNSWindow(m_nsWindow);
}
- if (m_contentViewIsToBeEmbedded) {
+ if (m_viewIsToBeEmbedded) {
// An embedded window doesn't have its own NSWindow.
} else if (!parentWindow) {
// QPlatformWindow subclasses must sync up with QWindow on creation:
@@ -1396,18 +1357,18 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
}
} else {
// Child windows have no NSWindow, link the NSViews instead.
- if ([m_contentView superview])
- [m_contentView removeFromSuperview];
+ if ([m_view superview])
+ [m_view removeFromSuperview];
- [m_parentCocoaWindow->m_contentView addSubview : m_contentView];
+ [m_parentCocoaWindow->m_view addSubview:m_view];
QRect rect = windowGeometry();
// Prevent setting a (0,0) window size; causes opengl context
// "Invalid Drawable" warnings.
if (rect.isNull())
rect.setSize(QSize(1, 1));
NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
- [m_contentView setFrame:frame];
- [m_contentView setHidden: YES];
+ [m_view setFrame:frame];
+ [m_view setHidden:!window()->isVisible()];
}
m_nsWindow.ignoresMouseEvents =
@@ -1438,9 +1399,9 @@ void QCocoaWindow::reinsertChildWindow(QCocoaWindow *child)
void QCocoaWindow::requestActivateWindow()
{
- NSWindow *window = [m_contentView window];
- [ window makeFirstResponder : m_contentView ];
- [ window makeKeyWindow ];
+ NSWindow *window = [m_view window];
+ [window makeFirstResponder:m_view];
+ [window makeKeyWindow];
}
bool QCocoaWindow::shouldUseNSPanel()
@@ -1525,14 +1486,14 @@ QCocoaNSWindow * QCocoaWindow::createNSWindow()
void QCocoaWindow::setNSWindow(QCocoaNSWindow *window)
{
- if (window.contentView != m_contentView) {
- [m_contentView setPostsFrameChangedNotifications: NO];
- [m_contentView retain];
- if (m_contentView.superview) // m_contentView comes from another NSWindow
- [m_contentView removeFromSuperview];
- [window setContentView:m_contentView];
- [m_contentView release];
- [m_contentView setPostsFrameChangedNotifications: YES];
+ if (window.contentView != m_view) {
+ [m_view setPostsFrameChangedNotifications:NO];
+ [m_view retain];
+ if (m_view.superview) // m_view comes from another NSWindow
+ [m_view removeFromSuperview];
+ [window setContentView:m_view];
+ [m_view release];
+ [m_view setPostsFrameChangedNotifications:YES];
}
}
@@ -1590,7 +1551,7 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState)
return;
// if content view width or height is 0 then the window animations will crash so
// do nothing except set the new state
- NSRect contentRect = [contentView() frame];
+ NSRect contentRect = m_view.frame;
if (contentRect.size.width <= 0 || contentRect.size.height <= 0) {
qWarning("invalid window content view size, check your window geometry");
m_synchedWindowState = newState;
@@ -1699,8 +1660,8 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor)
// Othervise, set the cursor if this window is under the mouse. In
// this case QNSView::cursorUpdate will set the cursor as the pointer
// moves.
- if (m_nsWindow && m_qtView) {
- [m_nsWindow invalidateCursorRectsForView : m_qtView];
+ if (m_nsWindow && window()->type() != Qt::ForeignWindow) {
+ [m_nsWindow invalidateCursorRectsForView:m_view];
} else {
if (m_windowUnderMouse)
[cursor set];
@@ -1711,9 +1672,9 @@ void QCocoaWindow::registerTouch(bool enable)
{
m_registerTouchCount += enable ? 1 : -1;
if (enable && m_registerTouchCount == 1)
- [m_contentView setAcceptsTouchEvents:YES];
+ [m_view setAcceptsTouchEvents:YES];
else if (m_registerTouchCount == 0)
- [m_contentView setAcceptsTouchEvents:NO];
+ [m_view setAcceptsTouchEvents:NO];
}
void QCocoaWindow::setContentBorderThickness(int topThickness, int bottomThickness)
@@ -1813,7 +1774,7 @@ qreal QCocoaWindow::devicePixelRatio() const
// methods such as [NSWindow backingScaleFacor] might not give the correct
// result, for example if setWantsBestResolutionOpenGLSurface is not set or
// or ignored by the OpenGL driver.
- NSSize backingSize = [m_contentView convertSizeToBacking:NSMakeSize(1.0, 1.0)];
+ NSSize backingSize = [m_view convertSizeToBacking:NSMakeSize(1.0, 1.0)];
return backingSize.height;
}
@@ -1823,8 +1784,8 @@ bool QCocoaWindow::isWindowExposable()
{
QSize size = geometry().size();
bool validGeometry = (size.width() > 0 && size.height() > 0);
- bool validScreen = ([[m_contentView window] screen] != 0);
- bool nonHiddenSuperView = ![[m_contentView superview] isHidden];
+ bool validScreen = ([[m_view window] screen] != 0);
+ bool nonHiddenSuperView = ![[m_view superview] isHidden];
return (validGeometry && validScreen && nonHiddenSuperView);
}
@@ -1936,11 +1897,11 @@ QPoint QCocoaWindow::bottomLeftClippedByNSWindowOffsetStatic(QWindow *window)
QPoint QCocoaWindow::bottomLeftClippedByNSWindowOffset() const
{
- if (!m_contentView)
+ if (!m_view)
return QPoint();
- const NSPoint origin = [m_contentView isFlipped] ? NSMakePoint(0, [m_contentView frame].size.height)
+ const NSPoint origin = [m_view isFlipped] ? NSMakePoint(0, [m_view frame].size.height)
: NSMakePoint(0, 0);
- const NSRect visibleRect = [m_contentView visibleRect];
+ const NSRect visibleRect = [m_view visibleRect];
return QPoint(visibleRect.origin.x, -visibleRect.origin.y + (origin.y - visibleRect.size.height));
}
@@ -1960,3 +1921,5 @@ void QCocoaWindow::setFrameStrutEventsEnabled(bool enabled)
{
m_frameStrutEventsEnabled = enabled;
}
+
+#include "moc_qcocoawindow.cpp"
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm
index 721b0fb4d1..e09bb1e362 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.mm
+++ b/src/plugins/platforms/cocoa/qmacclipboard.mm
@@ -113,7 +113,7 @@ QMacPasteboard::QMacPasteboard(CFStringRef name, uchar mt)
if (err == noErr) {
PasteboardSetPromiseKeeper(paste, promiseKeeper, this);
} else {
- qDebug("PasteBoard: Error creating pasteboard: %s [%d]", QCFString::toQString(name).toLatin1().constData(), (int)err);
+ qDebug("PasteBoard: Error creating pasteboard: %s [%d]", QString::fromCFString(name).toLatin1().constData(), (int)err);
}
resolvingBeforeDestruction = false;
}
@@ -139,7 +139,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id,
const long promise_id = (long)id;
// Find the kept promise
- const QString flavorAsQString = QCFString::toQString(flavor);
+ const QString flavorAsQString = QString::fromCFString(flavor);
QMacPasteboard::Promise promise;
for (int i = 0; i < qpaste->promises.size(); i++){
QMacPasteboard::Promise tmp = qpaste->promises[i];
@@ -380,7 +380,7 @@ QMacPasteboard::formats() const
const int type_count = CFArrayGetCount(types);
for (int i = 0; i < type_count; ++i) {
- const QString flavor = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(types, i));
+ const QString flavor = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(types, i));
#ifdef DEBUG_PASTEBOARD
qDebug(" -%s", qPrintable(QString(flavor)));
#endif
@@ -423,7 +423,7 @@ QMacPasteboard::hasFormat(const QString &format) const
const int type_count = CFArrayGetCount(types);
for (int i = 0; i < type_count; ++i) {
- const QString flavor = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(types, i));
+ const QString flavor = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(types, i));
#ifdef DEBUG_PASTEBOARD
qDebug(" -%s [0x%x]", qPrintable(QString(flavor)), mime_type);
#endif
@@ -487,13 +487,13 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
const int type_count = CFArrayGetCount(types);
for (int i = 0; i < type_count; ++i) {
CFStringRef flavor = static_cast<CFStringRef>(CFArrayGetValueAtIndex(types, i));
- if (c_flavor == QCFString::toQString(flavor)) {
+ if (c_flavor == QString::fromCFString(flavor)) {
QCFType<CFDataRef> macBuffer;
if (PasteboardCopyItemFlavorData(paste, id, flavor, &macBuffer) == noErr) {
QByteArray buffer((const char *)CFDataGetBytePtr(macBuffer), CFDataGetLength(macBuffer));
if (!buffer.isEmpty()) {
#ifdef DEBUG_PASTEBOARD
- qDebug(" - %s [%s] (%s)", qPrintable(format), qPrintable(QCFString::toQString(flavor)), qPrintable(c->convertorName()));
+ qDebug(" - %s [%s] (%s)", qPrintable(format), qPrintable(QString::fromNSString(flavor)), qPrintable(c->convertorName()));
#endif
buffer.detach(); //detach since we release the macBuffer
retList.append(buffer);
@@ -502,7 +502,7 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
}
} else {
#ifdef DEBUG_PASTEBOARD
- qDebug(" - NoMatch %s [%s] (%s)", qPrintable(c_flavor), qPrintable(QCFString::toQString(flavor)), qPrintable(c->convertorName()));
+ qDebug(" - NoMatch %s [%s] (%s)", qPrintable(c_flavor), qPrintable(QString::fromNSString(flavor)), qPrintable(c->convertorName()));
#endif
}
}
@@ -565,7 +565,7 @@ QString qt_mac_get_pasteboardString(PasteboardRef paste)
if (pb) {
NSString *text = [pb stringForType:NSStringPboardType];
if (text)
- return QCFString::toQString(text);
+ return QString::fromNSString(text);
}
return QString();
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index ee0bf75606..ca4df73e6d 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -267,16 +267,16 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)viewDidMoveToSuperview
{
- if (!(m_platformWindow->m_contentViewIsToBeEmbedded))
+ if (!(m_platformWindow->m_viewIsToBeEmbedded))
return;
if ([self superview]) {
- m_platformWindow->m_contentViewIsEmbedded = true;
+ m_platformWindow->m_viewIsEmbedded = true;
QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry());
m_platformWindow->updateExposedGeometry();
QWindowSystemInterface::flushWindowSystemEvents();
} else {
- m_platformWindow->m_contentViewIsEmbedded = false;
+ m_platformWindow->m_viewIsEmbedded = false;
}
}
@@ -338,7 +338,7 @@ static bool _q_dontOverrideCtrlLMB = false;
NSRect rect = [self frame];
NSRect windowRect = [[self window] frame];
geometry = QRect(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
- } else if (m_platformWindow->m_contentViewIsToBeEmbedded) {
+ } else if (m_platformWindow->m_viewIsToBeEmbedded) {
// embedded child window, use the frame rect ### merge with case below
geometry = QRectF::fromCGRect(NSRectToCGRect([self bounds])).toRect();
} else {
@@ -368,7 +368,7 @@ static bool _q_dontOverrideCtrlLMB = false;
// Don't send the geometry change if the QWindow is designated to be
// embedded in a foreign view hiearchy but has not actually been
// embedded yet - it's too early.
- if (m_platformWindow->m_contentViewIsToBeEmbedded && !m_platformWindow->m_contentViewIsEmbedded)
+ if (m_platformWindow->m_viewIsToBeEmbedded && !m_platformWindow->m_viewIsEmbedded)
return;
// Send a geometry change event to Qt, if it's ready to handle events
@@ -401,7 +401,7 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)windowNotification : (NSNotification *) windowNotification
{
- //qDebug() << "windowNotification" << QCFString::toQString([windowNotification name]);
+ //qDebug() << "windowNotification" << QString::fromNSString([windowNotification name]);
NSString *notificationName = [windowNotification name];
if (notificationName == NSWindowDidBecomeKeyNotification) {
@@ -739,14 +739,17 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)handleMouseEvent:(NSEvent *)theEvent
{
- bool isTabletEvent = [self handleTabletEvent: theEvent];
+ // Tablet events may come in via the mouse event handlers,
+ // check if this is a valid tablet event first.
+ if ([self handleTabletEvent: theEvent])
+ return;
QPointF qtWindowPoint;
QPointF qtScreenPoint;
QNSView *targetView = self;
if (m_platformWindow && m_platformWindow->m_forwardWindow) {
if (theEvent.type == NSLeftMouseDragged || theEvent.type == NSLeftMouseUp)
- targetView = m_platformWindow->m_forwardWindow->m_qtView;
+ targetView = qnsview_cast(m_platformWindow->m_forwardWindow->view());
else
m_platformWindow->m_forwardWindow.clear();
}
@@ -756,7 +759,7 @@ static bool _q_dontOverrideCtrlLMB = false;
// Tooltips must be transparent for mouse events
// The bug reference is QTBUG-46379
if (!popup->m_windowFlags.testFlag(Qt::ToolTip)) {
- if (QNSView *popupView = popup->qtView())
+ if (QNSView *popupView = qnsview_cast(popup->view()))
targetView = popupView;
}
}
@@ -768,8 +771,8 @@ static bool _q_dontOverrideCtrlLMB = false;
nativeDrag->setLastMouseEvent(theEvent, self);
Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];
- QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint, m_buttons, keyboardModifiers,
- isTabletEvent ? Qt::MouseEventSynthesizedByQt : Qt::MouseEventNotSynthesized);
+ QWindowSystemInterface::handleMouseEvent(targetView->m_window, timestamp, qtWindowPoint, qtScreenPoint,
+ m_buttons, keyboardModifiers, Qt::MouseEventNotSynthesized);
}
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent
@@ -1582,7 +1585,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
// ignore text for the U+F700-U+F8FF range. This is used by Cocoa when
// delivering function keys (e.g. arrow keys, backspace, F1-F35, etc.)
if (!(modifiers & (Qt::ControlModifier | Qt::MetaModifier)) && (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff))
- text = QCFString::toQString(characters);
+ text = QString::fromNSString(characters);
QWindow *window = [self topLevelWindow];
@@ -1745,9 +1748,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
QString commitString;
if ([aString length]) {
if ([aString isKindOfClass:[NSAttributedString class]]) {
- commitString = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));
+ commitString = QString::fromCFString(reinterpret_cast<CFStringRef>([aString string]));
} else {
- commitString = QCFString::toQString(reinterpret_cast<CFStringRef>(aString));
+ commitString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString));
};
}
QObject *fo = QGuiApplication::focusObject();
@@ -1777,7 +1780,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
if ([aString isKindOfClass:[NSAttributedString class]]) {
// Preedit string has attribution
- preeditString = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));
+ preeditString = QString::fromCFString(reinterpret_cast<CFStringRef>([aString string]));
int composingLength = preeditString.length();
int index = 0;
// Create attributes for individual sections of preedit text
@@ -1806,7 +1809,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
}
} else {
// No attributes specified, take only the preedit text.
- preeditString = QCFString::toQString(reinterpret_cast<CFStringRef>(aString));
+ preeditString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString));
}
if (attrs.isEmpty()) {
@@ -1989,7 +1992,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
// Add custom types supported by the application.
for (int i = 0; i < customTypes.size(); i++) {
- [supportedTypes addObject:QCFString::toNSString(customTypes[i])];
+ [supportedTypes addObject:customTypes[i].toNSString()];
}
[self registerForDraggedTypes:supportedTypes];
}
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index b96a9491e8..cbae4fc50f 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qnswindowdelegate.h"
+#include "qcocoahelpers.h"
#include <QDebug>
#include <qpa/qwindowsysteminterface.h>
@@ -60,7 +61,7 @@
if (m_cocoaWindow->m_windowUnderMouse) {
QPointF windowPoint;
QPointF screenPoint;
- [m_cocoaWindow->m_qtView convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
+ [qnsview_cast(m_cocoaWindow->view()) convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleEnterEvent(m_cocoaWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
}
}
@@ -110,8 +111,8 @@
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
{
Q_UNUSED(newFrame);
- if (m_cocoaWindow && m_cocoaWindow->m_qtView)
- [m_cocoaWindow->m_qtView notifyWindowWillZoom:![window isZoomed]];
+ if (m_cocoaWindow && m_cocoaWindow->window()->type() != Qt::ForeignWindow)
+ [qnsview_cast(m_cocoaWindow->view()) notifyWindowWillZoom:![window isZoomed]];
return YES;
}
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index 0b5b06c44f..8098c5e829 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -673,7 +673,7 @@ QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
case PPK_DocumentName: {
CFStringRef name;
PMPrintSettingsGetJobName(d->settings(), &name);
- ret = QCFString::toQString(name);
+ ret = QString::fromCFString(name);
break;
}
case PPK_Duplex: {
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp
index 2d107a6e27..b5065ba380 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp
@@ -80,7 +80,7 @@ public:
bitmap.Reset();
D2D1_SIZE_U size = {
- width, height
+ UINT32(width), UINT32(height)
};
HRESULT hr = deviceContext->get()->CreateBitmap(size, data, pitch,
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
index bf96a7d683..f6b58d1ba6 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -86,7 +86,7 @@ int QEglFSKmsDevice::crtcForConnector(drmModeResPtr resources, drmModeConnectorP
return -1;
}
-static const char * const connector_type_names[] = {
+static const char * const connector_type_names[] = { // must match DRM_MODE_CONNECTOR_*
"None",
"VGA",
"DVI",
@@ -102,6 +102,8 @@ static const char * const connector_type_names[] = {
"HDMI",
"TV",
"eDP",
+ "Virtual",
+ "DSI"
};
static QByteArray nameForConnector(const drmModeConnectorPtr connector)
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index 9fdf021d07..966d1a7e80 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -49,6 +49,7 @@
const char kImePlatformDataInputView[] = "inputView";
const char kImePlatformDataInputAccessoryView[] = "inputAccessoryView";
+const char kImePlatformDataHideShortcutsBar[] = "hideShortcutsBar";
const char kImePlatformDataReturnKeyType[] = "returnKeyType";
@class QIOSLocaleListener;
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index 02deab59b5..01cb3badea 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -521,6 +521,7 @@ bool QIOSMenu::eventFilter(QObject *obj, QEvent *event)
QVariantMap imPlatformData = queryEvent->value(Qt::ImPlatformData).toMap();
imPlatformData.insert(kImePlatformDataInputView, QVariant::fromValue(static_cast<void *>(m_pickerView)));
imPlatformData.insert(kImePlatformDataInputAccessoryView, QVariant::fromValue(static_cast<void *>(m_pickerView.toolbar)));
+ imPlatformData.insert(kImePlatformDataHideShortcutsBar, true);
queryEvent->setValue(Qt::ImPlatformData, imPlatformData);
queryEvent->setValue(Qt::ImEnabled, true);
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 3c95083e45..d7b0a323ad 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -236,6 +236,17 @@
self.inputView = [[[WrapperView alloc] initWithView:inputView] autorelease];
if (UIView *accessoryView = static_cast<UIView *>(platformData.value(kImePlatformDataInputAccessoryView).value<void *>()))
self.inputAccessoryView = [[[WrapperView alloc] initWithView:accessoryView] autorelease];
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_9_0) {
+ if (platformData.value(kImePlatformDataHideShortcutsBar).toBool()) {
+ // According to the docs, leadingBarButtonGroups/trailingBarButtonGroups should be set to nil to hide the shortcuts bar.
+ // However, starting with iOS 10, the API has been surrounded with NS_ASSUME_NONNULL, which contradicts this and causes
+ // compiler warnings. And assigning just an empty array causes layout asserts. Hence, we assign empty button groups instead.
+ UIBarButtonItemGroup *leading = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
+ UIBarButtonItemGroup *trailing = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease];
+ self.inputAssistantItem.leadingBarButtonGroups = @[leading];
+ self.inputAssistantItem.trailingBarButtonGroups = @[trailing];
+ }
+ }
self.undoManager.groupsByEvent = NO;
[self rebuildUndoStack];
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index 938e63d95a..2a6e059243 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -5,7 +5,7 @@ android: SUBDIRS += android
!android: SUBDIRS += minimal
-!android:if(!win32|qtConfig(freetype)): SUBDIRS += offscreen
+!android:qtConfig(freetype): SUBDIRS += offscreen
qtConfig(xcb) {
SUBDIRS += xcb
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 79b5bbae41..fd7eca9e32 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -507,7 +507,7 @@ static const uint CmdTbl[] = { // Multimedia keys mapping table
Qt::Key_Open, // 30 0x1e APPCOMMAND_OPEN
Qt::Key_Close, // 31 0x1f APPCOMMAND_CLOSE
Qt::Key_Save, // 32 0x20 APPCOMMAND_SAVE
- Qt::Key_Print, // 33 0x21 APPCOMMAND_PRINT
+ Qt::Key_Printer, // 33 0x21 APPCOMMAND_PRINT
Qt::Key_Undo, // 34 0x22 APPCOMMAND_UNDO
Qt::Key_Redo, // 35 0x23 APPCOMMAND_REDO
Qt::Key_Copy, // 36 0x24 APPCOMMAND_COPY
diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp
index e9938894e6..f84688f045 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.cpp
+++ b/src/plugins/platforms/winrt/qwinrttheme.cpp
@@ -369,6 +369,17 @@ QVariant QWinRTTheme::styleHint(QPlatformIntegration::StyleHint hint)
return QVariant();
}
+QVariant QWinRTTheme::themeHint(ThemeHint hint) const
+{
+ qCDebug(lcQpaTheme) << __FUNCTION__ << hint;
+ switch (hint) {
+ case StyleNames:
+ return QStringList() << QStringLiteral("fusion") << QStringLiteral("windows");
+ default:
+ return QPlatformTheme::themeHint(hint);
+ }
+}
+
const QPalette *QWinRTTheme::palette(Palette type) const
{
Q_D(const QWinRTTheme);
diff --git a/src/plugins/platforms/winrt/qwinrttheme.h b/src/plugins/platforms/winrt/qwinrttheme.h
index 2b8817d014..bd244f9fdb 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.h
+++ b/src/plugins/platforms/winrt/qwinrttheme.h
@@ -60,7 +60,7 @@ public:
const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
static QVariant styleHint(QPlatformIntegration::StyleHint hint);
-
+ QVariant themeHint(ThemeHint hint) const override;
private:
QScopedPointer<QWinRTThemePrivate> d_ptr;
Q_DECLARE_PRIVATE(QWinRTTheme)
diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README
index 15cf4cf241..5efc9b7f99 100644
--- a/src/plugins/platforms/xcb/README
+++ b/src/plugins/platforms/xcb/README
@@ -21,3 +21,13 @@ REDUCING RUNTIME DEPENDENCIES
The '-qt-xcb' configure option can be used to get rid of most xcb- dependencies. Only libxcb will
still be linked dynamically, since it will be most likely be pulled in via other dependencies anyway.
This should allow for binaries that are portable across most modern Linux distributions.
+
+PACKAGE VERSION REQUIREMENTS
+
+When using touch input via XInput 2.2 or higher, there is a potential issue on systems that ship with
+a libXi older than 1.7.4. This is because XIAllowTouchEvents can deadlock with libXi 1.7.3 and earlier.
+When touch events are never received, this is not an issue, so plain mouse/keyboard systems are not affected.
+See http://lists.x.org/archives/xorg-devel/2014-July/043059.html for details on the libXi patch.
+Qt versions before 5.8 attempted to recognize this scenario based on the pkg-config package version and skip
+the call. This has been removed starting from 5.8 since relying on pkg-config package versions is unsafe given
+that Qt must also support systems with limited or incomplete pkg-config setups.
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
index d82a1f2d17..e52677d091 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
@@ -10,7 +10,6 @@ qtConfig(xcb-glx) {
DEFINES += XCB_HAS_XCB_GLX
QMAKE_USE += xcb_glx
}
-QMAKE_USE += xcb
LIBS += $$QMAKE_LIBS_DYNLOAD
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index b95ad4b5c9..f9c32cd0a4 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -275,8 +275,6 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c)
{
Q_ASSERT(QClipboard::Clipboard == 0);
Q_ASSERT(QClipboard::Selection == 1);
- m_xClipboard[QClipboard::Clipboard] = 0;
- m_xClipboard[QClipboard::Selection] = 0;
m_clientClipboard[QClipboard::Clipboard] = 0;
m_clientClipboard[QClipboard::Selection] = 0;
m_timestamp[QClipboard::Clipboard] = XCB_CURRENT_TIME;
@@ -329,6 +327,10 @@ QXcbClipboard::~QXcbClipboard()
}
free(reply);
}
+
+ if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection])
+ delete m_clientClipboard[QClipboard::Clipboard];
+ delete m_clientClipboard[QClipboard::Selection];
}
void QXcbClipboard::incrTransactionPeeker(xcb_generic_event_t *ge, bool &accepted)
@@ -378,9 +380,9 @@ QMimeData * QXcbClipboard::mimeData(QClipboard::Mode mode)
return m_clientClipboard[mode];
} else {
if (!m_xClipboard[mode])
- m_xClipboard[mode] = new QXcbClipboardMime(mode, this);
+ m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
- return m_xClipboard[mode];
+ return m_xClipboard[mode].data();
}
}
@@ -730,7 +732,7 @@ void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_eve
// here we care only about the xfixes events that come from non Qt processes
if (event->owner != XCB_NONE && event->owner != owner()) {
if (!m_xClipboard[mode]) {
- m_xClipboard[mode] = new QXcbClipboardMime(mode, this);
+ m_xClipboard[mode].reset(new QXcbClipboardMime(mode, this));
} else {
m_xClipboard[mode]->reset();
}
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h
index 58c7f32c4c..ffd565c56f 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.h
+++ b/src/plugins/platforms/xcb/qxcbclipboard.h
@@ -98,7 +98,7 @@ private:
QClipboard::Mode modeForAtom(xcb_atom_t atom) const;
// Selection and Clipboard
- QXcbClipboardMime *m_xClipboard[2];
+ QScopedPointer<QXcbClipboardMime> m_xClipboard[2];
QMimeData *m_clientClipboard[2];
xcb_timestamp_t m_timestamp[2];
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 1147fc82b2..93f8db92bf 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -697,26 +697,7 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
if (m_xiGrab) {
// XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2)
// http://lists.x.org/archives/xorg-devel/2014-July/043059.html
-#ifndef XCB_USE_XINPUT2
- static bool allowTouchWarningShown = false;
- if (!allowTouchWarningShown) {
- allowTouchWarningShown = true;
- qWarning("Skipping XIAllowTouchEvents() because it was not possible to detect libXi version at build time."
- " Minimum libXi version required is 1.7.4."
- " Expect issues with touch behavior.");
- }
-#elif QT_LIBRARY_VERSION(xinput2) < QT_VERSION_CHECK(1, 7, 4)
- static bool allowTouchWarningShown = false;
- if (!allowTouchWarningShown) {
- allowTouchWarningShown = true;
- qWarning("Skipping XIAllowTouchEvents() due to not having libXi >= 1.7.4."
- " libXi version at build time was %d.%d.%d."
- " Expect issues with touch behavior.",
- QT_LIBRARY_VERSION_MAJOR(xinput2),
- QT_LIBRARY_VERSION_MINOR(xinput2),
- QT_LIBRARY_VERSION_PATCH(xinput2));
- }
-#else
+#ifdef XCB_USE_XINPUT2
XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid,
xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch);
#endif
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index 11e0c998b1..4de4be43d1 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -359,17 +359,27 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget)
return;
xcb_cursor_t c = XCB_CURSOR_NONE;
+ bool isBitmapCursor = false;
+
if (cursor) {
- const QXcbCursorCacheKey key(*cursor);
- CursorHash::iterator it = m_cursorHash.find(key);
- if (it == m_cursorHash.end()) {
- const Qt::CursorShape shape = cursor->shape();
- it = m_cursorHash.insert(key, shape == Qt::BitmapCursor ? createBitmapCursor(cursor) : createFontCursor(shape));
+ const Qt::CursorShape shape = cursor->shape();
+ isBitmapCursor = shape == Qt::BitmapCursor;
+
+ if (!isBitmapCursor) {
+ const QXcbCursorCacheKey key(*cursor);
+ CursorHash::iterator it = m_cursorHash.find(key);
+ if (it == m_cursorHash.end()) {
+ it = m_cursorHash.insert(key, createFontCursor(shape));
+ }
+ c = it.value();
+ } else {
+ // Do not cache bitmap cursors, as otherwise they have unclear
+ // lifetime (we effectively leak xcb_cursor_t).
+ c = createBitmapCursor(cursor);
}
- c = it.value();
}
- w->setCursor(c);
+ w->setCursor(c, isBitmapCursor);
}
static int cursorIdForShape(int cshape)
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 802f7b85ce..b0c5ac79f9 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -61,13 +61,8 @@
#include <stdio.h>
-//this has to be included before egl, since egl pulls in X headers
#include <QtGui/private/qguiapplication_p.h>
-#ifdef XCB_USE_EGL
-# include <QtPlatformSupport/private/qt_egl_p.h>
-#endif
-
#ifdef XCB_USE_XLIB
#include <X11/Xlib.h>
#endif
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 189ec53050..b1575cbee4 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -57,10 +57,6 @@
#include <QtPlatformHeaders/qxcbintegrationfunctions.h>
#include <QtPlatformHeaders/qxcbscreenfunctions.h>
-#ifndef QT_NO_DBUS
-#include "QtPlatformSupport/private/qdbusmenuconnection_p.h"
-#endif
-
#ifdef XCB_USE_XLIB
# include <X11/Xlib.h>
#else
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index 8728b6e937..acecbf4116 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -53,7 +53,6 @@ class QWidget;
class QXcbScreen;
class QXcbConnection;
class QXcbNativeInterfaceHandler;
-class QDBusMenuConnection;
class Q_XCB_EXPORT QXcbNativeInterface : public QPlatformNativeInterface
{
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c81858c408..ee7bfd6c53 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -258,7 +258,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
free_prop = true;
}
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
static const QTextCodec* mapper = QTextCodec::codecForLocale();
int errCode = 0;
if (mapper) {
@@ -274,6 +274,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
mapper = QTextCodec::codecForName("latin1");
if (!mapper || !mapper->canEncode(s))
return Q_NULLPTR;
+#endif
static QByteArray qcs;
qcs = s.toLatin1();
tp.value = (uchar*)qcs.data();
@@ -281,6 +282,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
tp.format = 8;
tp.nitems = qcs.length();
free_prop = false;
+#if QT_CONFIG(textcodec)
}
#endif
return &tp;
@@ -326,6 +328,7 @@ QXcbWindow::QXcbWindow(QWindow *window)
, m_lastWindowStateEvent(-1)
, m_syncState(NoSyncNeeded)
, m_pendingSyncRequest(0)
+ , m_currentBitmapCursor(XCB_CURSOR_NONE)
{
setConnection(xcbScreen()->connection());
}
@@ -600,6 +603,9 @@ void QXcbWindow::create()
QXcbWindow::~QXcbWindow()
{
+ if (m_currentBitmapCursor != XCB_CURSOR_NONE) {
+ xcb_free_cursor(xcb_connection(), m_currentBitmapCursor);
+ }
if (window()->type() != Qt::ForeignWindow)
destroy();
else {
@@ -2416,6 +2422,17 @@ static inline int fixed1616ToInt(FP1616 val)
return int((qreal(val >> 16)) + (val & 0xFFFF) / (qreal)0xFFFF);
}
+void QXcbWindow::handleXIMouseButtonState(const xcb_ge_event_t *event)
+{
+ QXcbConnection *conn = connection();
+ const xXIDeviceEvent *ev = reinterpret_cast<const xXIDeviceEvent *>(event);
+ if (ev->buttons_len > 0) {
+ unsigned char *buttonMask = (unsigned char *) &ev[1];
+ for (int i = 1; i <= 15; ++i)
+ conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i));
+ }
+}
+
// With XI 2.2+ press/release/motion comes here instead of the above handlers.
void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source)
{
@@ -2431,12 +2448,6 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
const Qt::MouseButton button = conn->xiToQtMouseButton(ev->detail);
- if (ev->buttons_len > 0) {
- unsigned char *buttonMask = (unsigned char *) &ev[1];
- for (int i = 1; i <= 15; ++i)
- conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i));
- }
-
const char *sourceName = 0;
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) {
const QMetaObject *metaObject = qt_getEnumMetaObject(source);
@@ -2446,18 +2457,23 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
switch (ev->evtype) {
case XI_ButtonPress:
+ handleXIMouseButtonState(event);
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButton(button, true);
handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
break;
case XI_ButtonRelease:
+ handleXIMouseButtonState(event);
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButton(button, false);
handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
break;
case XI_Motion:
+ // Here we do NOT call handleXIMouseButtonState because we don't expect button state change to be bundled with motion.
+ // When a touchscreen is pressed, an XI_Motion event occurs in which XIMaskIsSet says the left button is pressed,
+ // but we don't want QGuiApplicationPrivate::processMouseEvent() to react by generating a mouse press event.
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName);
handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source);
@@ -2669,10 +2685,22 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab)
return result;
}
-void QXcbWindow::setCursor(xcb_cursor_t cursor)
+void QXcbWindow::setCursor(xcb_cursor_t cursor, bool isBitmapCursor)
{
- xcb_change_window_attributes(xcb_connection(), m_window, XCB_CW_CURSOR, &cursor);
- xcb_flush(xcb_connection());
+ xcb_connection_t *conn = xcb_connection();
+
+ xcb_change_window_attributes(conn, m_window, XCB_CW_CURSOR, &cursor);
+ xcb_flush(conn);
+
+ if (m_currentBitmapCursor != XCB_CURSOR_NONE) {
+ xcb_free_cursor(conn, m_currentBitmapCursor);
+ }
+
+ if (isBitmapCursor) {
+ m_currentBitmapCursor = cursor;
+ } else {
+ m_currentBitmapCursor = XCB_CURSOR_NONE;
+ }
}
void QXcbWindow::windowEvent(QEvent *event)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index f62938ba8a..92f3f7a67c 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -103,7 +103,7 @@ public:
bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
- void setCursor(xcb_cursor_t cursor);
+ void setCursor(xcb_cursor_t cursor, bool isBitmapCursor);
QSurfaceFormat format() const Q_DECL_OVERRIDE;
@@ -139,6 +139,7 @@ public:
void handleFocusOutEvent(const xcb_focus_out_event_t *event) Q_DECL_OVERRIDE;
void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE;
#ifdef XCB_USE_XINPUT22
+ void handleXIMouseButtonState(const xcb_ge_event_t *);
void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) Q_DECL_OVERRIDE;
void handleXIEnterLeave(xcb_ge_event_t *) Q_DECL_OVERRIDE;
#endif
@@ -271,6 +272,7 @@ protected:
SyncState m_syncState;
QXcbSyncWindowRequest *m_pendingSyncRequest;
+ xcb_cursor_t m_currentBitmapCursor;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro
index 20481e4834..a1dec2b0b5 100644
--- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro
+++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro
@@ -11,8 +11,7 @@ XCB_DIR = ../../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
-QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
+QMAKE_USE += xcb/nolink
# ignore compiler warnings in 3rdparty code
QMAKE_CFLAGS_STATIC_LIB+=-w
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index ec0fa68871..246bb1f118 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -66,9 +66,6 @@ include(gl_integrations/gl_integrations.pri)
CONFIG += qpa/genericunixfontdatabase
-qtConfig(dbus-linked): \
- QT += dbus
-
!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = ../../../3rdparty/xcb
diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp
index 9ddef85bf9..eabd7e7295 100644
--- a/src/printsupport/kernel/qplatformprintdevice.cpp
+++ b/src/printsupport/kernel/qplatformprintdevice.cpp
@@ -59,7 +59,7 @@ QPlatformPrintDevice::QPlatformPrintDevice()
m_haveOutputBins(false),
m_haveDuplexModes(false),
m_haveColorModes(false)
-#ifndef QT_NO_MIMETYPES
+#ifndef QT_NO_MIMETYPE
, m_haveMimeTypes(false)
#endif
{
@@ -77,7 +77,7 @@ QPlatformPrintDevice::QPlatformPrintDevice(const QString &id)
m_haveOutputBins(false),
m_haveDuplexModes(false),
m_haveColorModes(false)
-#ifndef QT_NO_MIMETYPES
+#ifndef QT_NO_MIMETYPE
, m_haveMimeTypes(false)
#endif
{
diff --git a/src/sql/configure.pri b/src/sql/configure.pri
index 948808f4f7..1d8847b4bc 100644
--- a/src/sql/configure.pri
+++ b/src/sql/configure.pri
@@ -22,11 +22,8 @@ defineTest(qtConfLibrary_psqlConfig) {
$${1}.libs = "$$val_escape(libs)"
includedir -= $$QMAKE_DEFAULT_INCDIRS
$${1}.includedir = "$$val_escape(includedir)"
- !isEmpty(includedir): \
- $${1}.cflags = "-I$$val_escape(includedir)"
export($${1}.libs)
export($${1}.includedir)
- export($${1}.cflags)
return(true)
}
return(false)
@@ -65,11 +62,8 @@ defineTest(qtConfLibrary_mysqlConfig) {
includedir ~= s/^-I//g
includedir -= $$QMAKE_DEFAULT_INCDIRS
$${1}.includedir = "$$val_escape(includedir)"
- !isEmpty(includedir): \
- $${1}.cflags = "-I$$val_escape(includedir)"
export($${1}.libs)
export($${1}.includedir)
- export($${1}.cflags)
return(true)
}
return(false)
diff --git a/src/sql/kernel/qsqlrecord.cpp b/src/sql/kernel/qsqlrecord.cpp
index ef60cd4cf5..d5adff67a4 100644
--- a/src/sql/kernel/qsqlrecord.cpp
+++ b/src/sql/kernel/qsqlrecord.cpp
@@ -94,7 +94,7 @@ QString QSqlRecordPrivate::createField(int index, const QString &prefix) const
view within the database). QSqlRecord supports adding and
removing fields as well as setting and retrieving field values.
- The values of a record's fields' can be set by name or position
+ The values of a record's fields can be set by name or position
with setValue(); if you want to set a field to null use
setNull(). To find the position of a field by name use indexOf(),
and to find the name of a field at a particular position use
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 63e79c777f..b9bb10818e 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -58,10 +58,6 @@
#include <QtCore/qsize.h>
#include <QtCore/qrect.h>
-#ifdef QT_NETWORK_LIB
-# include <QtNetwork/qhostaddress.h>
-#endif
-
QT_BEGIN_NAMESPACE
@@ -192,26 +188,6 @@ template<> inline char *toString(const QVariant &v)
return qstrdup(vstring.constData());
}
-#ifdef QT_NETWORK_LIB
-/*!
- \internal
- */
-template<> inline char *toString(const QHostAddress &addr)
-{
- switch (addr.protocol()) {
- case QAbstractSocket::UnknownNetworkLayerProtocol:
- return qstrdup("<unknown address (parse error)>");
- case QAbstractSocket::AnyIPProtocol:
- return qstrdup("QHostAddress::Any");
- case QAbstractSocket::IPv4Protocol:
- case QAbstractSocket::IPv6Protocol:
- break;
- }
-
- return qstrdup(addr.toString().toLatin1().constData());
-}
-#endif
-
inline char *toString(std::nullptr_t)
{
return toString(QLatin1String("nullptr"));
@@ -357,6 +333,10 @@ int main(int argc, char *argv[]) \
# define QTEST_ADD_GPU_BLACKLIST_SUPPORT
#endif
+#if defined(QT_NETWORK_LIB)
+# include <QtTest/qtest_network.h>
+#endif
+
#if defined(QT_WIDGETS_LIB)
#include <QtTest/qtest_widgets.h>
diff --git a/src/testlib/qtest_network.h b/src/testlib/qtest_network.h
new file mode 100644
index 0000000000..6f6b4c1b8e
--- /dev/null
+++ b/src/testlib/qtest_network.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtTest module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTEST_NETWORK_H
+#define QTEST_NETWORK_H
+
+#include <QtTest/qtest.h>
+
+// enable NETWORK features
+#ifndef QT_NETWORK_LIB
+#define QT_NETWORK_LIB
+#endif
+
+#if 0
+#pragma qt_class(QtTestNetwork)
+#endif
+
+#include <QtNetwork/QHostAddress>
+#include <QtNetwork/QNetworkCookie>
+#include <QtNetwork/QNetworkReply>
+
+#if 0
+// inform syncqt
+#pragma qt_no_master_include
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QTest
+{
+/*!
+ \internal
+ */
+inline char *toString(const QHostAddress &addr)
+{
+ switch (addr.protocol()) {
+ case QAbstractSocket::UnknownNetworkLayerProtocol:
+ return qstrdup("<unknown address (parse error)>");
+ case QAbstractSocket::AnyIPProtocol:
+ return qstrdup("QHostAddress::Any");
+ case QAbstractSocket::IPv4Protocol:
+ case QAbstractSocket::IPv6Protocol:
+ break;
+ }
+
+ return toString(addr.toString());
+}
+
+/*!
+ \internal
+ */
+inline char *toString(QNetworkReply::NetworkError code)
+{
+ const QMetaObject *mo = &QNetworkReply::staticMetaObject;
+ int index = mo->indexOfEnumerator("NetworkError");
+ if (index == -1)
+ return qstrdup("");
+
+ QMetaEnum qme = mo->enumerator(index);
+ return qstrdup(qme.valueToKey(code));
+}
+
+/*!
+ \internal
+ */
+inline char *toString(const QNetworkCookie &cookie)
+{
+ return toString(cookie.toRawForm());
+}
+
+/*!
+ \internal
+ */
+inline char *toString(const QList<QNetworkCookie> &list)
+{
+ QByteArray result = "QList(";
+ if (!list.isEmpty()) {
+ for (const QNetworkCookie &cookie : list)
+ result += "QNetworkCookie(" + cookie.toRawForm() + "), ";
+ result.chop(2); // remove trailing ", "
+ }
+ result.append(')');
+ return toString(result);
+}
+
+} // namespace QTest
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 106fa7abd5..045431fcaf 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -130,57 +130,57 @@ do {\
#endif // !QT_NO_EXCEPTIONS
-#define QTRY_LOOP_IMPL(__expr, __timeoutValue, __step) \
- if (!(__expr)) { \
+#define QTRY_LOOP_IMPL(expr, timeoutValue, step) \
+ if (!(expr)) { \
QTest::qWait(0); \
} \
- int __i = 0; \
- for (; __i < __timeoutValue && !(__expr); __i += __step) { \
- QTest::qWait(__step); \
+ int qt_test_i = 0; \
+ for (; qt_test_i < timeoutValue && !(expr); qt_test_i += step) { \
+ QTest::qWait(step); \
}
-#define QTRY_TIMEOUT_DEBUG_IMPL(__expr, __timeoutValue, __step)\
- if (!(__expr)) { \
- QTRY_LOOP_IMPL((__expr), (2 * __timeoutValue), __step);\
- if (__expr) { \
+#define QTRY_TIMEOUT_DEBUG_IMPL(expr, timeoutValue, step)\
+ if (!(expr)) { \
+ QTRY_LOOP_IMPL((expr), (2 * timeoutValue), step);\
+ if (expr) { \
QString msg = QString::fromUtf8("QTestLib: This test case check (\"%1\") failed because the requested timeout (%2 ms) was too short, %3 ms would have been sufficient this time."); \
- msg = msg.arg(QString::fromUtf8(#__expr)).arg(__timeoutValue).arg(__timeoutValue + __i); \
+ msg = msg.arg(QString::fromUtf8(#expr)).arg(timeoutValue).arg(timeoutValue + qt_test_i); \
QFAIL(qPrintable(msg)); \
} \
}
-#define QTRY_IMPL(__expr, __timeout)\
- const int __step = 50; \
- const int __timeoutValue = __timeout; \
- QTRY_LOOP_IMPL((__expr), __timeoutValue, __step); \
- QTRY_TIMEOUT_DEBUG_IMPL((__expr), __timeoutValue, __step)\
+#define QTRY_IMPL(expr, timeout)\
+ const int qt_test_step = 50; \
+ const int qt_test_timeoutValue = timeout; \
+ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \
+ QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\
// Will try to wait for the expression to become true while allowing event processing
-#define QTRY_VERIFY_WITH_TIMEOUT(__expr, __timeout) \
+#define QTRY_VERIFY_WITH_TIMEOUT(expr, timeout) \
do { \
- QTRY_IMPL((__expr), __timeout);\
- QVERIFY(__expr); \
+ QTRY_IMPL((expr), timeout);\
+ QVERIFY(expr); \
} while (0)
-#define QTRY_VERIFY(__expr) QTRY_VERIFY_WITH_TIMEOUT((__expr), 5000)
+#define QTRY_VERIFY(expr) QTRY_VERIFY_WITH_TIMEOUT((expr), 5000)
// Will try to wait for the expression to become true while allowing event processing
-#define QTRY_VERIFY2_WITH_TIMEOUT(__expr, __messageExpression, __timeout) \
+#define QTRY_VERIFY2_WITH_TIMEOUT(expr, messageExpression, timeout) \
do { \
- QTRY_IMPL((__expr), __timeout);\
- QVERIFY2(__expr, __messageExpression); \
+ QTRY_IMPL((expr), timeout);\
+ QVERIFY2(expr, messageExpression); \
} while (0)
-#define QTRY_VERIFY2(__expr, __messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((__expr), (__messageExpression), 5000)
+#define QTRY_VERIFY2(expr, messageExpression) QTRY_VERIFY2_WITH_TIMEOUT((expr), (messageExpression), 5000)
// Will try to wait for the comparison to become successful while allowing event processing
-#define QTRY_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \
+#define QTRY_COMPARE_WITH_TIMEOUT(expr, expected, timeout) \
do { \
- QTRY_IMPL(((__expr) == (__expected)), __timeout);\
- QCOMPARE((__expr), __expected); \
+ QTRY_IMPL(((expr) == (expected)), timeout);\
+ QCOMPARE((expr), expected); \
} while (0)
-#define QTRY_COMPARE(__expr, __expected) QTRY_COMPARE_WITH_TIMEOUT((__expr), __expected, 5000)
+#define QTRY_COMPARE(expr, expected) QTRY_COMPARE_WITH_TIMEOUT((expr), expected, 5000)
#define QSKIP_INTERNAL(statement) \
do {\
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 3fe1aeea96..d76dbb8c75 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -28,6 +28,7 @@ HEADERS = qbenchmark.h \
qtesteventloop.h \
qtest_global.h \
qtest_gui.h \
+ qtest_network.h \
qtest_widgets.h \
qtest.h \
qtestkeyboard.h \
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 68b6b28945..0466ca2946 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -11,22 +11,10 @@ MODULE_DEFINES = \
QT_VERSION_MINOR=$$QT_MINOR_VERSION \
QT_VERSION_PATCH=$$QT_PATCH_VERSION \
QT_BOOTSTRAPPED \
- QT_LITE_UNICODE \
- QT_NO_CAST_TO_ASCII \
- QT_NO_CODECS \
- QT_NO_DATASTREAM \
- QT_NO_LIBRARY \
- QT_NO_QOBJECT \
- QT_NO_SYSTEMLOCALE \
- QT_NO_THREAD \
- QT_NO_UNICODETABLES \
- QT_NO_USING_NAMESPACE \
- QT_NO_DEPRECATED \
- QT_NO_TRANSLATION
+ QT_NO_CAST_TO_ASCII
DEFINES += \
$$MODULE_DEFINES \
- QT_CRYPTOGRAPHICHASH_ONLY_SHA1 \
QT_NO_FOREACH \
QT_NO_CAST_FROM_ASCII
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index 8dbb1bf350..bd94017821 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -204,7 +204,10 @@ static QString classNameForInterface(const QString &interface, ClassType classTy
return retval;
}
-static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out")
+// ### Qt6 Remove the two isSignal ifs
+// They are only here because before signal arguments where previously searched as "In" so to maintain compatibility
+// we first search for "Out" and if not found we search for "In"
+static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection::Annotations &annotations, int paramId = -1, const char *direction = "Out", bool isSignal = false)
{
int type = QDBusMetaType::signatureToType(signature.toLatin1());
if (type == QVariant::Invalid) {
@@ -221,9 +224,15 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
qttype = annotations.value(oldAnnotationName);
if (qttype.isEmpty()) {
- fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
- fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
- qPrintable(annotationName));
+ if (!isSignal || qstrcmp(direction, "Out") == 0) {
+ fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
+ fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
+ qPrintable(annotationName));
+ }
+
+ if (isSignal)
+ return qtTypeName(signature, annotations, paramId, "In", isSignal);
+
exit(1);
}
@@ -323,6 +332,23 @@ static void writeArgList(QTextStream &ts, const QStringList &argNames,
}
}
+static void writeSignalArgList(QTextStream &ts, const QStringList &argNames,
+ const QDBusIntrospection::Annotations &annotations,
+ const QDBusIntrospection::Arguments &outputArgs)
+{
+ bool first = true;
+ int argPos = 0;
+ for (int i = 0; i < outputArgs.count(); ++i) {
+ const QDBusIntrospection::Argument &arg = outputArgs.at(i);
+ QString type = constRefArg(qtTypeName(arg.type, annotations, i, "Out", true /* isSignal */));
+
+ if (!first)
+ ts << ", ";
+ ts << type << argNames.at(argPos++);
+ first = false;
+ }
+}
+
static QString propertyGetter(const QDBusIntrospection::Property &property)
{
QString getter = property.annotations.value(QLatin1String("org.qtproject.QtDBus.PropertyGetter"));
@@ -637,7 +663,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
hs << "void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
- writeArgList(hs, argNames, signal.annotations, signal.outputArgs);
+ writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);
hs << ");" << endl; // finished for header
}
@@ -981,7 +1007,7 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
hs << "void " << signal.name << "(";
QStringList argNames = makeArgNames(signal.outputArgs);
- writeArgList(hs, argNames, signal.annotations, signal.outputArgs);
+ writeSignalArgList(hs, argNames, signal.annotations, signal.outputArgs);
hs << ");" << endl; // finished for header
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 11b3659990..6e1bee94c4 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -873,7 +873,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QString newName = value.toString();
QString oldName = idx.data().toString();
- if (newName == idx.data().toString())
+ if (newName == oldName)
return true;
const QString parentPath = filePath(parent(idx));
@@ -903,15 +903,13 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent;
int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName);
- d->addNode(parentNode, newName,indexNode->info->fileInfo());
parentNode->visibleChildren.removeAt(visibleLocation);
QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName);
parentNode->children[newName] = oldValue;
- QFileInfo info(parentPath, newName);
oldValue->fileName = newName;
oldValue->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER
- oldValue->populate(d->fileInfoGatherer.getInfo(info));
+ oldValue->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName)));
#endif
oldValue->isVisible = true;
@@ -1698,6 +1696,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile
node->volumeName = QString::fromWCharArray(name);
}
#endif
+ Q_ASSERT(!parentNode->children.contains(fileName));
parentNode->children.insert(fileName, node);
return node;
}
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 92398d981f..e7149a3097 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -85,11 +85,7 @@ public:
explicit QFileSystemNode(const QString &filename = QString(), QFileSystemNode *p = 0)
: fileName(filename), populatedChildren(false), isVisible(false), dirtyChildrenIndex(-1), parent(p), info(0) {}
~QFileSystemNode() {
- QHash<QString, QFileSystemNode*>::const_iterator i = children.constBegin();
- while (i != children.constEnd()) {
- delete i.value();
- ++i;
- }
+ qDeleteAll(children);
delete info;
info = 0;
parent = 0;
@@ -164,32 +160,30 @@ public:
void updateIcon(QFileIconProvider *iconProvider, const QString &path) {
if (info)
info->icon = iconProvider->icon(QFileInfo(path));
- QHash<QString, QFileSystemNode *>::const_iterator iterator;
- for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
+ for (QFileSystemNode *child : qAsConst(children)) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
if (!path.isEmpty()) {
if (path.endsWith(QLatin1Char('/')))
- iterator.value()->updateIcon(iconProvider, path + iterator.value()->fileName);
+ child->updateIcon(iconProvider, path + child->fileName);
else
- iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ child->updateIcon(iconProvider, path + QLatin1Char('/') + child->fileName);
} else
- iterator.value()->updateIcon(iconProvider, iterator.value()->fileName);
+ child->updateIcon(iconProvider, child->fileName);
}
}
void retranslateStrings(QFileIconProvider *iconProvider, const QString &path) {
if (info)
info->displayType = iconProvider->type(QFileInfo(path));
- QHash<QString, QFileSystemNode *>::const_iterator iterator;
- for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) {
+ for (QFileSystemNode *child : qAsConst(children)) {
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
if (!path.isEmpty()) {
if (path.endsWith(QLatin1Char('/')))
- iterator.value()->retranslateStrings(iconProvider, path + iterator.value()->fileName);
+ child->retranslateStrings(iconProvider, path + child->fileName);
else
- iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName);
+ child->retranslateStrings(iconProvider, path + QLatin1Char('/') + child->fileName);
} else
- iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName);
+ child->retranslateStrings(iconProvider, child->fileName);
}
}
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index f172679d04..e727d7fe56 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -253,7 +253,7 @@
\snippet shareddirmodel/main.cpp 0
The model is set up to use data from a certain file system. The call to
- \l{QFileSystemModel::}{setRootPath()} tell the model which drive on the
+ \l{QFileSystemModel::}{setRootPath()} tells the model which drive on the
file system to expose to the views.
We create two views so that we can examine the items held in the model in two
@@ -304,7 +304,7 @@
signals and slots mechanism.
This section describes some basic concepts that are central to the way
- item of data are accessed by other components via a model class. More
+ items of data are accessed by other components via a model class. More
advanced concepts are discussed in later sections.
\section3 Model indexes
@@ -737,7 +737,7 @@
\image spinboxdelegate-example.png
- We subclass the delegate from \l QItemDelegate because we do not want
+ We subclass the delegate from \l QStyledItemDelegate because we do not want
to write custom display functions. However, we must still provide
functions to manage the editor widget:
@@ -1869,7 +1869,7 @@
\codeline
\snippet qsortfilterproxymodel/main.cpp 1
- Since proxy models are inherit from QAbstractItemModel, they can be connected to
+ Since proxy models inherit from QAbstractItemModel, they can be connected to
any kind of view, and can be shared between views. They can also be used to
process the information obtained from other proxy models in a pipeline arrangement.
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index d52aff5131..e1ba3759e0 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -274,6 +274,11 @@ QGraphicsWidget::~QGraphicsWidget()
// Remove this graphics widget from widgetStyles
widgetStyles()->setStyleForWidget(this, 0);
+
+ // Unset the parent here, when we're still a QGraphicsWidget.
+ // It is otherwise done in ~QGraphicsItem() where we'd be
+ // calling QGraphicsWidget members on an ex-QGraphicsWidget object
+ setParentItem(Q_NULLPTR);
}
/*!
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index a4e24b80b1..fff09b46d0 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1786,13 +1786,18 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
d->autoScroll = false;
d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
d->autoScroll = autoScroll;
- QRect rect(visualRect(d->currentSelectionStartIndex).center(), pos);
if (command.testFlag(QItemSelectionModel::Toggle)) {
command &= ~QItemSelectionModel::Toggle;
d->ctrlDragSelectionFlag = d->selectionModel->isSelected(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
command |= d->ctrlDragSelectionFlag;
}
- setSelection(rect, command);
+
+ if ((command & QItemSelectionModel::Current) == 0) {
+ setSelection(QRect(pos, QSize(1, 1)), command);
+ } else {
+ QRect rect(visualRect(d->currentSelectionStartIndex).center(), pos);
+ setSelection(rect, command);
+ }
// signal handlers may change the model
emit pressed(index);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 815ae7fe33..b94aa826d3 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -608,7 +608,7 @@ void qt_init_tooltip_palette()
#endif
}
-#ifndef QT_NO_STATEMACHINE
+#if QT_CONFIG(statemachine)
void qRegisterGuiStateMachine();
void qUnregisterGuiStateMachine();
#endif
@@ -634,7 +634,7 @@ void QApplicationPrivate::initialize()
if (application_type != QApplicationPrivate::Tty)
(void) QApplication::style(); // trigger creation of application style
-#ifndef QT_NO_STATEMACHINE
+#if QT_CONFIG(statemachine)
// trigger registering of QStateMachine's GUI types
qRegisterGuiStateMachine();
#endif
@@ -862,7 +862,7 @@ QApplication::~QApplication()
QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;
QApplicationPrivate::widgetCount = false;
-#ifndef QT_NO_STATEMACHINE
+#if QT_CONFIG(statemachine)
// trigger unregistering of QStateMachine's GUI types
qUnregisterGuiStateMachine();
#endif
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 73e82c577c..3e60723f17 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -165,7 +165,7 @@ public:
int insertRow(int row);
void insertRows(int row, int count);
void removeRow(int row);
- void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item);
+ bool setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item);
void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout);
void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget);
@@ -933,21 +933,21 @@ void QFormLayoutPrivate::removeRow(int row)
m_matrix.removeRow(row);
}
-void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item)
+bool QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item)
{
const bool fullRow = role == QFormLayout::SpanningRole;
const int column = role == QFormLayout::SpanningRole ? 1 : static_cast<int>(role);
if (Q_UNLIKELY(uint(row) >= uint(m_matrix.rowCount()) || uint(column) > 1U)) {
qWarning("QFormLayoutPrivate::setItem: Invalid cell (%d, %d)", row, column);
- return;
+ return false;
}
if (!item)
- return;
+ return false;
if (Q_UNLIKELY(m_matrix(row, column))) {
qWarning("QFormLayoutPrivate::setItem: Cell (%d, %d) already occupied", row, column);
- return;
+ return false;
}
QFormLayoutItem *i = new QFormLayoutItem(item);
@@ -955,6 +955,7 @@ void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutIte
m_matrix(row, column) = i;
m_things.append(i);
+ return true;
}
void QFormLayoutPrivate::setLayout(int row, QFormLayout::ItemRole role, QLayout *layout)
@@ -971,7 +972,9 @@ void QFormLayoutPrivate::setWidget(int row, QFormLayout::ItemRole role, QWidget
if (widget) {
Q_Q(QFormLayout);
q->addChildWidget(widget);
- setItem(row, role, QLayoutPrivate::createWidgetItem(q, widget));
+ QWidgetItem *item = QLayoutPrivate::createWidgetItem(q, widget);
+ if (!setItem(row, role, item))
+ delete item;
}
}
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 76568a2c33..ee0c28ec76 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -306,6 +306,8 @@ void QLayoutItem::invalidate()
/*!
If this item is a QLayout, it is returned as a QLayout; otherwise
0 is returned. This function provides type-safe casting.
+
+ \sa spacerItem(), widget()
*/
QLayout * QLayoutItem::layout()
{
@@ -315,6 +317,8 @@ QLayout * QLayoutItem::layout()
/*!
If this item is a QSpacerItem, it is returned as a QSpacerItem;
otherwise 0 is returned. This function provides type-safe casting.
+
+ \sa layout(), widget()
*/
QSpacerItem * QLayoutItem::spacerItem()
{
@@ -345,8 +349,14 @@ QSpacerItem * QSpacerItem::spacerItem()
*/
/*!
- If this item is a QWidget, it is returned as a QWidget; otherwise
- 0 is returned. This function provides type-safe casting.
+ If this item manages a QWidget, returns that widget. Otherwise,
+ \c nullptr is returned.
+
+ \note While the functions layout() and spacerItem() perform casts, this
+ function returns another object: QLayout and QSpacerItem inherit QLayoutItem,
+ while QWidget does not.
+
+ \sa layout(), spacerItem()
*/
QWidget * QLayoutItem::widget()
{
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
index fe2edca613..c833e64822 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp
@@ -39,8 +39,6 @@
#include "qbasickeyeventtransition_p.h"
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
#include <qdebug.h>
#include <private/qabstracttransition_p.h>
@@ -204,5 +202,3 @@ void QBasicKeyEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
#include "moc_qbasickeyeventtransition_p.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index 576c5beb5d..d3b90f6104 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -51,13 +51,11 @@
// We mean it.
//
-#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
+QT_REQUIRE_CONFIG(qeventtransition);
+
QT_BEGIN_NAMESPACE
class QBasicKeyEventTransitionPrivate;
@@ -92,6 +90,4 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_STATEMACHINE
-
#endif
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index 39c69b95f5..f404c33a2f 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qbasicmouseeventtransition_p.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
#include <QtGui/qpainterpath.h>
#include <qdebug.h>
@@ -209,5 +206,3 @@ void QBasicMouseEventTransition::onTransition(QEvent *)
QT_END_NAMESPACE
#include "moc_qbasicmouseeventtransition_p.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index 72320a52dc..d6d37eb03e 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -51,13 +51,11 @@
// We mean it.
//
-#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qabstracttransition.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <QtGui/qevent.h>
+QT_REQUIRE_CONFIG(qeventtransition);
+
QT_BEGIN_NAMESPACE
class QPainterPath;
@@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_STATEMACHINE
-
#endif
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index c909048213..8d722a4475 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include <QtCore/qstatemachine.h>
-
-#ifndef QT_NO_STATEMACHINE
-
#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
#include <QtWidgets/qgraphicssceneevent.h>
@@ -471,5 +468,3 @@ void qUnregisterGuiStateMachine()
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
index 0e9f8458c2..1578f294d5 100644
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ b/src/widgets/statemachine/qkeyeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qkeyeventtransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qbasickeyeventtransition_p.h"
#include <QtCore/qstatemachine.h>
#include <private/qeventtransition_p.h>
@@ -175,5 +172,3 @@ void QKeyEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
#include "moc_qkeyeventtransition.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index 1e3f02acd8..23ce3c40be 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(qeventtransition);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QKeyEventTransitionPrivate;
class Q_WIDGETS_EXPORT QKeyEventTransition : public QEventTransition
@@ -75,8 +74,6 @@ private:
Q_DECLARE_PRIVATE(QKeyEventTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
index 047a9779fe..c58dae55a3 100644
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qmouseeventtransition.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qmouseeventtransition.h"
-
-#ifndef QT_NO_STATEMACHINE
-
#include "qbasicmouseeventtransition_p.h"
#include <QtCore/qstatemachine.h>
#include <QtGui/qpainterpath.h>
@@ -203,5 +200,3 @@ void QMouseEventTransition::onTransition(QEvent *event)
QT_END_NAMESPACE
#include "moc_qmouseeventtransition.cpp"
-
-#endif //QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index 43185b140d..3f40224d8c 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtCore/qeventtransition.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(qeventtransition);
-#ifndef QT_NO_STATEMACHINE
+QT_BEGIN_NAMESPACE
class QMouseEventTransitionPrivate;
class QPainterPath;
@@ -79,8 +78,6 @@ private:
Q_DECLARE_PRIVATE(QMouseEventTransition)
};
-#endif //QT_NO_STATEMACHINE
-
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/statemachine/statemachine.pri b/src/widgets/statemachine/statemachine.pri
index 2eb1e05be6..7b6407bde5 100644
--- a/src/widgets/statemachine/statemachine.pri
+++ b/src/widgets/statemachine/statemachine.pri
@@ -1,5 +1,8 @@
-SOURCES += $$PWD/qguistatemachine.cpp
-!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) {
+
+qtConfig(statemachine): \
+ SOURCES += $$PWD/qguistatemachine.cpp
+
+qtConfig(qeventtransition) {
HEADERS += \
$$PWD/qkeyeventtransition.h \
$$PWD/qmouseeventtransition.h \
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index a8f58eabb3..fa80a7a6ca 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -769,7 +769,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
\fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap)
\relates <qdrawutil.h>
\since 4.6
- \overload
\brief The qDrawBorderPixmap function is for drawing a pixmap into
the margins of a rectangle.
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index a0fff82dc0..ee5fd704dc 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -187,7 +187,9 @@ void QPixmapStyle::polish(QWidget *widget)
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
}
+#if QT_CONFIG(gestures)
QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture);
+#endif
}
if (qobject_cast<QScrollBar*>(widget))
@@ -217,8 +219,10 @@ void QPixmapStyle::unpolish(QWidget *widget)
if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
widget->removeEventFilter(this);
+#if QT_CONFIG(gestures)
if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget))
QScroller::ungrabGesture(scrollArea->viewport());
+#endif
QCommonStyle::unpolish(widget);
}
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 9e95d086bd..5059616870 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1315,7 +1315,9 @@ QDockWidget::DockWidgetFeatures QDockWidget::features() const
By default, this property is \c true.
- \sa isWindow()
+ When this property changes, the \c {topLevelChanged()} signal is emitted.
+
+ \sa isWindow(), topLevelChanged()
*/
void QDockWidget::setFloating(bool floating)
{
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 725cc637d6..b4f2b8959e 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -92,21 +92,6 @@
QT_BEGIN_NAMESPACE
-namespace {
-// TODO use QtMacExtras copy of this function when available.
-inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePlatformFunction(const QByteArray &functionName)
-{
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
- nativeInterface->nativeResourceFunctionForIntegration(functionName);
- if (Q_UNLIKELY(!function))
- qWarning("Qt could not resolve function %s from "
- "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()",
- functionName.constData());
- return function;
-}
-} //namespsace
-
class QMacCocoaViewContainerPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QMacCocoaViewContainer)
@@ -137,12 +122,8 @@ QMacCocoaViewContainerPrivate::~QMacCocoaViewContainerPrivate()
QMacCocoaViewContainer::QMacCocoaViewContainer(NSView *view, QWidget *parent)
: QWidget(*new QMacCocoaViewContainerPrivate, parent, 0)
{
-
- if (view)
- setCocoaView(view);
-
- // QMacCocoaViewContainer requires a native window handle.
setAttribute(Qt::WA_NativeWindow);
+ setCocoaView(view);
}
/*!
@@ -173,13 +154,23 @@ void QMacCocoaViewContainer::setCocoaView(NSView *view)
[view retain];
d->nsview = view;
- // Create window and platformwindow
- winId();
- QPlatformWindow *platformWindow = this->windowHandle()->handle();
-
- // Set the new view as the content view for the window.
- typedef void (*SetWindowContentViewFunction)(QPlatformWindow *window, NSView *nsview);
- reinterpret_cast<SetWindowContentViewFunction>(resolvePlatformFunction("setwindowcontentview"))(platformWindow, view);
+ QWindow *window = windowHandle();
+
+ // Note that we only set the flag on the QWindow, and not the QWidget.
+ // These two are not in sync, so from a QWidget standpoint the widget
+ // is not a Window, and hence will be shown when the parent widget is
+ // shown, like all QWidget children.
+ window->setFlags(Qt::ForeignWindow);
+ window->setProperty("_q_foreignWinId", view ? WId(view) : QVariant());
+
+ // Destroying the platform window implies hiding the window, and we
+ // also lose the geometry information that the platform window kept,
+ // and fall back to the stale QWindow geometry, so we update the two
+ // based on the widget visibility and geometry, which is up to date.
+ window->destroy();
+ window->setVisible(isVisible());
+ window->setGeometry(geometry());
+ window->create();
[oldView release];
}
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index af6d13a647..f354495e70 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1514,7 +1514,7 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e)
if (layout)
layout->setViewport(QRect());
- if (!placeholderText.isEmpty() && doc->isEmpty()) {
+ if (!placeholderText.isEmpty() && doc->isEmpty() && !control->isPreediting()) {
QColor col = control->palette().text().color();
col.setAlpha(128);
p->setPen(col);
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index d5ecb150a8..47806a194e 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -2584,6 +2584,11 @@ bool QWidgetTextControl::isWordSelectionEnabled() const
return d->wordSelectionEnabled;
}
+bool QWidgetTextControl::isPreediting()
+{
+ return d_func()->isPreediting();
+}
+
#ifndef QT_NO_PRINTER
void QWidgetTextControl::print(QPagedPaintDevice *printer) const
{
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index e1687f83a3..b45f4fff74 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -173,6 +173,8 @@ public:
bool isWordSelectionEnabled() const;
void setWordSelectionEnabled(bool enabled);
+ bool isPreediting();
+
void print(QPagedPaintDevice *printer) const;
virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const;
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index ee60823003..49c8184d4b 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -127,6 +127,12 @@ public:
#endif
~QXmlAttributes();
+ void swap(QXmlAttributes &other) Q_DECL_NOTHROW
+ {
+ qSwap(attList, other.attList);
+ qSwap(d, other.d);
+ }
+
int index(const QString& qName) const;
int index(QLatin1String qName) const;
int index(const QString& uri, const QString& localPart) const;
@@ -155,6 +161,7 @@ private:
QXmlAttributesPrivate *d;
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes)
//
// SAX Input Source