summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-22 11:30:00 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-22 11:30:01 +0200
commitd314819fc02139e05e16c56657898c704f7fb48f (patch)
treea61ba968233634948401c8339f9613844de1c2b5 /src
parent9f888d2fde9c5413e5519e0914e9b13638760985 (diff)
parente0e9e196a72ffe5457034894eaaadc90ed0d34ef (diff)
Merge dev into 5.8
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/android/LICENSE11
-rw-r--r--src/3rdparty/android/qt_attribution.json11
-rw-r--r--src/3rdparty/angle/SYSTEMINFO_LICENSE22
-rw-r--r--src/3rdparty/angle/TRACEEVENT_LICENSE27
-rw-r--r--src/3rdparty/angle/qt_attribution.json61
-rw-r--r--src/3rdparty/atspi2/LICENSE482
-rw-r--r--src/3rdparty/atspi2/qt_attribution.json11
-rw-r--r--src/3rdparty/double-conversion/qt_attribution.json14
-rw-r--r--src/3rdparty/easing/LICENSE25
-rw-r--r--src/3rdparty/easing/qt_attribution.json11
-rw-r--r--src/3rdparty/forkfd/LICENSE19
-rw-r--r--src/3rdparty/forkfd/qt_attribution.json12
-rw-r--r--src/3rdparty/freebsd/LICENSE31
-rw-r--r--src/3rdparty/freebsd/qt_attribution.json17
-rw-r--r--src/3rdparty/freetype/qt_attribution.json13
-rw-r--r--src/3rdparty/freetype_dependency.pri4
-rw-r--r--src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro6
-rw-r--r--src/3rdparty/harfbuzz-ng/qt_attribution.json25
-rw-r--r--src/3rdparty/harfbuzz/qt_attribution.json17
-rw-r--r--src/3rdparty/harfbuzz_dependency.pri6
-rw-r--r--src/3rdparty/iaccessible2/LICENSE38
-rw-r--r--src/3rdparty/iaccessible2/qt_attribution.json17
-rw-r--r--src/3rdparty/libjpeg/LICENSE50
-rw-r--r--src/3rdparty/libjpeg/qt_attribution.json13
-rw-r--r--src/3rdparty/libpng/qt_attribution.json15
-rw-r--r--src/3rdparty/md4/qt_attribution.json10
-rw-r--r--src/3rdparty/md5/qt_attribution.json11
-rw-r--r--src/3rdparty/pcre/qt_attribution.json15
-rw-r--r--src/3rdparty/pcre_dependency.pri2
-rw-r--r--src/3rdparty/pixman/LICENSE20
-rw-r--r--src/3rdparty/pixman/qt_attribution.json13
-rw-r--r--src/3rdparty/png_dependency.pri15
-rw-r--r--src/3rdparty/rfc6234/LICENSE34
-rw-r--r--src/3rdparty/rfc6234/qt_attribution.json12
-rw-r--r--src/3rdparty/sha1/qt_attribution.json12
-rw-r--r--src/3rdparty/sha3/BRG_ENDIAN_LICENSE21
-rw-r--r--src/3rdparty/sha3/CC0_LICENSE99
-rw-r--r--src/3rdparty/sha3/qt_attribution.json29
-rw-r--r--src/3rdparty/sqlite.pri2
-rw-r--r--src/3rdparty/sqlite/qt_attribution.json12
-rw-r--r--src/3rdparty/wintab/qt_attribution.json12
-rw-r--r--src/3rdparty/xcb/LICENSE23
-rw-r--r--src/3rdparty/xcb/qt_attribution.json24
-rw-r--r--src/3rdparty/xkbcommon-x11.pri10
-rw-r--r--src/3rdparty/xkbcommon.pri11
-rw-r--r--src/3rdparty/xkbcommon/qt_attribution.json26
-rw-r--r--src/3rdparty/zlib/LICENSE28
-rw-r--r--src/3rdparty/zlib/gzguts.h4
-rw-r--r--src/3rdparty/zlib/qt_attribution.json15
-rw-r--r--src/3rdparty/zlib/zutil.h4
-rw-r--r--src/3rdparty/zlib_dependency.pri8
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java205
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/EditMenu.java142
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java155
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java72
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java23
-rw-r--r--src/angle/src/common/common.pri2
-rw-r--r--src/angle/src/compiler/preprocessor/preprocessor.pro2
-rw-r--r--src/angle/src/compiler/translator.pro2
-rw-r--r--src/concurrent/concurrent.pro2
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in2
-rw-r--r--src/corelib/arch/arch.pri2
-rw-r--r--src/corelib/codecs/codecs.pri23
-rw-r--r--src/corelib/doc/src/qtcore-index.qdoc14
-rw-r--r--src/corelib/doc/src/resource-system.qdoc2
-rw-r--r--src/corelib/global/qglobal.cpp61
-rw-r--r--src/corelib/global/qglobal.h20
-rw-r--r--src/corelib/global/qglobal_p.h9
-rw-r--r--src/corelib/global/qnamespace.qdoc50
-rw-r--r--src/corelib/global/qnumeric_p.h8
-rw-r--r--src/corelib/global/qsysinfo.h10
-rw-r--r--src/corelib/global/qsystemdetection.h14
-rw-r--r--src/corelib/io/io.pri4
-rw-r--r--src/corelib/io/qabstractfileengine.cpp2
-rw-r--r--src/corelib/io/qdebug.h4
-rw-r--r--src/corelib/io/qfileinfo.cpp8
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp2
-rw-r--r--src/corelib/io/qiodevice.cpp2
-rw-r--r--src/corelib/io/qlockfile_unix.cpp6
-rw-r--r--src/corelib/io/qloggingcategory.cpp2
-rw-r--r--src/corelib/io/qprocess.cpp8
-rw-r--r--src/corelib/io/qsettings.cpp44
-rw-r--r--src/corelib/io/qstandardpaths.cpp4
-rw-r--r--src/corelib/io/qstandardpaths.h7
-rw-r--r--src/corelib/io/qstorageinfo.cpp2
-rw-r--r--src/corelib/io/qurl.cpp26
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp20
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h10
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp6
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp12
-rw-r--r--src/corelib/kernel/kernel.pri25
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp8
-rw-r--r--src/corelib/kernel/qcoreevent.cpp4
-rw-r--r--src/corelib/kernel/qdeadlinetimer.cpp827
-rw-r--r--src/corelib/kernel/qdeadlinetimer.h190
-rw-r--r--src/corelib/kernel/qdeadlinetimer_p.h70
-rw-r--r--src/corelib/kernel/qelapsedtimer.cpp13
-rw-r--r--src/corelib/kernel/qelapsedtimer_generic.cpp11
-rw-r--r--src/corelib/kernel/qelapsedtimer_mac.cpp29
-rw-r--r--src/corelib/kernel/qelapsedtimer_unix.cpp14
-rw-r--r--src/corelib/kernel/qelapsedtimer_win.cpp22
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf.mm4
-rw-r--r--src/corelib/kernel/qobject.cpp61
-rw-r--r--src/corelib/kernel/qobjectdefs.h11
-rw-r--r--src/corelib/kernel/qvariant.cpp4
-rw-r--r--src/corelib/mimetypes/mimetypes.pri6
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp2
-rw-r--r--src/corelib/plugin/qlibrary.cpp8
-rw-r--r--src/corelib/plugin/qpluginloader.cpp2
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp12
-rw-r--r--src/corelib/statemachine/qstatemachine.h2
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h6
-rw-r--r--src/corelib/statemachine/statemachine.pri10
-rw-r--r--src/corelib/thread/qfuture.h25
-rw-r--r--src/corelib/thread/qfutureinterface.h10
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/tools/qalgorithms.h11
-rw-r--r--src/corelib/tools/qcommandlineoption.cpp4
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp5
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp8
-rw-r--r--src/corelib/tools/qmap.cpp6
-rw-r--r--src/corelib/tools/qstring.cpp6
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp21
-rw-r--r--src/corelib/tools/tools.pri10
-rw-r--r--src/dbus/dbus.pro10
-rw-r--r--src/dbus/qdbusconnection_p.h4
-rw-r--r--src/dbus/qdbusintegrator.cpp13
-rw-r--r--src/gui/accessible/accessible.pri2
-rw-r--r--src/gui/accessible/qaccessible.cpp2
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp2
-rw-r--r--src/gui/doc/images/qcolor-saturation.pngbin2150 -> 1116 bytes
-rw-r--r--src/gui/doc/images/qcolor-saturation.svg78
-rw-r--r--src/gui/doc/images/qcolor-value.pngbin1241 -> 909 bytes
-rw-r--r--src/gui/doc/images/qcolor-value.svg78
-rw-r--r--src/gui/doc/src/dnd.qdoc4
-rw-r--r--src/gui/doc/src/qtgui.qdoc13
-rw-r--r--src/gui/gui.pro16
-rw-r--r--src/gui/image/image.pri4
-rw-r--r--src/gui/image/qicon.cpp2
-rw-r--r--src/gui/image/qiconloader.cpp6
-rw-r--r--src/gui/image/qimage.h9
-rw-r--r--src/gui/image/qimage_darwin.mm141
-rw-r--r--src/gui/image/qpixmap_blitter_p.h2
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qclipboard.cpp18
-rw-r--r--src/gui/kernel/qdrag.cpp4
-rw-r--r--src/gui/kernel/qevent.cpp30
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp28
-rw-r--r--src/gui/kernel/qopenglcontext_p.h7
-rw-r--r--src/gui/kernel/qpalette.cpp2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp10
-rw-r--r--src/gui/kernel/qplatformcursor.h8
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp5
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h1
-rw-r--r--src/gui/opengl/opengl.pri10
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp5
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp2
-rw-r--r--src/gui/painting/qblittable_p.h2
-rw-r--r--src/gui/painting/qcolor.cpp5
-rw-r--r--src/gui/painting/qcolor.h1
-rw-r--r--src/gui/painting/qcolor_p.cpp36
-rw-r--r--src/gui/painting/qdatabuffer_p.h2
-rw-r--r--src/gui/painting/qdrawhelper.cpp41
-rw-r--r--src/gui/painting/qgrayraster.c4
-rw-r--r--src/gui/painting/qpagesize.cpp2
-rw-r--r--src/gui/painting/qpaintengine.cpp6
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h2
-rw-r--r--src/gui/painting/qrasterizer.cpp6
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/painting/qregion.h1
-rw-r--r--src/gui/text/qcssparser.cpp20
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfontdatabase.cpp3
-rw-r--r--src/gui/text/qfontengine_ft.cpp6
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/gui/text/qzip.cpp10
-rw-r--r--src/gui/text/text.pri2
-rw-r--r--src/network/access/http2/http2frames.cpp444
-rw-r--r--src/network/access/http2/http2frames_p.h101
-rw-r--r--src/network/access/http2/http2streams.cpp4
-rw-r--r--src/network/access/http2/http2streams_p.h3
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp263
-rw-r--r--src/network/access/qhttp2protocolhandler_p.h13
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp13
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp68
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h7
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp5
-rw-r--r--src/network/access/qnetworkrequest.cpp8
-rw-r--r--src/network/kernel/kernel.pri7
-rw-r--r--src/network/kernel/qnetworkinterface.cpp2
-rw-r--r--src/network/kernel/qnetworkproxy.cpp4
-rw-r--r--src/network/socket/qabstractsocket.cpp43
-rw-r--r--src/network/socket/qlocalserver.cpp2
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp2
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp2
-rw-r--r--src/network/socket/socket.pri4
-rw-r--r--src/network/ssl/qsslcontext_openssl.cpp2
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.cpp66
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.h13
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp4
-rw-r--r--src/network/ssl/qsslsocket_mac_p.h4
-rw-r--r--src/network/ssl/ssl.pri6
-rw-r--r--src/opengl/doc/src/qtopengl-index.qdoc2
-rw-r--r--src/opengl/doc/src/qtopengl-module.qdoc2
-rw-r--r--src/opengl/opengl.pro4
-rw-r--r--src/opengl/qgl.cpp2
-rw-r--r--src/opengl/qglpixelbuffer.cpp6
-rw-r--r--src/openglextensions/openglextensions.pro4
-rw-r--r--src/platformheaders/nativecontexts/qeglnativecontext.h2
-rw-r--r--src/platformsupport/accessibility/accessibility.pri2
-rw-r--r--src/platformsupport/devicediscovery/devicediscovery.pri7
-rw-r--r--src/platformsupport/eglconvenience/eglconvenience.pri13
-rw-r--r--src/platformsupport/eglconvenience/qeglconvenience_p.h2
-rw-r--r--src/platformsupport/eglconvenience/qeglpbuffer_p.h1
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h2
-rw-r--r--src/platformsupport/eglconvenience/qeglstreamconvenience_p.h3
-rw-r--r--src/platformsupport/eglconvenience/qt_egl_p.h117
-rw-r--r--src/platformsupport/eventdispatchers/eventdispatchers.pri5
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler.cpp3
-rw-r--r--src/platformsupport/fontdatabases/basic/basic.pri2
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/fontconfig.pri2
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp32
-rw-r--r--src/platformsupport/fontdatabases/fontdatabases.pri25
-rw-r--r--src/platformsupport/fontdatabases/mac/coretext.pri4
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm2
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm27
-rw-r--r--src/platformsupport/glxconvenience/glxconvenience.pri6
-rw-r--r--src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri5
-rw-r--r--src/platformsupport/input/evdevmouse/evdevmouse.pri5
-rw-r--r--src/platformsupport/input/evdevtablet/evdevtablet.pri5
-rw-r--r--src/platformsupport/input/evdevtouch/evdevtouch.pri10
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp62
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h4
-rw-r--r--src/platformsupport/input/input.pri10
-rw-r--r--src/platformsupport/input/libinput/libinput.pri15
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp2
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp13
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping.cpp91
-rw-r--r--src/platformsupport/input/shared/qtouchoutputmapping_p.h71
-rw-r--r--src/platformsupport/input/shared/shared.pri5
-rw-r--r--src/platformsupport/input/tslib/tslib.pri2
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp25
-rw-r--r--src/platformsupport/linuxaccessibility/linuxaccessibility.pri2
-rw-r--r--src/platformsupport/platformcompositor/platformcompositor.pri2
-rw-r--r--src/platformsupport/platformsupport.pro2
-rw-r--r--src/plugins/bearer/bearer.pro2
-rw-r--r--src/plugins/bearer/corewlan/corewlan.pro2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp44
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h30
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp30
-rw-r--r--src/plugins/generic/generic.pro6
-rw-r--r--src/plugins/generic/tslib/tslib.pro2
-rw-r--r--src/plugins/imageformats/imageformats.pro6
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro7
-rw-r--r--src/plugins/platforminputcontexts/compose/compose.pro7
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.cpp5
-rw-r--r--src/plugins/platforminputcontexts/platforminputcontexts.pro2
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp34
-rw-r--r--src/plugins/platforms/android/androidjniinput.h4
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp14
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp187
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.h14
-rw-r--r--src/plugins/platforms/android/qandroidplatformfontdatabase.cpp3
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbintegration.cpp4
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro2
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm16
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm9
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm1
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm64
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm33
-rw-r--r--src/plugins/platforms/directfb/directfb.pro5
-rw-r--r--src/plugins/platforms/directfb/qdirectfb_egl.cpp2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor.cpp163
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor_p.h27
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsglobal.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro14
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp18
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp11
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h5
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro11
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp33
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h15
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp15
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp26
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h10
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp98
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h5
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp25
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h7
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp15
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro1
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro1
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp4
-rw-r--r--src/plugins/platforms/eglfs/eglfsdeviceintegration.pro4
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp18
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp14
-rw-r--r--src/plugins/platforms/minimal/minimal.pro1
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp8
-rw-r--r--src/plugins/platforms/minimalegl/minimalegl.pro4
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglscreen.h2
-rw-r--r--src/plugins/platforms/offscreen/offscreen.pro2
-rw-r--r--src/plugins/platforms/openwfd/openwf.pro3
-rw-r--r--src/plugins/platforms/platforms.pro18
-rw-r--r--src/plugins/platforms/qnx/qnx.pro8
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp6
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp34
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h4
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp16
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h1
-rw-r--r--src/plugins/platforms/windows/windows.pri21
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.cpp51
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro4
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri28
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro7
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp9
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h6
-rw-r--r--src/plugins/platforms/xcb/xcb.pro2
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro55
-rw-r--r--src/plugins/platformthemes/gtk3/gtk3.pro3
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp6
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.cpp2
-rw-r--r--src/plugins/platformthemes/platformthemes.pro2
-rw-r--r--src/plugins/printsupport/cups/cups.pro2
-rw-r--r--src/plugins/printsupport/printsupport.pro6
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro6
-rw-r--r--src/plugins/sqldrivers/ibase/ibase.pro9
-rw-r--r--src/plugins/sqldrivers/mysql/mysql.pro14
-rw-r--r--src/plugins/sqldrivers/oci/oci.pro7
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro11
-rw-r--r--src/plugins/sqldrivers/psql/psql.pro8
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro5
-rw-r--r--src/plugins/sqldrivers/sqlite2/sqlite2.pro2
-rw-r--r--src/plugins/sqldrivers/tds/tds.pro8
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.cpp8
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.cpp6
-rw-r--r--src/printsupport/kernel/kernel.pri2
-rw-r--r--src/printsupport/kernel/qprinter.cpp6
-rw-r--r--src/printsupport/widgets/widgets.pri2
-rw-r--r--src/sql/doc/src/qtsql.qdoc13
-rw-r--r--src/sql/doc/src/sql-driver.qdoc16
-rw-r--r--src/src.pro30
-rw-r--r--src/testlib/doc/src/qttestlib-manual.qdoc2
-rw-r--r--src/testlib/qtestblacklist.cpp3
-rw-r--r--src/testlib/qtestcase.cpp9
-rw-r--r--src/testlib/qtesttouch.h1
-rw-r--r--src/tools/bootstrap/bootstrap.pro6
-rw-r--r--src/tools/moc/keywords.cpp375
-rw-r--r--src/tools/moc/moc.cpp62
-rw-r--r--src/tools/moc/moc.h42
-rw-r--r--src/tools/moc/token.h3
-rw-r--r--src/tools/moc/util/generate_keywords.cpp3
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp203
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.cpp21
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp14
-rw-r--r--src/widgets/accessible/accessible.pri2
-rw-r--r--src/widgets/accessible/widgets.pro2
-rw-r--r--src/widgets/dialogs/images/qtlogo-64.pngbin1676 -> 1032 bytes
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp8
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp10
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp20
-rw-r--r--src/widgets/dialogs/qwizard.cpp20
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp4
-rw-r--r--src/widgets/doc/src/graphicsview.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/focus.qdoc4
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/styles.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc8
-rw-r--r--src/widgets/doc/src/widgets-tutorial.qdoc2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp8
-rw-r--r--src/widgets/itemviews/qabstractitemview.h5
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp18
-rw-r--r--src/widgets/itemviews/qheaderview.cpp1
-rw-r--r--src/widgets/itemviews/qtreeview.h3
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp1
-rw-r--r--src/widgets/kernel/kernel.pri2
-rw-r--r--src/widgets/kernel/qaction.cpp10
-rw-r--r--src/widgets/kernel/qapplication.cpp4
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc2
-rw-r--r--src/widgets/kernel/qformlayout.cpp4
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp4
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp18
-rw-r--r--src/widgets/kernel/qwidget.h1
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp6
-rw-r--r--src/widgets/styles/qmacstyle.qdoc12
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm2
-rw-r--r--src/widgets/styles/qstyle.cpp6
-rw-r--r--src/widgets/styles/qstyleoption.cpp2
-rw-r--r--src/widgets/styles/styles.pri14
-rw-r--r--src/widgets/util/qscroller.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp15
-rw-r--r--src/widgets/util/util.pri2
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp4
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm6
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h4
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm4
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmenu.cpp2
-rw-r--r--src/widgets/widgets/qmenu_mac.mm8
-rw-r--r--src/widgets/widgets/qmenubar.cpp14
-rw-r--r--src/widgets/widgets/qrubberband.cpp2
-rw-r--r--src/widgets/widgets/qtabbar.cpp89
-rw-r--r--src/widgets/widgets/qtabbar_p.h3
-rw-r--r--src/widgets/widgets/qtabwidget.cpp2
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp2
-rw-r--r--src/winmain/winmain.pro2
437 files changed, 6679 insertions, 2357 deletions
diff --git a/src/3rdparty/android/LICENSE b/src/3rdparty/android/LICENSE
new file mode 100644
index 0000000000..c026b6b79a
--- /dev/null
+++ b/src/3rdparty/android/LICENSE
@@ -0,0 +1,11 @@
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/src/3rdparty/android/qt_attribution.json b/src/3rdparty/android/qt_attribution.json
new file mode 100644
index 0000000000..c1f89fd8bd
--- /dev/null
+++ b/src/3rdparty/android/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "android-native-style",
+ "Name": "Native Style for Android",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Android platform plugin.",
+
+ "License": "Apache License 2.0",
+ "LicenseId": "Apache-2.0",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 2005 The Android Open Source Project"
+}
diff --git a/src/3rdparty/angle/SYSTEMINFO_LICENSE b/src/3rdparty/angle/SYSTEMINFO_LICENSE
new file mode 100644
index 0000000000..c12444e3bc
--- /dev/null
+++ b/src/3rdparty/angle/SYSTEMINFO_LICENSE
@@ -0,0 +1,22 @@
+Copyright (C) 2009 Apple Inc. All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/angle/TRACEEVENT_LICENSE b/src/3rdparty/angle/TRACEEVENT_LICENSE
new file mode 100644
index 0000000000..34d6cd9268
--- /dev/null
+++ b/src/3rdparty/angle/TRACEEVENT_LICENSE
@@ -0,0 +1,27 @@
+Copyright 2013 The Chromium Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/angle/qt_attribution.json b/src/3rdparty/angle/qt_attribution.json
new file mode 100644
index 0000000000..230f30940b
--- /dev/null
+++ b/src/3rdparty/angle/qt_attribution.json
@@ -0,0 +1,61 @@
+[
+ {
+ "Id": "angle",
+ "Name": "ANGLE Library",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 2002-2013 The ANGLE Project Authors"
+ },
+ {
+ "Id": "angle-arrayboundsclamper",
+ "Name": "ANGLE Array Bounds Clamper for WebKit",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/compiler",
+ "Description": "Implements clamping of array indexing expressions during shader translation.",
+ "License": "BSD 2-clause \"Simplified\" License",
+ "LicenseId": "BSD-2-Clause",
+ "LicenseFile": "src/third_party/compiler/LICENSE",
+ "Copyright": "Copyright (C) 2012 Apple Inc."
+ },
+ {
+ "Id": "angle-murmurhash",
+ "Name": "Murmurhash (as part of ANGLE)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/murmurhash",
+ "License": "Public Domain",
+ "LicenseId": "NONE",
+ "Copyright": "MurmurHash3 was written by Austin Appleby, and is placed in the public domain. The author hereby disclaims copyright to this source code."
+ },
+ {
+ "Id": "angle-systeminfo",
+ "Name": "Systeminfo (as part of ANGLE)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/systeminfo",
+ "License": "BSD 2-clause \"Simplified\" License",
+ "LicenseId": "BSD-2-Clause",
+ "LicenseFile": "SYSTEMINFO_LICENSE",
+ "Copyright": "Copyright (C) 2009 Apple Inc. All Rights Reserved."
+ },
+ {
+ "Id": "angle-trace_event",
+ "Name": "trace_event (as part of ANGLE)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used on Windows to implement OpenGL ES on top of DirectX. Configure with -no-opengl, or -opengl desktop to exclude.",
+
+ "Path": "src/third_party/trace_event",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "TRACEEVENT_LICENSE",
+ "Copyright": "Copyright (c) 2013 The Chromium Authors."
+ }
+]
diff --git a/src/3rdparty/atspi2/LICENSE b/src/3rdparty/atspi2/LICENSE
new file mode 100644
index 0000000000..dc5f1b170d
--- /dev/null
+++ b/src/3rdparty/atspi2/LICENSE
@@ -0,0 +1,482 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
diff --git a/src/3rdparty/atspi2/qt_attribution.json b/src/3rdparty/atspi2/qt_attribution.json
new file mode 100644
index 0000000000..ed2ef85158
--- /dev/null
+++ b/src/3rdparty/atspi2/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "atspi2",
+ "Name": "at-spi2 (Assistive Technology Service Provider Interface)",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally ysed on Linux for accessibility. Configure without dbus (QT_CONFIG-=accessibility-atspi-bridge) to avoid.",
+
+ "License": "GNU Library General Public License v2 or later",
+ "LicenseId": "LGPL-2.0+",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright 2010, 2011 Novell, Inc., Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany."
+}
diff --git a/src/3rdparty/double-conversion/qt_attribution.json b/src/3rdparty/double-conversion/qt_attribution.json
new file mode 100644
index 0000000000..92118ac779
--- /dev/null
+++ b/src/3rdparty/double-conversion/qt_attribution.json
@@ -0,0 +1,14 @@
+{
+ "Id": "doubleconversion",
+ "Name": "Efficient Binary-Decimal and Decimal-Binary Conversion Routines for IEEE Doubles",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core. Configure with -system-doubleconversion or -no-doubleconversion to avoid.",
+
+ "Homepage": "https://github.com/google/double-conversion",
+ "Version": "2.0.1",
+ "DownloadLocation": "https://github.com/google/double-conversion/commit/2fb03de56faa32bbba5e02222528e7b760f71d77",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright 2006-2012, the V8 project authors"
+}
diff --git a/src/3rdparty/easing/LICENSE b/src/3rdparty/easing/LICENSE
new file mode 100644
index 0000000000..5dc85c4712
--- /dev/null
+++ b/src/3rdparty/easing/LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2001 Robert Penner
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the author nor the names of contributors may be used
+ to endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/easing/qt_attribution.json b/src/3rdparty/easing/qt_attribution.json
new file mode 100644
index 0000000000..b6240c61c8
--- /dev/null
+++ b/src/3rdparty/easing/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "easing",
+ "Name": "Easing Equations by Robert Penner",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QEasingCurve).",
+
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 2001 Robert Penner"
+}
diff --git a/src/3rdparty/forkfd/LICENSE b/src/3rdparty/forkfd/LICENSE
new file mode 100644
index 0000000000..351ebf705d
--- /dev/null
+++ b/src/3rdparty/forkfd/LICENSE
@@ -0,0 +1,19 @@
+Copyright (C) 2016 Intel Corporation.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/src/3rdparty/forkfd/qt_attribution.json b/src/3rdparty/forkfd/qt_attribution.json
new file mode 100644
index 0000000000..89f25f4870
--- /dev/null
+++ b/src/3rdparty/forkfd/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "forkfd",
+ "Name": "forkfd",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used on most Unix platforms in Qt Core.",
+
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 2013-2016 Intel Corporation
+Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com"
+}
diff --git a/src/3rdparty/freebsd/LICENSE b/src/3rdparty/freebsd/LICENSE
new file mode 100644
index 0000000000..5bb30318eb
--- /dev/null
+++ b/src/3rdparty/freebsd/LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/src/3rdparty/freebsd/qt_attribution.json b/src/3rdparty/freebsd/qt_attribution.json
new file mode 100644
index 0000000000..40c337cc67
--- /dev/null
+++ b/src/3rdparty/freebsd/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "freebsd",
+ "Name": "FreeBSD strtoll and strtoull",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core.",
+
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation."
+}
diff --git a/src/3rdparty/freetype/qt_attribution.json b/src/3rdparty/freetype/qt_attribution.json
new file mode 100644
index 0000000000..6c11f1b617
--- /dev/null
+++ b/src/3rdparty/freetype/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "freetype",
+ "Name": "Freetype 2",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in Qt GUI and platform plugins. Configure with -no-freetype, or -system-freetype to avoid.",
+
+ "Description": "FreeType is a freely available software library to render fonts.",
+ "Homepage": "http://www.freetype.org",
+ "License": "Freetype Project License or GNU General Public License v2.0 only",
+ "LicenseId": "FTL or GPL-2.0",
+ "LicenseFile": "docs/LICENSE.TXT",
+ "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
+}
diff --git a/src/3rdparty/freetype_dependency.pri b/src/3rdparty/freetype_dependency.pri
index 7513e40bfd..012e4af6c3 100644
--- a/src/3rdparty/freetype_dependency.pri
+++ b/src/3rdparty/freetype_dependency.pri
@@ -1,7 +1,7 @@
-contains(QT_CONFIG, system-freetype) {
+qtConfig(system-freetype) {
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
-} else: contains(QT_CONFIG, freetype) {
+} else: qtConfig(freetype) {
INCLUDEPATH += $$PWD/freetype/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
}
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
index 4fd0823332..1bfeabb8c4 100644
--- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
+++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
@@ -9,7 +9,9 @@ load(qt_helper_lib)
# built-in shapers list configuration:
SHAPERS += opentype # HB's main shaper; enabling it should be enough most of the time
-mac: SHAPERS += coretext # native shaper on OSX/iOS; could be used alone to handle both OT and AAT fonts
+
+# native shaper on Apple platforms; could be used alone to handle both OT and AAT fonts
+darwin:!if(watchos:CONFIG(simulator, simulator|device)): SHAPERS += coretext
DEFINES += HAVE_CONFIG_H
DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED
@@ -147,7 +149,7 @@ contains(SHAPERS, coretext) {
$$PWD/src/hb-coretext.h
uikit: \
- # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks
+ # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json
new file mode 100644
index 0000000000..4d3eb79150
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json
@@ -0,0 +1,25 @@
+{
+ "Id": "harfbuzz-ng",
+ "Name": "HarfBuzz-NG",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.",
+
+ "Description": "HarfBuzz is an OpenType text shaping engine.",
+ "Homepage": "http://harfbuzz.org",
+
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "COPYING",
+ "Copyright": "Copyright © 2010,2011,2012 Google, Inc.
+Copyright © 2012 Mozilla Foundation
+Copyright © 2011 Codethink Limited
+Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)
+Copyright © 2009 Keith Stribley
+Copyright © 2009 Martin Hosken and SIL International
+Copyright © 2007 Chris Wilson
+Copyright © 2006 Behdad Esfahbod
+Copyright © 2005 David Turner
+Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc.
+Copyright © 1998-2004 David Turner and Werner Lemberg
+"
+}
diff --git a/src/3rdparty/harfbuzz/qt_attribution.json b/src/3rdparty/harfbuzz/qt_attribution.json
new file mode 100644
index 0000000000..2c2b31e4a9
--- /dev/null
+++ b/src/3rdparty/harfbuzz/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "harfbuzz",
+ "Name": "HarfBuzz",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in Qt GUI. Configure with -system-harfbuzz or -qt-harfbuzz to avoid.",
+
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "COPYING",
+ "Copyright": "Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Copyright (c) 2011 The FreeBSD Foundation
+All rights reserved.
+Portions of this software were developed by David Chisnall
+under sponsorship from the FreeBSD Foundation."
+}
diff --git a/src/3rdparty/harfbuzz_dependency.pri b/src/3rdparty/harfbuzz_dependency.pri
index 36abbfbe35..5946f403c5 100644
--- a/src/3rdparty/harfbuzz_dependency.pri
+++ b/src/3rdparty/harfbuzz_dependency.pri
@@ -1,6 +1,6 @@
-contains(QT_CONFIG, system-harfbuzz) {
- LIBS_PRIVATE += -lharfbuzz
-} else: contains(QT_CONFIG, harfbuzz) {
+qtConfig(system-harfbuzz) {
+ QMAKE_USE_PRIVATE += harfbuzz
+} else: qtConfig(harfbuzz) {
INCLUDEPATH += $$PWD/harfbuzz-ng/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtharfbuzzng$$qtPlatformTargetSuffix()
}
diff --git a/src/3rdparty/iaccessible2/LICENSE b/src/3rdparty/iaccessible2/LICENSE
new file mode 100644
index 0000000000..688d9d3197
--- /dev/null
+++ b/src/3rdparty/iaccessible2/LICENSE
@@ -0,0 +1,38 @@
+Copyright (c) 2013 Linux Foundation
+All rights reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. Neither the name of the Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+This BSD License conforms to the Open Source Initiative "Simplified
+BSD License" as published at:
+http://www.opensource.org/licenses/bsd-license.php
diff --git a/src/3rdparty/iaccessible2/qt_attribution.json b/src/3rdparty/iaccessible2/qt_attribution.json
new file mode 100644
index 0000000000..545ffe4d63
--- /dev/null
+++ b/src/3rdparty/iaccessible2/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "iaccessible2",
+ "Name": "IAccessible2 IDL Specification",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in the Windows platform plugin. Configure with -no-accessibility to avoid.",
+
+ "Description": "IAccessible2 is a new accessibility API which complements Microsoft's earlier work on MSAA",
+ "Homepage": "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 2000, 2006 Sun Microsystems, Inc.
+Copyright (c) 2006 IBM Corporation
+Copyright (c) 2007, 2010, 2012, 2013 Linux Foundation
+
+IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 mark may be used in accordance with the Linux Foundation Trademark Policy to indicate compliance with the IAccessible2 specification."
+}
diff --git a/src/3rdparty/libjpeg/LICENSE b/src/3rdparty/libjpeg/LICENSE
new file mode 100644
index 0000000000..797a6d5668
--- /dev/null
+++ b/src/3rdparty/libjpeg/LICENSE
@@ -0,0 +1,50 @@
+from qtbase/src/3rdparty/libjpeg/README:
+
+LEGAL ISSUES
+============
+
+In plain English:
+
+1. We don't promise that this software works. (But if you find any bugs,
+ please let us know!)
+2. You can use this software for whatever you want. You don't have to pay us.
+3. You may not pretend that you wrote this software. If you use it in a
+ program, you must acknowledge somewhere in your documentation that
+ you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose. This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json
new file mode 100644
index 0000000000..ee5c094a0f
--- /dev/null
+++ b/src/3rdparty/libjpeg/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "libjpeg",
+ "Name": "LibJPEG",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in the QJPEG image plugin. Configure with -no-jpeg to avoid.",
+
+ "Description": "The Independent JPEG Group's JPEG software",
+ "Homepage": "http://www.ijg.org/",
+ "License": "Independent JPEG Group License",
+ "LicenseId": "IJG",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (C) 1991-2011, Thomas G. Lane, Guido Vollbeding."
+}
diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json
new file mode 100644
index 0000000000..93e73243af
--- /dev/null
+++ b/src/3rdparty/libpng/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "libpng",
+ "Name": "LibPNG",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in the qpng image plugin. Configure with -system-png or -no-png to avoid.",
+
+ "Description": "libpng is the official PNG reference library.",
+ "Homepage": "http://www.libpng.org/pub/png/libpng.html",
+ "License": "libpng License",
+ "LicenseId": "Libpng",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright (c) 1998-2015 Glenn Randers-Pehrson
+Copyright (c) 1996-1997 Andreas Dilger
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
+}
diff --git a/src/3rdparty/md4/qt_attribution.json b/src/3rdparty/md4/qt_attribution.json
new file mode 100644
index 0000000000..f1bca24660
--- /dev/null
+++ b/src/3rdparty/md4/qt_attribution.json
@@ -0,0 +1,10 @@
+{
+ "Id": "md4",
+ "Name": "MD4",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.",
+
+ "Description": "An OpenSSL-compatible implementation of the RSA Data Security, Inc. MD4 Message-Digest Algorithm.",
+ "License": "Public Domain",
+ "Copyright": "Written by Alexander Peslyak - better known as Solar Designer <solar@openwall.com> - in 2001, and placed in the public domain. There's absolutely no warranty."
+}
diff --git a/src/3rdparty/md5/qt_attribution.json b/src/3rdparty/md5/qt_attribution.json
new file mode 100644
index 0000000000..52b613cf6c
--- /dev/null
+++ b/src/3rdparty/md5/qt_attribution.json
@@ -0,0 +1,11 @@
+{
+ "Id": "md5",
+ "Name": "MD5",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.",
+
+ "Description": "MD5 message-digest algorithm.",
+ "License": "Public Domain",
+ "Copyright": "Written by Colin Plumb in 1993, no copyright is claimed.
+Ian Jackson <ian@chiark.greenend.org.uk>."
+}
diff --git a/src/3rdparty/pcre/qt_attribution.json b/src/3rdparty/pcre/qt_attribution.json
new file mode 100644
index 0000000000..ec8832486b
--- /dev/null
+++ b/src/3rdparty/pcre/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "pcre",
+ "Name": "PCRE",
+ "QDocModule": "qtcore",
+ "QtUsage": "Optionally used in Qt Core (QRegularExpression). Configure with -system-pcre or -no-pcre to avoid.",
+
+ "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.",
+ "Homepage": "http://www.pcre.org/",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "LICENCE",
+ "Copyright": "Copyright (c) 1997-2015 University of Cambridge
+Copyright (c) 2010-2015 Zoltan Herczeg
+Copyright (c) 2007-2012, Google Inc."
+}
diff --git a/src/3rdparty/pcre_dependency.pri b/src/3rdparty/pcre_dependency.pri
index 2a3c99c7ed..fa7df4df0e 100644
--- a/src/3rdparty/pcre_dependency.pri
+++ b/src/3rdparty/pcre_dependency.pri
@@ -3,5 +3,5 @@ pcre {
INCLUDEPATH += $$PWD/pcre
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpcre$$qtPlatformTargetSuffix()
} else {
- LIBS_PRIVATE += -lpcre16
+ QMAKE_USE_PRIVATE += pcre
}
diff --git a/src/3rdparty/pixman/LICENSE b/src/3rdparty/pixman/LICENSE
new file mode 100644
index 0000000000..3cb51484f1
--- /dev/null
+++ b/src/3rdparty/pixman/LICENSE
@@ -0,0 +1,20 @@
+Copyright © 2009 Nokia Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/src/3rdparty/pixman/qt_attribution.json b/src/3rdparty/pixman/qt_attribution.json
new file mode 100644
index 0000000000..607bda754d
--- /dev/null
+++ b/src/3rdparty/pixman/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "pixman",
+ "Name": "Pixman",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Qt GUI on ARM NEON.",
+
+ "Description": "pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.",
+ "Homepage": "http://www.pixman.org/",
+ "License": "MIT License",
+ "LicenseFile": "LICENSE",
+ "LicenseId": "MIT",
+ "Copyright": "Copyright © 2009 Nokia Corporation"
+}
diff --git a/src/3rdparty/png_dependency.pri b/src/3rdparty/png_dependency.pri
index 2ec2e8929d..50711358a0 100644
--- a/src/3rdparty/png_dependency.pri
+++ b/src/3rdparty/png_dependency.pri
@@ -1,15 +1,6 @@
-contains(QT_CONFIG, system-png) {
- unix|mingw {
- !contains(QT_CONFIG, no-pkg-config) {
- CONFIG += link_pkgconfig
- PKGCONFIG_PRIVATE += libpng
- } else {
- LIBS_PRIVATE += -lpng
- }
- } else {
- LIBS += libpng.lib
- }
-} else: contains(QT_CONFIG, png) {
+qtConfig(system-png) {
+ QMAKE_USE_PRIVATE += libpng
+} else: qtConfig(png) {
INCLUDEPATH += $$PWD/libpng
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpng$$qtPlatformTargetSuffix()
}
diff --git a/src/3rdparty/rfc6234/LICENSE b/src/3rdparty/rfc6234/LICENSE
new file mode 100644
index 0000000000..7075960ee2
--- /dev/null
+++ b/src/3rdparty/rfc6234/LICENSE
@@ -0,0 +1,34 @@
+Copyright (c) 2011 IETF Trust and the persons identified as
+authors of the code. All rights reserved.
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+- Redistributions of source code must retain the above
+ copyright notice, this list of conditions and
+ the following disclaimer.
+
+- Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+- Neither the name of Internet Society, IETF or IETF Trust, nor
+ the names of specific contributors, may be used to endorse or
+ promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/3rdparty/rfc6234/qt_attribution.json b/src/3rdparty/rfc6234/qt_attribution.json
new file mode 100644
index 0000000000..9fc427b4a6
--- /dev/null
+++ b/src/3rdparty/rfc6234/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "rfc6234",
+ "Name": "Secure Hash Algorithms SHA-384 and SHA-512",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash and QMessageAuthenticationCode)",
+
+ "Description": "Implements the Secure Hash Algorithms SHA 384 and SHA-521",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseFile": "LICENSE",
+ "LicenseId": "BSD-3-Clause",
+ "Copyright": "Copyright (c) 2011 IETF Trust and the persons identified as authors of the code."
+}
diff --git a/src/3rdparty/sha1/qt_attribution.json b/src/3rdparty/sha1/qt_attribution.json
new file mode 100644
index 0000000000..707c239f8d
--- /dev/null
+++ b/src/3rdparty/sha1/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "sha1",
+ "Name": "Secure Hash Algorithm SHA-1",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash).",
+
+ "Description": "Implements the Secure Hash Algorithms SHA 1",
+ "Homepage": "http://www.dominik-reichl.de/projects/csha1/",
+ "License": "Public Domain",
+ "Copyright": "Copyright (C) Dominik Reichl <dominik.reichl@t-online.de>
+Copyright (C) 2016 The Qt Company Ltd"
+}
diff --git a/src/3rdparty/sha3/BRG_ENDIAN_LICENSE b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE
new file mode 100644
index 0000000000..0a4fdcbc3b
--- /dev/null
+++ b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
+
+LICENSE TERMS
+
+The redistribution and use of this software (with or without changes)
+is allowed without the payment of fees or royalties provided that:
+
+ 1. source code distributions include the above copyright notice, this
+ list of conditions and the following disclaimer;
+
+ 2. binary distributions include the above copyright notice, this list
+ of conditions and the following disclaimer in their documentation;
+
+ 3. the name of the copyright holder is not used to endorse products
+ built using this software without specific written permission.
+
+DISCLAIMER
+
+This software is provided 'as is' with no explicit or implied warranties
+in respect of its properties, including, but not limited to, correctness
+and/or fitness for purpose.
diff --git a/src/3rdparty/sha3/CC0_LICENSE b/src/3rdparty/sha3/CC0_LICENSE
new file mode 100644
index 0000000000..cff12c3d88
--- /dev/null
+++ b/src/3rdparty/sha3/CC0_LICENSE
@@ -0,0 +1,99 @@
+CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF
+THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS
+DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES
+RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and
+Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner")
+of an original work of authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing
+to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and
+without fear of later claims of infringement build upon, modify, incorporate in other works, reuse
+and redistribute as freely as possible in any form whatsoever and for any purposes, including
+without limitation commercial purposes. These owners may contribute to the Commons to promote the
+ideal of a free culture and the further production of creative, cultural and scientific works, or to
+gain reputation or greater distribution for their Work in part through the use and efforts of
+others.
+
+For these and/or other purposes and motivations, and without any expectation of additional
+consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the
+extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to
+apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those
+rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and
+ related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights
+ include, but are not limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
+
+ ii. moral rights retained by the original author(s) and/or performer(s);
+
+ iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
+
+ iv. rights protecting against unfair competition in regards to a Work, subject to the limitations
+ in paragraph 4(a), below;
+
+ v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
+
+ vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and
+ of the Council of 11 March 1996 on the legal protection of databases, and under any national
+ implementation thereof, including any amended or successor version of such directive); and
+
+ vii. other similar, equivalent or corresponding rights throughout the world based on applicable
+ law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law,
+ Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons,
+ and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of
+ action, whether now known or unknown (including existing as well as future claims and causes of
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by
+ applicable law or treaty (including future time extensions), (iii) in any current or future
+ medium and for any number of copies, and (iv) for any purpose whatsoever, including without
+ limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the
+ Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's
+ heirs and successors, fully intending that such Waiver shall not be subject to revocation,
+ rescission, cancellation, termination, or any other legal or equitable action to disrupt the
+ quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of
+ Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid
+ or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent
+ permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent
+ the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non
+ transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise
+ Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for
+ the maximum duration provided by applicable law or treaty (including future time extensions),
+ (iii) in any current or future medium and for any number of copies, and (iv) for any purpose
+ whatsoever, including without limitation commercial, advertising or promotional purposes (the
+ "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to
+ the Work. Should any part of the License for any reason be judged legally invalid or ineffective
+ under applicable law, such partial invalidity or ineffectiveness shall not invalidate the
+ remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i)
+ exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any
+ associated claims and causes of action with respect to the Work, in either case contrary to
+ Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or
+ otherwise affected by this document.
+
+b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning
+ the Work, express, implied, statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non infringement, or the absence of
+ latent or other defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+
+c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work
+ or any use thereof, including without limitation any person's Copyright and Related Rights in the
+ Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents,
+ permissions or other rights required for any use of the Work.
+
+d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and
+ has no duty or obligation with respect to this CC0 or use of the Work.
diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json
new file mode 100644
index 0000000000..13e6e971d9
--- /dev/null
+++ b/src/3rdparty/sha3/qt_attribution.json
@@ -0,0 +1,29 @@
+[
+ {
+ "Id": "sha3_endian",
+ "Name": "Secure Hash Algorithm SHA-3 - brg_endian",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash).",
+
+ "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.",
+ "License": "BSD 3-clause \"New\" or \"Revised\" License",
+ "LicenseFile": "BRG_ENDIAN_LICENSE",
+ "LicenseId": "BSD-3-Clause",
+ "Copyright": "Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved."
+ },
+ {
+ "Id": "sha3_keccak",
+ "Name": "Secure Hash Algorithm SHA-3 - Keccak",
+ "QDocModule": "qtcore",
+ "QtUsage": "Used in Qt Core (QCryptographicHash).",
+
+ "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.",
+ "License": "Creative Commons Zero v1.0 Universal",
+ "LicenseId": "CC0-1.0",
+ "LicenseFile": "CC0_LICENSE",
+ "Copyright": "Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche.
+
+To the extent possible under law, the implementers have waived all copyright
+and related or neighboring rights to the source code in this file."
+ }
+]
diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri
index 29968e323f..87c356870b 100644
--- a/src/3rdparty/sqlite.pri
+++ b/src/3rdparty/sqlite.pri
@@ -1,7 +1,7 @@
CONFIG(release, debug|release):DEFINES *= NDEBUG
DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE
!contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS
-contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1
+qtConfig(posix_fallocate): DEFINES += HAVE_POSIX_FALLOCATE=1
winrt: DEFINES += SQLITE_OS_WINRT
winphone: DEFINES += SQLITE_WIN32_FILEMAPPING_API=1
qnx: DEFINES += _QNX_SOURCE
diff --git a/src/3rdparty/sqlite/qt_attribution.json b/src/3rdparty/sqlite/qt_attribution.json
new file mode 100644
index 0000000000..a4ea0cdbd2
--- /dev/null
+++ b/src/3rdparty/sqlite/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "sqlite",
+ "Name": "SQLite",
+ "QDocModule": "qtsql",
+ "QtUsage": "Used in Qt SQL Lite plugin. Configure Qt with -system-sqlite or -no-sqlite to avoid.",
+
+ "Description": "SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.",
+ "Homepage": "http://www.sqlite.org/",
+ "Version": "3.11.1.0",
+ "License": "Public Domain",
+ "Copyright": "The authors disclaim copyright to the source code. However, a license can be obtained if needed."
+}
diff --git a/src/3rdparty/wintab/qt_attribution.json b/src/3rdparty/wintab/qt_attribution.json
new file mode 100644
index 0000000000..742278fb26
--- /dev/null
+++ b/src/3rdparty/wintab/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "wintab",
+ "Name": "Wintab API",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -DQT_NO_TABLETEVENT to avoid.",
+
+ "Description": "Wintab is a de facto API for pointing devices on Windows.",
+ "Homepage": "http://www.pointing.com/Wintab.html",
+ "License": "Public Domain",
+ "LicenseId": "NONE",
+ "Copyright": "Copyright 1991-1998 by LCS/Telegraphics."
+}
diff --git a/src/3rdparty/xcb/LICENSE b/src/3rdparty/xcb/LICENSE
new file mode 100644
index 0000000000..8f4e5c3a72
--- /dev/null
+++ b/src/3rdparty/xcb/LICENSE
@@ -0,0 +1,23 @@
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or
+their institutions shall not be used in advertising or otherwise to
+promote the sale, use or other dealings in this Software without
+prior written authorization from the authors.
diff --git a/src/3rdparty/xcb/qt_attribution.json b/src/3rdparty/xcb/qt_attribution.json
new file mode 100644
index 0000000000..30b9af3818
--- /dev/null
+++ b/src/3rdparty/xcb/qt_attribution.json
@@ -0,0 +1,24 @@
+{
+ "Id": "xcb",
+ "Name": "XCB",
+ "QDocModule": "qtgui",
+ "QtUsage": "Optionally used in xcb platform plugin if configured with -qt-xcb.",
+
+ "Description": "Selected xcb libraries.",
+ "Homepage": "https://xcb.freedesktop.org/",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "LICENSE",
+ "Copyright": "Copyright © 2000 Keith Packard
+Copyright © 2006 Jamey Sharp
+Copyright © 2007-2008 Vincent Torri <vtorri@univ-evry.fr>
+Copyright © 2007 Bart Massey
+Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
+Copyright © 2008 Arnaud Fontaine <arnau@debian.org>
+Copyright © 2008 Bart Massey <bart@cs.pdx.edu>
+Copyright © 2008 Ian Osgood <iano@quirkster.com>
+Copyright © 2008 Jamey Sharp <jamey@minilop.net>
+Copyright © 2008 Josh Triplett <josh@freedesktop.org>
+Copyright © 2008 Ulrich Eckhardt <doomster@knuut.de>
+"
+}
diff --git a/src/3rdparty/xkbcommon-x11.pri b/src/3rdparty/xkbcommon-x11.pri
new file mode 100644
index 0000000000..36f22ce9cc
--- /dev/null
+++ b/src/3rdparty/xkbcommon-x11.pri
@@ -0,0 +1,10 @@
+include(xkbcommon.pri)
+
+# Build xkbcommon-x11 support library, it depends on -lxcb and -lxcb-xkb, linking is done
+# in xcb-plugin.pro (linked to system libraries or if Qt was configured with -qt-xcb then
+# linked to -lxcb-static).
+INCLUDEPATH += $$PWD/xkbcommon/src/x11
+SOURCES += \
+ $$PWD/xkbcommon/src/x11/util.c \
+ $$PWD/xkbcommon/src/x11/x11-keymap.c \ # renamed: keymap.c -> x11-keymap.c
+ $$PWD/xkbcommon/src/x11/x11-state.c # renamed: state.c -> x11-state.c
diff --git a/src/3rdparty/xkbcommon.pri b/src/3rdparty/xkbcommon.pri
index eaef4749db..12e7a4d8a3 100644
--- a/src/3rdparty/xkbcommon.pri
+++ b/src/3rdparty/xkbcommon.pri
@@ -47,15 +47,4 @@ SOURCES += \
$$PWD/xkbcommon/src/xkbcomp/xkbcomp.c \
$$PWD/xkbcommon/src/xkbcomp/parser.c
-!contains(DEFINES, QT_NO_XKB):contains(QT_CONFIG, use-xkbcommon-x11support): {
- # Build xkbcommon-x11 support library, it depends on -lxcb and -lxcb-xkb, linking is done
- # in xcb-plugin.pro (linked to system libraries or if Qt was configured with -qt-xcb then
- # linked to -lxcb-static).
- INCLUDEPATH += $$PWD/xkbcommon/src/x11
- SOURCES += \
- $$PWD/xkbcommon/src/x11/util.c \
- $$PWD/xkbcommon/src/x11/x11-keymap.c \ # renamed: keymap.c -> x11-keymap.c
- $$PWD/xkbcommon/src/x11/x11-state.c # renamed: state.c -> x11-state.c
-}
-
TR_EXCLUDE += $$PWD/*
diff --git a/src/3rdparty/xkbcommon/qt_attribution.json b/src/3rdparty/xkbcommon/qt_attribution.json
new file mode 100644
index 0000000000..8ee0df1b22
--- /dev/null
+++ b/src/3rdparty/xkbcommon/qt_attribution.json
@@ -0,0 +1,26 @@
+{
+ "Id": "xkbcommon",
+ "Name": "xkbcommon",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in xcb platform plugin. Configure with -system-xkbcommon-x11 to avoid.",
+
+ "Description": "xkbcommon is a keymap compiler and support library which processes a reduced subset of keymaps as defined by the XKB specification.",
+ "Homepage": "http://xkbcommon.org/",
+ "License": "MIT Licenses (with no-advertisement clause)",
+ "LicenseId": "MIT",
+ "LicenseFile": "COPYING",
+ "Copyright": "Copyright 1985, 1987, 1988, 1990, 1998 The Open Group
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+Copyright 1993, 1994, 1995, 1996 by Silicon Graphics Computer Systems, Inc.
+Copyright 1996 by Joseph Moss
+Copyright 2002-2007 Free Software Foundation, Inc.
+Copyright 2003-2004 Dmitry Golubev <lastguru@mail.ru>
+Copyright 2004, Gregory Mokhin <mokhin@bog.msu.ru>
+Copyright 2006 Erdal Ronahî
+Copyright 2008, 2009 Dan Nicholson
+Copyright 2009-2012 Daniel Stone
+Copyright 2010, 2012 Intel Corporation
+Copyright 2010 Francisco Jerez <currojerez@riseup.net>
+Copyright 2011 Joseph Adams <joeyadams3.14159@gmail.com>
+Copyright 2012 Ran Benita <ran234@gmail.com>"
+}
diff --git a/src/3rdparty/zlib/LICENSE b/src/3rdparty/zlib/LICENSE
new file mode 100644
index 0000000000..9c57e18006
--- /dev/null
+++ b/src/3rdparty/zlib/LICENSE
@@ -0,0 +1,28 @@
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not* receiving
+lengthy legal documents to sign. The sources are provided for free but without
+warranty of any kind. The library has been entirely written by Jean-loup
+Gailly and Mark Adler; it does not include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include in
+the file ChangeLog history information documenting your changes. Please read
+the FAQ for more information on the distribution of modified source versions.
+
diff --git a/src/3rdparty/zlib/gzguts.h b/src/3rdparty/zlib/gzguts.h
index 9e4368e889..3daf1070c4 100644
--- a/src/3rdparty/zlib/gzguts.h
+++ b/src/3rdparty/zlib/gzguts.h
@@ -21,7 +21,9 @@
# endif
#endif
-#include "qconfig.h"
+#ifndef QT_BOOTSTRAPPED
+# include <qconfig.h>
+#endif
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) && defined(QT_VISIBILITY_AVAILABLE)
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
diff --git a/src/3rdparty/zlib/qt_attribution.json b/src/3rdparty/zlib/qt_attribution.json
new file mode 100644
index 0000000000..a10fd1921f
--- /dev/null
+++ b/src/3rdparty/zlib/qt_attribution.json
@@ -0,0 +1,15 @@
+{
+ "Id": "zlib",
+ "Name": "Data Compression Library (zlib)",
+ "QDocModule": "qtcore",
+ "QtUsage": "Optionally used in Qt Core and and development tools. Configure with -system-zlib to avoid.",
+
+ "Description": "zlib is a general purpose data compression library.",
+ "Homepage": "http://zlib.net/",
+ "Version": "1.2.5",
+
+ "License": "ZLib license",
+ "LicenseId": "Zlib",
+ "LicenseFile": "LICENSE",
+ "Copyright": "(C) 1995-2010 Jean-loup Gailly and Mark Adler"
+}
diff --git a/src/3rdparty/zlib/zutil.h b/src/3rdparty/zlib/zutil.h
index 4d367a92db..881a7ecb3f 100644
--- a/src/3rdparty/zlib/zutil.h
+++ b/src/3rdparty/zlib/zutil.h
@@ -13,7 +13,9 @@
#ifndef ZUTIL_H
#define ZUTIL_H
-#include "qconfig.h"
+#ifndef QT_BOOTSTRAPPED
+# include <qconfig.h>
+#endif
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) && defined(QT_VISIBILITY_AVAILABLE)
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
diff --git a/src/3rdparty/zlib_dependency.pri b/src/3rdparty/zlib_dependency.pri
index 53e0b3ef39..6ac7e59158 100644
--- a/src/3rdparty/zlib_dependency.pri
+++ b/src/3rdparty/zlib_dependency.pri
@@ -1,10 +1,6 @@
# zlib dependency satisfied by bundled 3rd party zlib or system zlib
-contains(QT_CONFIG, system-zlib) {
- if(unix|mingw):LIBS_PRIVATE += -lz
- else {
- isEmpty(ZLIB_LIBS): LIBS += zdll.lib
- else: LIBS += $$ZLIB_LIBS
- }
+qtConfig(system-zlib) {
+ QMAKE_USE_PRIVATE += zlib
} else {
INCLUDEPATH += $$PWD/zlib
!no_core_dep {
diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
new file mode 100644
index 0000000000..7d26b8fa04
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Android port 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$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.util.DisplayMetrics;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.ImageView;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.view.MotionEvent;
+import android.widget.PopupWindow;
+import android.app.Activity;
+import android.view.ViewTreeObserver;
+
+/* This view represents one of the handle (selection or cursor handle) */
+class CursorView extends ImageView
+{
+ private CursorHandle mHandle;
+ // The coordinare which where clicked
+ private int m_offsetX;
+ private int m_offsetY;
+
+ CursorView (Context context, CursorHandle handle) {
+ super(context);
+ mHandle = handle;
+ }
+
+ // Called when the handle was moved programatically , with the delta amount in pixels
+ public void adjusted(int dx, int dy) {
+ m_offsetX += dx;
+ m_offsetY += dy;
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ switch (ev.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN: {
+ m_offsetX = Math.round(ev.getRawX());
+ m_offsetY = Math.round(ev.getRawY());
+ break;
+ }
+
+ case MotionEvent.ACTION_MOVE: {
+ mHandle.updatePosition(Math.round(ev.getRawX()) - m_offsetX,
+ Math.round(ev.getRawY()) - m_offsetY);
+ break;
+ }
+
+ case MotionEvent.ACTION_UP:
+ break;
+
+ case MotionEvent.ACTION_CANCEL:
+ break;
+ }
+ return true;
+ }
+
+}
+
+// Helper class that manages a cursor or selection handle
+public class CursorHandle implements ViewTreeObserver.OnPreDrawListener
+{
+ private View m_layout = null;
+ private CursorView m_cursorView = null;
+ private PopupWindow m_popup = null;
+ private int m_id;
+ private int m_attr;
+ private Activity m_activity;
+ private int m_posX;
+ private int m_posY;
+ private int m_lastX;
+ private int m_lastY;
+ int tolerance;
+
+ public CursorHandle(Activity activity, View layout, int id, int attr) {
+ m_activity = activity;
+ m_id = id;
+ m_attr = attr;
+ m_layout = layout;
+ DisplayMetrics metrics = new DisplayMetrics();
+ activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
+ tolerance = Math.round(2 * metrics.density);
+ m_lastX = m_lastY = -1 - tolerance;
+ }
+
+ private boolean initOverlay(){
+ if (m_popup == null){
+
+ Context context = m_layout.getContext();
+ int[] attrs = {m_attr};
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs);
+ Drawable drawable = a.getDrawable(0);
+
+ m_cursorView = new CursorView(context, this);
+ m_cursorView.setImageDrawable(drawable);
+ // m_layout.addView(m_cursorView);
+
+ m_popup = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
+ m_popup.setSplitTouchEnabled(true);
+ m_popup.setClippingEnabled(false);
+ m_popup.setContentView(m_cursorView);
+ m_popup.setWidth(drawable.getIntrinsicWidth());
+ m_popup.setHeight(drawable.getIntrinsicHeight());
+
+ m_layout.getViewTreeObserver().addOnPreDrawListener(this);
+ }
+ return true;
+ }
+
+ // Show the handle at a given position (or move it if it is already shown)
+ public void setPosition(final int x, final int y){
+ initOverlay();
+
+ final int[] location = new int[2];
+ m_layout.getLocationOnScreen(location);
+
+ int x2 = x + location[0];
+ int y2 = y + location[1];
+
+ if (m_id == QtNative.IdCursorHandle) {
+ x2 -= m_cursorView.getWidth() / 2 ;
+ } else if (m_id == QtNative.IdLeftHandle) {
+ x2 -= m_cursorView.getWidth() * 3 / 4;
+ } else if (m_id == QtNative.IdRightHandle) {
+ x2 -= m_cursorView.getWidth() / 4;
+ }
+
+ if (m_popup.isShowing()) {
+ m_popup.update(x2, y2, -1, -1);
+ m_cursorView.adjusted(x - m_posX, y - m_posY);
+ } else {
+ m_popup.showAtLocation(m_layout, 0, x2, y2);
+ }
+
+ m_posX = x;
+ m_posY = y;
+ }
+
+ public void hide() {
+ if (m_popup != null) {
+ m_popup.dismiss();
+ }
+ }
+
+ // The handle was dragged by a given relative position
+ public void updatePosition(int x, int y) {
+ if (Math.abs(m_lastX - x) > tolerance || Math.abs(m_lastY - y) > tolerance) {
+ QtNative.handleLocationChanged(m_id, x + m_posX, y + m_posY);
+ m_lastX = x;
+ m_lastY = y;
+ }
+ }
+
+ @Override
+ public boolean onPreDraw() {
+ // This hook is called when the view location is changed
+ // For example if the keyboard appears.
+ // Adjust the position of the handle accordingly
+ if (m_popup != null && m_popup.isShowing())
+ setPosition(m_posX, m_posY);
+
+ return true;
+ }
+}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditMenu.java b/src/android/jar/src/org/qtproject/qt5/android/EditMenu.java
new file mode 100644
index 0000000000..afe7797914
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/EditMenu.java
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Android port 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$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android;
+
+import android.view.ActionMode;
+import android.view.ActionMode.Callback;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.TypedArray;
+
+/**
+ * The edit menu actions (when there is selection)
+ */
+class EditMenu implements ActionMode.Callback {
+
+ private final Activity m_activity;
+ private ActionMode m_actionMode;
+
+ public EditMenu(Activity activity) {
+ m_activity = activity;
+ }
+
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ mode.setTitle(null);
+ mode.setSubtitle(null);
+ mode.setTitleOptionalHint(true);
+
+ Context context = m_activity;
+ int[] attrs = {
+ android.R.attr.actionModeSelectAllDrawable, android.R.attr.actionModeCutDrawable,
+ android.R.attr.actionModeCopyDrawable, android.R.attr.actionModePasteDrawable
+ };
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs);
+
+ menu.add(Menu.NONE, android.R.id.selectAll, Menu.NONE, android.R.string.selectAll)
+ .setIcon(a.getResourceId(0, 0))
+ .setAlphabeticShortcut('a')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add(Menu.NONE, android.R.id.cut, Menu.NONE, android.R.string.cut)
+ .setIcon(a.getResourceId(1, 0))
+ .setAlphabeticShortcut('x')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add(Menu.NONE, android.R.id.copy, Menu.NONE, android.R.string.copy)
+ .setIcon(a.getResourceId(2, 0))
+ .setAlphabeticShortcut('c')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ menu.add(Menu.NONE, android.R.id.paste, Menu.NONE, android.R.string.paste)
+ .setIcon(a.getResourceId(3, 0))
+ .setAlphabeticShortcut('v')
+ .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
+
+ return true;
+ }
+
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return true;
+ }
+
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+ m_actionMode = null;
+ }
+
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+
+ switch (item.getItemId()) {
+ case android.R.id.cut:
+ return QtNativeInputConnection.cut();
+ case android.R.id.copy:
+ return QtNativeInputConnection.copy();
+ case android.R.id.paste:
+ return QtNativeInputConnection.paste();
+ case android.R.id.selectAll:
+ return QtNativeInputConnection.selectAll();
+ }
+ return false;
+ }
+
+ public void hide()
+ {
+ if (m_actionMode != null) {
+ m_actionMode.finish();
+ }
+ }
+
+ public void show()
+ {
+ if (m_actionMode == null) {
+ m_actionMode = m_activity.startActionMode(this);
+ }
+ }
+
+ public boolean isShown()
+ {
+ return m_actionMode != null;
+ }
+}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java b/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java
new file mode 100644
index 0000000000..246be1aeb2
--- /dev/null
+++ b/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Android port 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$
+**
+****************************************************************************/
+
+package org.qtproject.qt5.android;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.ImageView;
+import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.view.MotionEvent;
+import android.widget.PopupWindow;
+import android.app.Activity;
+import android.view.ViewTreeObserver;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup.LayoutParams;
+import android.view.ViewGroup;
+
+// Helper class that manages a cursor or selection handle
+public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, OnClickListener
+{
+ private View m_layout = null;
+ private View m_view = null;
+ private PopupWindow m_popup = null;
+ private Activity m_activity;
+ private int m_posX;
+ private int m_posY;
+
+ public EditPopupMenu(Activity activity, View layout) {
+ m_activity = activity;
+ m_layout = layout;
+ }
+
+ private boolean initOverlay(){
+ if (m_popup == null){
+ Context context = m_layout.getContext();
+ int[] attrs = { android.R.attr.textEditPasteWindowLayout };
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs);
+ final int layout = a.getResourceId(0, 0);
+ LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ m_view = inflater.inflate(layout, null);
+
+ final int size = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+ m_view.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT));
+ m_view.measure(size, size);
+ m_view.setOnClickListener(this);
+
+ m_popup = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
+ m_popup.setSplitTouchEnabled(true);
+ m_popup.setClippingEnabled(false);
+ m_popup.setContentView(m_view);
+ m_popup.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
+ m_popup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+
+ m_layout.getViewTreeObserver().addOnPreDrawListener(this);
+ }
+ return true;
+ }
+
+ public int getHeight()
+ {
+ initOverlay();
+ return m_view.getHeight();
+ }
+
+ // Show the handle at a given position (or move it if it is already shown)
+ public void setPosition(final int x, final int y){
+ initOverlay();
+
+ final int[] location = new int[2];
+ m_layout.getLocationOnScreen(location);
+
+ int x2 = x + location[0];
+ int y2 = y + location[1];
+
+ x2 -= m_view.getWidth() / 2 ;
+ if (x2 < 0)
+ x2 = 0;
+ y2 -= m_view.getHeight();
+
+ if (m_popup.isShowing())
+ m_popup.update(x2, y2, -1, -1);
+ else
+ m_popup.showAtLocation(m_layout, 0, x2, y2);
+
+ m_posX = x;
+ m_posY = y;
+
+ }
+
+ public void hide() {
+ if (m_popup != null) {
+ m_popup.dismiss();
+ }
+ }
+
+ @Override
+ public boolean onPreDraw() {
+ // This hook is called when the view location is changed
+ // For example if the keyboard appears.
+ // Adjust the position of the handle accordingly
+ if (m_popup != null && m_popup.isShowing())
+ setPosition(m_posX, m_posY);
+
+ return true;
+ }
+
+ @Override
+ public void onClick(View v) {
+ QtNativeInputConnection.paste();
+ hide();
+ }
+}
+
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 656dbdda45..b602cabd27 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -2,6 +2,7 @@
**
** Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Android port of the Qt Toolkit.
@@ -143,6 +144,11 @@ public class QtActivityDelegate
private int m_portraitKeyboardHeight = 0;
private int m_landscapeKeyboardHeight = 0;
private int m_probeKeyboardHeightDelay = 50; // ms
+ private CursorHandle m_cursorHandle;
+ private CursorHandle m_leftSelectionHandle;
+ private CursorHandle m_rightSelectionHandle;
+ private EditMenu m_editMenu;
+ private EditPopupMenu m_editPopupMenu;
public void setFullScreen(boolean enterFullScreen)
{
@@ -470,6 +476,72 @@ public class QtActivityDelegate
m_imm.updateSelection(m_editText, selStart, selEnd, candidatesStart, candidatesEnd);
}
+ // Values coming from QAndroidInputContext::CursorHandleShowMode
+ private static final int CursorHandleNotShown = 0;
+ private static final int CursorHandleShowNormal = 1;
+ private static final int CursorHandleShowSelection = 2;
+ private static final int CursorHandleShowPopup = 3;
+
+ /* called from the C++ code when the position of the cursor or selection handles needs to
+ be adjusted.
+ mode is one of QAndroidInputContext::CursorHandleShowMode
+ */
+ public void updateHandles(int mode, int x1, int y1, int x2, int y2)
+ {
+ if (mode == CursorHandleNotShown) {
+ if (m_cursorHandle != null)
+ m_cursorHandle.hide();
+ if (m_rightSelectionHandle != null) {
+ m_rightSelectionHandle.hide();
+ m_leftSelectionHandle.hide();
+ }
+ if (m_editMenu != null)
+ m_editMenu.hide();
+ if (m_editPopupMenu != null)
+ m_editPopupMenu.hide();
+ } else if (mode == CursorHandleShowNormal || mode == CursorHandleShowPopup) {
+ if (m_cursorHandle == null) {
+ m_cursorHandle = new CursorHandle(m_activity, m_layout, QtNative.IdCursorHandle,
+ android.R.attr.textSelectHandle);
+ }
+ m_cursorHandle.setPosition(x1, y1);
+ if (m_rightSelectionHandle != null) {
+ m_rightSelectionHandle.hide();
+ m_leftSelectionHandle.hide();
+ }
+ } else if (mode == CursorHandleShowSelection) {
+ if (m_rightSelectionHandle == null) {
+ m_leftSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdLeftHandle,
+ android.R.attr.textSelectHandleLeft);
+ m_rightSelectionHandle = new CursorHandle(m_activity, m_layout, QtNative.IdRightHandle,
+ android.R.attr.textSelectHandleRight);
+ }
+ m_leftSelectionHandle.setPosition(x1,y1);
+ m_rightSelectionHandle.setPosition(x2,y2);
+ if (m_cursorHandle != null)
+ m_cursorHandle.hide();
+
+ if (m_editMenu == null)
+ m_editMenu = new EditMenu(m_activity);
+ m_editMenu.show();
+ }
+
+ // show the edit popup menu
+ if (mode == CursorHandleShowPopup && (m_editMenu == null || !m_editMenu.isShown())
+ && QtNative.hasClipboardText()) {
+ if (m_editPopupMenu == null)
+ m_editPopupMenu = new EditPopupMenu(m_activity, m_layout);
+ if (y2 < m_editPopupMenu.getHeight()) {
+ // If the popup cannot be shown over the text, it must be shown under the anchors
+ y2 = y1 + 2 * m_editPopupMenu.getHeight();
+ }
+ m_editPopupMenu.setPosition(x2, y2);
+ } else if (m_editPopupMenu != null) {
+ m_editPopupMenu.hide();
+ }
+
+ }
+
public boolean loadApplication(Activity activity, ClassLoader classLoader, Bundle loaderParams)
{
/// check parameters integrity
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 04b8e6a06f..4df2cb88c9 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -492,6 +492,20 @@ public class QtNative
});
}
+ private static void updateHandles(final int mode,
+ final int x1,
+ final int y1,
+ final int x2,
+ final int y2)
+ {
+ runAction(new Runnable() {
+ @Override
+ public void run() {
+ m_activityDelegate.updateHandles(mode, x1, y1, x2, y2);
+ }
+ });
+ }
+
private static void showSoftwareKeyboard(final int x,
final int y,
final int width,
@@ -569,7 +583,7 @@ public class QtNative
m_clipboardManager.setText(text);
}
- private static boolean hasClipboardText()
+ public static boolean hasClipboardText()
{
if (m_clipboardManager != null)
return m_clipboardManager.hasText();
@@ -777,6 +791,13 @@ public class QtNative
public static native void keyboardGeometryChanged(int x, int y, int width, int height);
// keyboard methods
+ // handle methods
+ public static final int IdCursorHandle = 1;
+ public static final int IdLeftHandle = 2;
+ public static final int IdRightHandle = 3;
+ public static native void handleLocationChanged(int id, int x, int y);
+ // handle methods
+
// dispatch events methods
public static native boolean dispatchGenericMotionEvent(MotionEvent ev);
public static native boolean dispatchKeyEvent(KeyEvent event);
diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri
index 9eae06d410..c948e27dc3 100644
--- a/src/angle/src/common/common.pri
+++ b/src/angle/src/common/common.pri
@@ -1,5 +1,5 @@
# static builds should still link ANGLE dynamically when dynamic GL is enabled
-static:contains(QT_CONFIG, dynamicgl) {
+static:qtConfig(dynamicgl) {
CONFIG -= static
CONFIG += shared
}
diff --git a/src/angle/src/compiler/preprocessor/preprocessor.pro b/src/angle/src/compiler/preprocessor/preprocessor.pro
index cbf411623d..f9170b3bee 100644
--- a/src/angle/src/compiler/preprocessor/preprocessor.pro
+++ b/src/angle/src/compiler/preprocessor/preprocessor.pro
@@ -1,5 +1,5 @@
CONFIG += static
-contains(QT_CONFIG, dynamicgl): CONFIG += not_installed
+qtConfig(dynamicgl): CONFIG += not_installed
include(../../config.pri)
INCLUDEPATH = $$ANGLE_DIR/src/compiler/preprocessor
diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro
index d48ac70472..cee13d06bb 100644
--- a/src/angle/src/compiler/translator.pro
+++ b/src/angle/src/compiler/translator.pro
@@ -1,5 +1,5 @@
CONFIG += static
-contains(QT_CONFIG, dynamicgl): CONFIG += not_installed
+qtConfig(dynamicgl): CONFIG += not_installed
include(../config.pri)
INCLUDEPATH += \
diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro
index fd15a3c758..337f4042bd 100644
--- a/src/concurrent/concurrent.pro
+++ b/src/concurrent/concurrent.pro
@@ -37,7 +37,7 @@ HEADERS += \
# private headers
HEADERS += \
-contains(QT_CONFIG, clock-gettime) {
+qtConfig(clock-gettime) {
linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt
}
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index a5ed8b2ea3..545b9a3d1e 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -116,7 +116,7 @@ set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<
set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
-!!IF contains(QT_CONFIG, reduce_exports)
+!!IF qtConfig(reduce_exports)
set(QT_VISIBILITY_AVAILABLE \"True\")
!!ENDIF
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri
index 0f7c2b887b..b628bcc6ec 100644
--- a/src/corelib/arch/arch.pri
+++ b/src/corelib/arch/arch.pri
@@ -4,4 +4,4 @@ HEADERS += \
arch/qatomic_bootstrap.h \
arch/qatomic_cxx11.h
-atomic64-libatomic: LIBS += -latomic
+qtConfig(libatomic): QMAKE_USE += libatomic
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index fdaec33c5a..4fa778d042 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -17,7 +17,7 @@ SOURCES += \
codecs/qtsciicodec.cpp \
codecs/qutfcodec.cpp
-contains(QT_CONFIG,icu) {
+qtConfig(icu) {
HEADERS += \
codecs/qicucodec_p.h
SOURCES += \
@@ -40,20 +40,17 @@ contains(QT_CONFIG,icu) {
codecs/qeuckrcodec.cpp \
codecs/qbig5codec.cpp
- unix:!qnx:!darwin:!linux-android-* {
- contains(QT_CONFIG, iconv) {
- HEADERS += codecs/qiconvcodec_p.h
- SOURCES += codecs/qiconvcodec.cpp
- contains(QT_CONFIG, gnu-libiconv) {
- DEFINES += GNU_LIBICONV
- LIBS_PRIVATE *= -liconv
- } else: contains(QT_CONFIG, sun-libiconv) {
- DEFINES += GNU_LIBICONV
- }
+ qtConfig(iconv) {
+ HEADERS += codecs/qiconvcodec_p.h
+ SOURCES += codecs/qiconvcodec.cpp
+ qtConfig(gnu-libiconv) {
+ DEFINES += GNU_LIBICONV
+ QMAKE_USE_PRIVATE += iconv
+ } else: qtConfig(sun-libiconv) {
+ DEFINES += GNU_LIBICONV
}
- } else:!win32-msvc* {
- DEFINES += QT_NO_ICONV
}
+
win32 {
SOURCES += codecs/qwindowscodec.cpp
HEADERS += codecs/qwindowscodec_p.h
diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc
index e2fce5797d..fe9b43507c 100644
--- a/src/corelib/doc/src/qtcore-index.qdoc
+++ b/src/corelib/doc/src/qtcore-index.qdoc
@@ -101,7 +101,19 @@
\li \l{The Event System}
\endlist
- \section1 Related Information
+ \section1 Licenses and Attributions
+
+ Qt Core is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt Core potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtcore}
+
\section1 Reference
These are links to the API reference materials.
\list
diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc
index 95cf585b61..e32343bb1b 100644
--- a/src/corelib/doc/src/resource-system.qdoc
+++ b/src/corelib/doc/src/resource-system.qdoc
@@ -136,7 +136,7 @@
\image resources.png Building resources into an application
Currently, Qt always stores the data directly in the executable,
- even on Windows, OS X, and iOS, where the operating system provides
+ even on Windows, \macos, and iOS, where the operating system provides
native support for resources. This might change in a future Qt
release.
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 170dd757d3..284e833f73 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1071,8 +1071,8 @@ bool qSharedBuild() Q_DECL_NOTHROW
\endlist
Some constants are defined only on certain platforms. You can use
- the preprocessor symbols Q_OS_WIN and Q_OS_OSX to test that
- the application is compiled under Windows or OS X.
+ the preprocessor symbols Q_OS_WIN and Q_OS_MACOS to test that
+ the application is compiled under Windows or \macos.
\sa QLibraryInfo
*/
@@ -1111,7 +1111,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
/*!
\fn QSysInfo::MacVersion QSysInfo::macVersion()
- Returns the version of Darwin (OS X or iOS) on which the
+ Returns the version of Darwin (\macos or iOS) on which the
application is run, or MV_None if the operating system
is not a version of Darwin.
*/
@@ -1179,24 +1179,24 @@ bool qSharedBuild() Q_DECL_NOTHROW
\enum QSysInfo::MacVersion
This enum provides symbolic names for the various versions of the
- Darwin operating system, covering both OS X and iOS. The
+ Darwin operating system, covering both \macos and iOS. The
QSysInfo::MacintoshVersion variable gives the version of the
system on which the application is run.
- \value MV_9 Mac OS 9
- \value MV_10_0 Mac OS X 10.0
- \value MV_10_1 Mac OS X 10.1
- \value MV_10_2 Mac OS X 10.2
- \value MV_10_3 Mac OS X 10.3
- \value MV_10_4 Mac OS X 10.4
- \value MV_10_5 Mac OS X 10.5
- \value MV_10_6 Mac OS X 10.6
- \value MV_10_7 Mac OS X 10.7
- \value MV_10_8 OS X 10.8
- \value MV_10_9 OS X 10.9
- \value MV_10_10 OS X 10.10
- \value MV_10_11 OS X 10.11
- \value MV_10_12 macOS 10.12
+ \value MV_9 \macos 9
+ \value MV_10_0 \macos 10.0
+ \value MV_10_1 \macos 10.1
+ \value MV_10_2 \macos 10.2
+ \value MV_10_3 \macos 10.3
+ \value MV_10_4 \macos 10.4
+ \value MV_10_5 \macos 10.5
+ \value MV_10_6 \macos 10.6
+ \value MV_10_7 \macos 10.7
+ \value MV_10_8 \macos 10.8
+ \value MV_10_9 \macos 10.9
+ \value MV_10_10 \macos 10.10
+ \value MV_10_11 \macos 10.11
+ \value MV_10_12 \macos 10.12
\value MV_Unknown An unknown and currently unsupported platform
\value MV_CHEETAH Apple codename for MV_10_0
@@ -1247,7 +1247,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\macro Q_OS_DARWIN
\relates <QtGlobal>
- Defined on Darwin-based operating systems such as macOS, iOS, watchOS, and tvOS.
+ Defined on Darwin-based operating systems such as \macOS, iOS, watchOS, and tvOS.
*/
/*!
@@ -1268,7 +1268,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\macro Q_OS_MACOS
\relates <QtGlobal>
- Defined on macOS.
+ Defined on \macos.
*/
/*!
@@ -1946,6 +1946,8 @@ QSysInfo::MacVersion QSysInfo::macVersion()
return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor));
#elif defined(Q_OS_TVOS)
return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor));
+#elif defined(Q_OS_WATCHOS)
+ return QSysInfo::MacVersion(Q_MV_WATCHOS(version.major, version.minor));
#else
return QSysInfo::MV_Unknown;
#endif
@@ -2568,7 +2570,7 @@ static QString unknownText()
Note that this function may return surprising values: it returns "linux"
for all operating systems running Linux (including Android), "qnx" for all
operating systems running QNX, "freebsd" for
- Debian/kFreeBSD, and "darwin" for OS X and iOS. For information on the type
+ Debian/kFreeBSD, and "darwin" for \macos and iOS. For information on the type
of product the application is running on, see productType().
\sa QFileSelector, kernelVersion(), productType(), productVersion(), prettyProductName()
@@ -2590,7 +2592,7 @@ QString QSysInfo::kernelType()
Returns the release version of the operating system kernel. On Windows, it
returns the version of the NT kernel. On Unix systems, including
- Android and OS X, it returns the same as the \c{uname -r}
+ Android and \macos, it returns the same as the \c{uname -r}
command would return.
If the version could not be determined, this function may return an empty
@@ -2631,11 +2633,12 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, macOS, iOS and tvOS note}: this function returns "macos" for macOS
- systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case
- the system could not be determined.
+ \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
+ "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
+ "watchos" for watchOS systems, and "darwin" in case the system could not
+ be determined.
- \b{OS X note}: this function returns "osx" for versions of macOS prior to 10.12.
+ \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@@ -2667,6 +2670,8 @@ QString QSysInfo::productType()
return QStringLiteral("ios");
#elif defined(Q_OS_TVOS)
return QStringLiteral("tvos");
+#elif defined(Q_OS_WATCHOS)
+ return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version();
if (version.major == 10 && version.minor < 12)
@@ -2690,7 +2695,7 @@ QString QSysInfo::productType()
Returns the product version of the operating system in string form. If the
version could not be determined, this function returns "unknown".
- It will return the Android, iOS, OS X, Windows full-product
+ It will return the Android, iOS, \macos, Windows full-product
versions on those systems. In particular, on OS X, iOS and Windows, the
returned string is similar to the macVersion() or windowsVersion() enums.
@@ -2754,6 +2759,8 @@ QString QSysInfo::prettyProductName()
return QLatin1String("iOS ") + productVersion();
#elif defined(Q_OS_TVOS)
return QLatin1String("tvOS ") + productVersion();
+#elif defined(Q_OS_WATCHOS)
+ return QLatin1String("watchOS ") + productVersion();
#elif defined(Q_OS_MACOS)
const QAppleOperatingSystemVersion version = qt_apple_os_version();
const char *name = osxVer_helper(version);
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index c5d891cc28..e6d65b0f99 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -56,19 +56,29 @@
*/
#define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-#if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE)
+#ifndef QT_BOOTSTRAPPED
#include <QtCore/qconfig.h>
#include <QtCore/qfeatures.h>
#endif
// The QT_SUPPORTS macro is deprecated. Don't use it in new code.
-// Instead, use #ifdef/ndef QT_NO_feature.
+// Instead, use QT_CONFIG(feature)
// ### Qt6: remove macro
#ifdef _MSC_VER
# define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
#else
# define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
#endif
+
+/*
+ The QT_CONFIG macro implements a safe compile time check for features of Qt.
+ Features can be in three states:
+ 0 or undefined: This will lead to a compile error when testing for it
+ -1: The feature is not available
+ 1: The feature is available
+*/
+#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
+
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
# define QT_NO_UNSHARABLE_CONTAINERS
#endif
@@ -538,6 +548,12 @@ Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max
#ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE
# define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref
#endif
+#ifndef Q_FORWARD_DECLARE_CG_TYPE
+#define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
+#endif
+#ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE
+#define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
+#endif
#ifdef Q_OS_DARWIN
# define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \
diff --git a/src/corelib/global/qglobal_p.h b/src/corelib/global/qglobal_p.h
index e8d822b6c6..e75d87b384 100644
--- a/src/corelib/global/qglobal_p.h
+++ b/src/corelib/global/qglobal_p.h
@@ -48,5 +48,14 @@
#include "qglobal.h"
#include "qglobal_p.h" // include self to avoid syncqt warning - no-op
+#ifndef QT_BOOTSTRAPPED
+#include <QtCore/private/qconfig_p.h>
+#endif
+
+#define QT_LIBRARY_VERSION(lib) QT_LIBRARY_VERSION_##lib
+#define QT_LIBRARY_VERSION_MAJOR(lib) (QT_LIBRARY_VERSION_##lib >> 16)
+#define QT_LIBRARY_VERSION_MINOR(lib) ((QT_LIBRARY_VERSION_##lib >> 8) & 0xff)
+#define QT_LIBRARY_VERSION_PATCH(lib) (QT_LIBRARY_VERSION_##lib & 0xff)
+
#endif // QGLOBAL_P_H
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index d8a0acabf1..bf55693e8a 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -111,7 +111,7 @@
shown in any menus unless specifically set by the
QAction::iconVisibleInMenu property.
Menus that are currently open or menus already created in the native
- OS X menubar \e{may not} pick up a change in this attribute. Changes
+ \macos menubar \e{may not} pick up a change in this attribute. Changes
in the QAction::iconVisibleInMenu property will always be picked up.
\value AA_NativeWindows Ensures that widgets have native windows.
@@ -137,9 +137,9 @@
\value AA_DontUseNativeMenuBar All menubars created while this attribute is
set to true won't be used as a native menubar (e.g, the menubar at
- the top of the main screen on OS X or at the bottom in Windows CE).
+ the top of the main screen on \macos or at the bottom in Windows CE).
- \value AA_MacDontSwapCtrlAndMeta On OS X by default, Qt swaps the
+ \value AA_MacDontSwapCtrlAndMeta On \macos by default, Qt swaps the
Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt
sends Meta, and whenever Meta is pressed Control is sent). When this
attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey
@@ -357,7 +357,7 @@
\omitvalue KeyboardModifierMask
- \note On OS X, the \c ControlModifier value corresponds to
+ \note On \macos, the \c ControlModifier value corresponds to
the Command keys on the Macintosh keyboard, and the \c MetaModifier value
corresponds to the Control keys. The \c KeypadModifier value will also be set
when an arrow key is pressed as the arrow keys are considered part of the
@@ -375,7 +375,7 @@
This enum provides shorter names for the keyboard modifier keys
supported by Qt.
- \note On OS X, the \c CTRL value corresponds to
+ \note On \macos, the \c CTRL value corresponds to
the Command keys on the Macintosh keyboard, and the \c META value
corresponds to the Control keys.
@@ -974,34 +974,34 @@
\value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip
should be opaque instead of transparent (the default). This attribute
- is only applicable to OS X and is set by the widget's author.
+ is only applicable to \macos and is set by the widget's author.
\value WA_MacShowFocusRect Indicates that this widget should get a
QFocusFrame around it. Some widgets draw their own focus halo
regardless of this attribute. Not that the QWidget::focusPolicy
also plays the main role in whether something is given focus or
not, this only controls whether or not this gets the focus
- frame. This attribute is only applicable to OS X.
+ frame. This attribute is only applicable to \macos.
\value WA_MacNormalSize Indicates the widget should have the
- normal size for widgets in OS X. This attribute is only
- applicable to OS X.
+ normal size for widgets in \macos. This attribute is only
+ applicable to \macos.
\value WA_MacSmallSize Indicates the widget should have the small
- size for widgets in OS X. This attribute is only applicable to
- OS X.
+ size for widgets in \macos. This attribute is only applicable to
+ \macos.
\value WA_MacMiniSize Indicates the widget should have the mini
- size for widgets in OS X. This attribute is only applicable to
- OS X.
+ size for widgets in \macos. This attribute is only applicable to
+ \macos.
\value WA_MacVariableSize Indicates the widget can choose between
alternative sizes for widgets to avoid clipping.
- This attribute is only applicable to OS X.
+ This attribute is only applicable to \macos.
\value WA_MacBrushedMetal Indicates the widget should be drawn in
the brushed metal style as supported by the windowing system. This
- attribute is only applicable to OS X.
+ attribute is only applicable to \macos.
\omitvalue WA_MacMetalStyle
@@ -1151,14 +1151,14 @@
\b Warning: This flag must \e never be set or cleared by the widget's author.
\value WA_WindowModified Indicates that the window is marked as modified.
- On some platforms this flag will do nothing, on others (including OS X
+ On some platforms this flag will do nothing, on others (including \macos
and Windows) the window will take a modified appearance. This flag is set
or cleared by QWidget::setWindowModified().
\value WA_WindowPropagation Makes a toplevel window inherit font and
palette from its parent.
- \value WA_MacAlwaysShowToolWindow On OS X, show the tool window even
+ \value WA_MacAlwaysShowToolWindow On \macos, show the tool window even
when the application is not active. By default, all tool windows are
hidden when the application is inactive.
@@ -1341,8 +1341,8 @@
\value Key_PageUp
\value Key_PageDown
\value Key_Shift
- \value Key_Control On OS X, this corresponds to the Command keys.
- \value Key_Meta On OS X, this corresponds to the Control keys.
+ \value Key_Control On \macos, this corresponds to the Command keys.
+ \value Key_Meta On \macos, this corresponds to the Control keys.
On Windows keyboards, this key is mapped to the
Windows key.
\value Key_Alt
@@ -2002,7 +2002,7 @@
\value TabFocus the widget accepts focus by tabbing.
\value ClickFocus the widget accepts focus by clicking.
\value StrongFocus the widget accepts focus by both tabbing
- and clicking. On OS X this will also
+ and clicking. On \macos this will also
be indicate that the widget accepts tab focus
when in 'Text/List focus mode'.
\value WheelFocus like Qt::StrongFocus plus the widget accepts
@@ -2108,7 +2108,7 @@
system supports it, a tool window can be decorated
with a somewhat lighter frame. It can also be
combined with Qt::FramelessWindowHint.
- On OS X, tool windows correspond to the
+ On \macos, tool windows correspond to the
\l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating}
class of windows. This means that the window lives on a
level above normal windows; it impossible to put a normal
@@ -2197,10 +2197,10 @@
\value WindowContextHelpButtonHint Adds a context help button to dialogs.
On some platforms this implies Qt::WindowSystemMenuHint for it to work.
- \value MacWindowToolBarButtonHint On OS X adds a tool bar button (i.e.,
+ \value MacWindowToolBarButtonHint On \macos adds a tool bar button (i.e.,
the oblong button that is on the top right of windows that have toolbars).
- \value WindowFullscreenButtonHint On OS X adds a fullscreen button.
+ \value WindowFullscreenButtonHint On \macos adds a fullscreen button.
\value BypassGraphicsProxyWidget Prevents the window and its children from
automatically embedding themselves into a QGraphicsProxyWidget if the
@@ -2224,7 +2224,7 @@
that support _NET_WM_STATE_BELOW atom. If a window always
on the bottom has a parent, the parent will also be left on
the bottom. This window hint is currently not implemented
- for OS X.
+ for \macos.
\value WindowTransparentForInput Informs the window system that this window
is used only for output (displaying something) and does not take input.
@@ -3088,7 +3088,7 @@
\value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval
\value VeryCoarseTimer Very coarse timers only keep full second accuracy
- On UNIX (including Linux, OS X, and iOS), Qt will keep millisecond accuracy
+ On UNIX (including Linux, \macos, and iOS), Qt will keep millisecond accuracy
for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up
to 5% to align the timer with other timers that are expected to fire at or
around the same time. The objective is to make most timers wake up at the
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 7d725f617c..ef40a45dc4 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -66,8 +66,9 @@
#include <float.h>
#endif
-#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || !defined(__cplusplus) || __cplusplus < 201103L)
-#include <math.h>
+#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL) || !defined(__cplusplus))
+# include <math.h>
+# define QT_MATH_H_DEFINES_MACROS
QT_BEGIN_NAMESPACE
namespace qnumeric_std_wrapper {
// the 'using namespace std' below is cases where the stdlib already put the math.h functions in the std namespace and undefined the macros.
@@ -96,7 +97,8 @@ static inline bool isfinite(double d) { return !!_finite(d); }
static inline bool isnan(float f) { return !!_isnan(f); }
static inline bool isinf(float f) { return !_finite(f) && !_isnan(f); }
static inline bool isfinite(float f) { return !!_finite(f); }
-#elif !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || !defined(__cplusplus) || __cplusplus < 201103L)
+#elif defined(QT_MATH_H_DEFINES_MACROS)
+# undef QT_MATH_H_DEFINES_MACROS
static inline bool isnan(double d) { return math_h_isnan(d); }
static inline bool isinf(double d) { return math_h_isinf(d); }
static inline bool isfinite(double d) { return math_h_isfinite(d); }
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index 31d78bca50..f01b45cbf9 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -122,6 +122,7 @@ public:
#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0))
#define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor)
+#define Q_MV_WATCHOS(major, minor) (QSysInfo::MV_WATCHOS | major << 4 | minor)
enum MacVersion {
MV_None = 0xffff,
MV_Unknown = 0x0000,
@@ -182,7 +183,14 @@ public:
MV_TVOS_9_0 = Q_MV_TVOS(9, 0),
MV_TVOS_9_1 = Q_MV_TVOS(9, 1),
MV_TVOS_9_2 = Q_MV_TVOS(9, 2),
- MV_TVOS_10_0 = Q_MV_TVOS(10, 0)
+ MV_TVOS_10_0 = Q_MV_TVOS(10, 0),
+
+ /* watchOS */
+ MV_WATCHOS = 1 << 10,
+ MV_WATCHOS_2_0 = Q_MV_WATCHOS(2, 0),
+ MV_WATCHOS_2_1 = Q_MV_WATCHOS(2, 1),
+ MV_WATCHOS_2_2 = Q_MV_WATCHOS(2, 2),
+ MV_WATCHOS_3_0 = Q_MV_WATCHOS(3, 0)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 90954b1eca..3b486b8f6f 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -102,17 +102,15 @@
# define Q_OS_DARWIN32
# endif
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+# define QT_PLATFORM_UIKIT
# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
# define Q_OS_WATCHOS
+# elif defined(TARGET_OS_TV) && TARGET_OS_TV
+# define Q_OS_TVOS
# else
-# define QT_PLATFORM_UIKIT
-# if defined(TARGET_OS_TV) && TARGET_OS_TV
-# define Q_OS_TVOS
-# else
-# // TARGET_OS_IOS is only available in newer SDKs,
-# // so assume any other iOS-based platform is iOS for now
-# define Q_OS_IOS
-# endif
+# // TARGET_OS_IOS is only available in newer SDKs,
+# // so assume any other iOS-based platform is iOS for now
+# define Q_OS_IOS
# endif
# else
# // TARGET_OS_OSX is only available in newer SDKs,
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index ab345e9aae..0414ae966a 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -135,7 +135,7 @@ win32 {
io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp
- !integrity:!tvos {
+ !integrity:!uikit {
SOURCES += io/forkfd_qt.cpp
HEADERS += \
../3rdparty/forkfd/forkfd.h
@@ -169,7 +169,7 @@ win32 {
io/qstorageinfo_unix.cpp
}
- linux|if(qnx:contains(QT_CONFIG, inotify)) {
+ linux|if(qnx:qtConfig(inotify)) {
SOURCES += io/qfilesystemwatcher_inotify.cpp
HEADERS += io/qfilesystemwatcher_inotify_p.h
}
diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp
index 7e64035b30..9606ec68e9 100644
--- a/src/corelib/io/qabstractfileengine.cpp
+++ b/src/corelib/io/qabstractfileengine.cpp
@@ -305,7 +305,7 @@ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName)
the file system (i.e. not a file or directory).
\value FileType The file is a regular file to the file system
(i.e. not a link or directory)
- \value BundleType OS X and iOS: the file is a bundle; implies DirectoryType
+ \value BundleType \macos and iOS: the file is a bundle; implies DirectoryType
\value DirectoryType The file is a directory in the file system
(i.e. not a link or file).
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 8021f29e16..abc2abeaec 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -438,8 +438,8 @@ inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
#define QT_FORWARD_DECLARE_CF_TYPE(type) Q_FORWARD_DECLARE_CF_TYPE(type);
#define QT_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type);
-#define QT_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
-#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
+#define QT_FORWARD_DECLARE_CG_TYPE(type) Q_FORWARD_DECLARE_CG_TYPE(type);
+#define QT_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type);
QT_END_NAMESPACE
Q_FORWARD_DECLARE_CF_TYPE(CFString);
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 6366c5120c..8b9efb638a 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -240,7 +240,7 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
isSymLink(). The symLinkTarget() function provides the name of the file
the symlink points to.
- On Unix (including OS X and iOS), the symlink has the same size() has
+ On Unix (including \macos and iOS), the symlink has the same size() has
the file it points to, because Unix handles symlinks
transparently; similarly, opening a symlink using QFile
effectively opens the link's target. For example:
@@ -760,7 +760,7 @@ QString QFileInfo::fileName() const
\since 4.3
Returns the name of the bundle.
- On OS X and iOS this returns the proper localized name for a bundle if the
+ On \macos and iOS this returns the proper localized name for a bundle if the
path isBundle(). On all other platforms an empty QString is returned.
Example:
@@ -1042,7 +1042,7 @@ bool QFileInfo::isDir() const
/*!
\since 4.3
Returns \c true if this object points to a bundle or to a symbolic
- link to a bundle on OS X and iOS; otherwise returns \c false.
+ link to a bundle on \macos and iOS; otherwise returns \c false.
\sa isDir(), isSymLink(), isFile()
*/
@@ -1063,7 +1063,7 @@ bool QFileInfo::isBundle() const
Returns \c true if this object points to a symbolic link (or to a
shortcut on Windows); otherwise returns \c false.
- On Unix (including OS X and iOS), opening a symlink effectively opens
+ On Unix (including \macos and iOS), opening a symlink effectively opens
the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c
.lnk file itself.
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index 55f4bddd17..d3aef27296 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -191,7 +191,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re
the file system monitor. Also note that your process may have
other file descriptors open in addition to the ones for files
being monitored, and these other open descriptors also count in
- the total. OS X uses a different backend and does not
+ the total. \macos uses a different backend and does not
suffer from this issue.
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index fbee1a223f..c560bc7a03 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -907,7 +907,7 @@ void QIODevicePrivate::seekBuffer(qint64 newPos)
For some devices, atEnd() can return true even though there is more data
to read. This special case only applies to devices that generate data in
direct response to you calling read() (e.g., \c /dev or \c /proc files on
- Unix and OS X, or console input / \c stdin on all platforms).
+ Unix and \macos, or console input / \c stdin on all platforms).
\sa bytesAvailable(), read(), isSequential()
*/
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 924d2e7214..82beb15912 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -141,7 +141,7 @@ static QBasicMutex fcntlLock;
/*!
\internal
Checks that the OS isn't using POSIX locks to emulate flock().
- OS X is one of those.
+ \macos is one of those.
*/
static bool fcntlWorksAfterFlock(const QString &fn)
{
@@ -188,7 +188,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
% localHostName() % '\n';
const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
+ const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd < 0) {
switch (errno) {
case EEXIST:
@@ -229,7 +229,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
bool QLockFilePrivate::removeStaleLock()
{
const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0644);
+ const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY, 0666);
if (fd < 0) // gone already?
return false;
bool success = setNativeLocks(fileName, fd) && (::unlink(lockFileName) == 0);
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index afdf0d0312..967a614a2d 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -183,7 +183,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
by QStandardPaths::GenericConfigLocation, e.g.
\list
- \li on OS X and iOS: \c ~/Library/Preferences
+ \li on \macos and iOS: \c ~/Library/Preferences
\li on Unix: \c ~/.config, \c /etc/xdg
\li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%,
\l QCoreApplication::applicationDirPath(),
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ebafd6b524..f9b3b9fb00 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1948,7 +1948,7 @@ void QProcess::setProcessState(ProcessState state)
/*!
This function is called in the child process context just before the
- program is executed on Unix or OS X (i.e., after \c fork(), but before
+ program is executed on Unix or \macos (i.e., after \c fork(), but before
\c execve()). Reimplement this function to do last minute initialization
of the child process. Example:
@@ -1959,7 +1959,7 @@ void QProcess::setProcessState(ProcessState state)
execution, your workaround is to emit finished() and then call
exit().
- \warning This function is called by QProcess on Unix and OS X
+ \warning This function is called by QProcess on Unix and \macos
only. On Windows and QNX, it is not called.
*/
void QProcess::setupChildProcess()
@@ -2350,7 +2350,7 @@ void QProcess::setArguments(const QStringList &arguments)
On Windows, terminate() posts a WM_CLOSE message to all top-level windows
of the process and then to the main thread of the process itself. On Unix
- and OS X the \c SIGTERM signal is sent.
+ and \macos the \c SIGTERM signal is sent.
Console applications on Windows that do not run an event loop, or whose
event loop does not handle the WM_CLOSE message, can only be terminated by
@@ -2367,7 +2367,7 @@ void QProcess::terminate()
/*!
Kills the current process, causing it to exit immediately.
- On Windows, kill() uses TerminateProcess, and on Unix and OS X, the
+ On Windows, kill() uses TerminateProcess, and on Unix and \macos, the
SIGKILL signal is sent to the process.
\sa terminate()
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 11f201344e..ffcb2e2d72 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1917,7 +1917,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
Users normally expect an application to remember its settings
(window sizes and positions, options, etc.) across sessions. This
information is often stored in the system registry on Windows,
- and in property list files on OS X and iOS. On Unix systems, in the
+ and in property list files on \macos and iOS. On Unix systems, in the
absence of a standard, many applications (including the KDE
applications) use INI text files.
@@ -1962,8 +1962,8 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\snippet settings/settings.cpp 4
(Here, we also specify the organization's Internet domain. When
- the Internet domain is set, it is used on OS X and iOS instead of the
- organization name, since OS X and iOS applications conventionally use
+ the Internet domain is set, it is used on \macos and iOS instead of the
+ organization name, since \macos and iOS applications conventionally use
Internet domains to identify themselves. If no domain is set, a
fake domain is derived from the organization name. See the
\l{Platform-Specific Notes} below for details.)
@@ -2021,7 +2021,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
Setting keys can contain any Unicode characters. The Windows
registry and INI files use case-insensitive keys, whereas the
- CFPreferences API on OS X and iOS uses case-sensitive keys. To
+ CFPreferences API on \macos and iOS uses case-sensitive keys. To
avoid portability problems, follow these simple rules:
\list 1
@@ -2195,7 +2195,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\li \c{/etc/xdg/MySoft.conf}
\endlist
- On Mac OS X versions 10.2 and 10.3, these files are used by
+ On \macos versions 10.2 and 10.3, these files are used by
default:
\list 1
@@ -2223,7 +2223,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
in the application's home directory.
If the file format is IniFormat, the following files are
- used on Unix, OS X, and iOS:
+ used on Unix, \macos, and iOS:
\list 1
\li \c{$HOME/.config/MySoft/Star Runner.ini} (Qt for Embedded Linux: \c{$HOME/Settings/MySoft/Star Runner.ini})
@@ -2250,7 +2250,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
in the application's home directory.
The paths for the \c .ini and \c .conf files can be changed using
- setPath(). On Unix, OS X, and iOS the user can override them by
+ setPath(). On Unix, \macos, and iOS the user can override them by
setting the \c XDG_CONFIG_HOME environment variable; see
setPath() for details.
@@ -2267,7 +2267,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
You can then use the QSettings object to read and write settings
in the file.
- On OS X and iOS, you can access property list \c .plist files by passing
+ On \macos and iOS, you can access property list \c .plist files by passing
QSettings::NativeFormat as second argument. For example:
\snippet code/src_corelib_io_qsettings.cpp 3
@@ -2321,13 +2321,13 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
limitations is to store the settings using the IniFormat
instead of the NativeFormat.
- \li On OS X and iOS, allKeys() will return some extra keys for global
+ \li On \macos and iOS, allKeys() will return some extra keys for global
settings that apply to all applications. These keys can be
read using value() but cannot be changed, only shadowed.
Calling setFallbacksEnabled(false) will hide these global
settings.
- \li On OS X and iOS, the CFPreferences API used by QSettings expects
+ \li On \macos and iOS, the CFPreferences API used by QSettings expects
Internet domain names rather than organization names. To
provide a uniform API, QSettings derives a fake domain name
from the organization name (unless the organization name
@@ -2344,7 +2344,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\snippet code/src_corelib_io_qsettings.cpp 7
- \li On OS X, permissions to access settings not belonging to the
+ \li On \macos, permissions to access settings not belonging to the
current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to
that version, users having admin rights could access these. For 10.7 and
10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
@@ -2373,7 +2373,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
\value NativeFormat Store the settings using the most
appropriate storage format for the platform.
On Windows, this means the system registry;
- on OS X and iOS, this means the CFPreferences
+ on \macos and iOS, this means the CFPreferences
API; on Unix, this means textual
configuration files in INI format.
\value Registry32Format Windows only: Explicitly access the 32-bit system registry
@@ -2546,7 +2546,7 @@ QSettings::QSettings(Format format, Scope scope, const QString &organization,
If \a format is QSettings::NativeFormat, the meaning of \a
fileName depends on the platform. On Unix, \a fileName is the
- name of an INI file. On OS X and iOS, \a fileName is the name of a
+ name of an INI file. On \macos and iOS, \a fileName is the name of a
\c .plist file. On Windows, \a fileName is a path in the system
registry.
@@ -2599,7 +2599,7 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent)
called, the QSettings object will not be able to read or write
any settings, and status() will return AccessError.
- On OS X and iOS, if both a name and an Internet domain are specified
+ On \macos and iOS, if both a name and an Internet domain are specified
for the organization, the domain is preferred over the name. On
other platforms, the name is preferred over the domain.
@@ -3115,7 +3115,7 @@ bool QSettings::isWritable() const
exists, the previous value is overwritten.
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3154,7 +3154,7 @@ void QSettings::setValue(const QString &key, const QVariant &value)
\snippet code/src_corelib_io_qsettings.cpp 25
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3189,7 +3189,7 @@ void QSettings::remove(const QString &key)
relative to that group.
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3251,7 +3251,7 @@ bool QSettings::event(QEvent *event)
returned.
Note that the Windows registry and INI files use case-insensitive
- keys, whereas the CFPreferences API on OS X and iOS uses
+ keys, whereas the CFPreferences API on \macos and iOS uses
case-sensitive keys. To avoid portability problems, see the
\l{Section and Key Syntax} rules.
@@ -3354,18 +3354,18 @@ void QSettings::setUserIniPath(const QString &dir)
\row \li SystemScope \li \c /etc/xdg
\row \li{1,2} Qt for Embedded Linux \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/Settings
\row \li SystemScope \li \c /etc/xdg
- \row \li{1,2} OS X and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config
+ \row \li{1,2} \macos and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config
\row \li SystemScope \li \c /etc/xdg
\endtable
- The default UserScope paths on Unix, OS X, and iOS (\c
+ The default UserScope paths on Unix, \macos, and iOS (\c
$HOME/.config or $HOME/Settings) can be overridden by the user by setting the
\c XDG_CONFIG_HOME environment variable. The default SystemScope
- paths on Unix, OS X, and iOS (\c /etc/xdg) can be overridden when
+ paths on Unix, \macos, and iOS (\c /etc/xdg) can be overridden when
building the Qt library using the \c configure script's \c
-sysconfdir flag (see QLibraryInfo for details).
- Setting the NativeFormat paths on Windows, OS X, and iOS has no
+ Setting the NativeFormat paths on Windows, \macos, and iOS has no
effect.
\warning This function doesn't affect existing QSettings objects.
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 02318d427a..4cf3a3e9bd 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -153,7 +153,7 @@ QT_BEGIN_NAMESPACE
paths, if any, represent non-writable locations.
\table
- \header \li Path type \li OS X \li Windows
+ \header \li Path type \li \macos \li Windows
\row \li DesktopLocation
\li "~/Desktop"
\li "C:/Users/<USER>/Desktop"
@@ -609,7 +609,7 @@ QString QStandardPaths::displayName(StandardLocation type)
On Unix, \c XDG_DATA_HOME is set to \e ~/.qttest/share, \c XDG_CONFIG_HOME is
set to \e ~/.qttest/config, and \c XDG_CACHE_HOME is set to \e ~/.qttest/cache.
- On OS X, data goes to \e ~/.qttest/Application Support, cache goes to
+ On \macos, data goes to \e ~/.qttest/Application Support, cache goes to
\e ~/.qttest/Cache, and config goes to \e ~/.qttest/Preferences.
On Windows, everything goes to a "qttest" directory under Application Data.
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index fff1a29bf3..df76d73eae 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -41,6 +41,7 @@
#define QSTANDARDPATHS_H
#include <QtCore/qstringlist.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -49,6 +50,8 @@ QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QStandardPaths
{
+ Q_GADGET
+
public:
// Do not re-order, must match QDesktopServices
enum StandardLocation {
@@ -73,6 +76,7 @@ public:
AppConfigLocation,
AppLocalDataLocation = DataLocation
};
+ Q_ENUM(StandardLocation)
static QString writableLocation(StandardLocation type);
static QStringList standardLocations(StandardLocation type);
@@ -82,6 +86,7 @@ public:
LocateDirectory = 0x1
};
Q_DECLARE_FLAGS(LocateOptions, LocateOption)
+ Q_FLAG(LocateOptions)
static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
@@ -103,6 +108,8 @@ private:
~QStandardPaths();
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions)
+
#endif // QT_NO_STANDARDPATHS
QT_END_NAMESPACE
diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp
index 6faa197491..3773b72606 100644
--- a/src/corelib/io/qstorageinfo.cpp
+++ b/src/corelib/io/qstorageinfo.cpp
@@ -256,7 +256,7 @@ QByteArray QStorageInfo::fileSystemType() const
/*!
Returns the device for this volume.
- For example, on Unix filesystems (including OS X), this returns the
+ For example, on Unix filesystems (including \macos), this returns the
devpath like \c /dev/sda0 for local storages. On Windows, it returns the UNC
path starting with \c \\\\?\\ for local storages (in other words, the volume GUID).
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 71a0228eeb..42a742213b 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -833,7 +833,7 @@ recodeFromUser(const QString &input, const ushort *actions, int from, int to)
// appendXXXX functions: copy from the internal form to the external, user form.
// the internal value is stored in its PrettyDecoded form, so that case is easy.
-static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+static inline void appendToUser(QString &appendTo, const QStringRef &value, QUrl::FormattingOptions options,
const ushort *actions)
{
if (options == QUrl::PrettyDecoded) {
@@ -841,10 +841,17 @@ static inline void appendToUser(QString &appendTo, const QString &value, QUrl::F
return;
}
- if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))
+ if (!qt_urlRecode(appendTo, value.data(), value.end(), options, actions))
appendTo += value;
}
+static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+ const ushort *actions)
+{
+ appendToUser(appendTo, QStringRef(&value), options, actions);
+}
+
+
inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
@@ -924,21 +931,22 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o
if (options & QUrl::NormalizePathSegments) {
thePath = qt_normalizePathSegments(path, false);
}
+
+ QStringRef thePathRef(&thePath);
if (options & QUrl::RemoveFilename) {
const int slash = path.lastIndexOf(QLatin1Char('/'));
if (slash == -1)
return;
- thePath = path.left(slash+1);
+ thePathRef = path.leftRef(slash + 1);
}
// check if we need to remove trailing slashes
if (options & QUrl::StripTrailingSlash) {
- while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/')))
- thePath.chop(1);
+ while (thePathRef.length() > 1 && thePathRef.endsWith(QLatin1Char('/')))
+ thePathRef.chop(1);
}
- appendToUser(appendTo, thePath, options,
+ appendToUser(appendTo, thePathRef, options,
appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? pathInUrl : pathInIsolation);
-
}
inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
@@ -3169,8 +3177,8 @@ QUrl QUrl::resolved(const QUrl &relative) const
if (!relative.d) return *this;
QUrl t;
- // be non strict and allow scheme in relative url
- if (!relative.d->scheme.isEmpty() && relative.d->scheme != d->scheme) {
+ // Compatibility hack (mostly for qtdeclarative) : treat "file:relative.txt" as relative even though QUrl::isRelative() says false
+ if (!relative.d->scheme.isEmpty() && (!relative.isLocalFile() || QDir::isAbsolutePath(relative.d->path))) {
t = relative;
t.detach();
} else {
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 54ea45782d..7fdf107383 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -364,7 +364,7 @@ quintptr QPersistentModelIndex::internalId() const
Returns the parent QModelIndex for this persistent index, or an invalid
QModelIndex if it has no parent.
- \sa child(), sibling(), model()
+ \sa sibling(), model()
*/
QModelIndex QPersistentModelIndex::parent() const
{
@@ -377,7 +377,7 @@ QModelIndex QPersistentModelIndex::parent() const
Returns the sibling at \a row and \a column or an invalid QModelIndex if
there is no sibling at this position.
- \sa parent(), child()
+ \sa parent()
*/
QModelIndex QPersistentModelIndex::sibling(int row, int column) const
@@ -387,7 +387,12 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const
return QModelIndex();
}
+#if QT_DEPRECATED_SINCE(5, 8)
/*!
+ \obsolete
+
+ Use QAbstractItemModel::index() instead.
+
Returns the child of the model index that is stored in the given \a row
and \a column.
@@ -397,9 +402,10 @@ QModelIndex QPersistentModelIndex::sibling(int row, int column) const
QModelIndex QPersistentModelIndex::child(int row, int column) const
{
if (d)
- return d->index.child(row, column);
+ return d->index.model()->index(row, column, d->index);
return QModelIndex();
}
+#endif
/*!
Returns the data for the given \a role for the item referred to by the
@@ -1099,12 +1105,16 @@ void QAbstractItemModel::resetInternalData()
Returns the sibling at \a row and \a column. If there is no sibling at this
position, an invalid QModelIndex is returned.
- \sa parent(), child()
+ \sa parent()
*/
/*!
\fn QModelIndex QModelIndex::child(int row, int column) const
+ \obsolete
+
+ Use QAbstractItemModel::index() instead.
+
Returns the child of the model index that is stored in the given \a row and
\a column.
@@ -1153,7 +1163,7 @@ void QAbstractItemModel::resetInternalData()
Returns the parent of the model index, or QModelIndex() if it has no
parent.
- \sa child(), sibling(), model()
+ \sa sibling(), model()
*/
/*!
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index 0820626452..907ba09676 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -63,7 +63,9 @@ public:
inline void *internalPointer() const Q_DECL_NOTHROW { return reinterpret_cast<void*>(i); }
inline QModelIndex parent() const;
inline QModelIndex sibling(int row, int column) const;
- inline QModelIndex child(int row, int column) const;
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED_X("Use QAbstractItemModel::index") inline QModelIndex child(int row, int column) const;
+#endif
inline QVariant data(int role = Qt::DisplayRole) const;
inline Qt::ItemFlags flags() const;
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; }
@@ -128,7 +130,9 @@ public:
quintptr internalId() const;
QModelIndex parent() const;
QModelIndex sibling(int row, int column) const;
- QModelIndex child(int row, int column) const;
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED_X("Use QAbstractItemModel::index") QModelIndex child(int row, int column) const;
+#endif
QVariant data(int role = Qt::DisplayRole) const;
Qt::ItemFlags flags() const;
const QAbstractItemModel *model() const;
@@ -419,8 +423,10 @@ inline QModelIndex QModelIndex::parent() const
inline QModelIndex QModelIndex::sibling(int arow, int acolumn) const
{ return m ? (r == arow && c == acolumn) ? *this : m->sibling(arow, acolumn, *this) : QModelIndex(); }
+#if QT_DEPRECATED_SINCE(5, 8)
inline QModelIndex QModelIndex::child(int arow, int acolumn) const
{ return m ? m->index(arow, acolumn, *this) : QModelIndex(); }
+#endif
inline QVariant QModelIndex::data(int arole) const
{ return m ? m->data(*this, arole) : QVariant(); }
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 2b684b855b..b0ddfa879d 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -1328,6 +1328,7 @@ void QSortFilterProxyModelPrivate::_q_sourceReset()
void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_Q(QSortFilterProxyModel);
+ Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
saved_persistent_indexes.clear();
QList<QPersistentModelIndex> parents;
@@ -1346,7 +1347,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
if (!sourceParents.isEmpty() && parents.isEmpty())
return;
- emit q->layoutAboutToBeChanged(parents, hint);
+ emit q->layoutAboutToBeChanged(parents);
if (persistent.indexes.isEmpty())
return;
@@ -1356,6 +1357,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_Q(QSortFilterProxyModel);
+ Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
// Optimize: We only actually have to clear the mapping related to the contents of
// sourceParents, not everything.
@@ -1385,7 +1387,7 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
if (!sourceParents.isEmpty() && parents.isEmpty())
return;
- emit q->layoutChanged(parents, hint);
+ emit q->layoutChanged(parents);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp
index f70c318ff7..0f7472aa5a 100644
--- a/src/corelib/itemmodels/qstringlistmodel.cpp
+++ b/src/corelib/itemmodels/qstringlistmodel.cpp
@@ -187,7 +187,13 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value,
if (index.row() >= 0 && index.row() < lst.size()
&& (role == Qt::EditRole || role == Qt::DisplayRole)) {
lst.replace(index.row(), value.toString());
- emit dataChanged(index, index, QVector<int>(1, role));
+ QVector<int> roles;
+ roles.reserve(2);
+ roles.append(Qt::DisplayRole);
+ roles.append(Qt::EditRole);
+ emit dataChanged(index, index, roles);
+ // once Q_COMPILER_UNIFORM_INIT can be used, change to:
+ // emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
return true;
}
return false;
@@ -307,9 +313,9 @@ QStringList QStringListModel::stringList() const
*/
void QStringListModel::setStringList(const QStringList &strings)
{
- emit beginResetModel();
+ beginResetModel();
lst = strings;
- emit endResetModel();
+ endResetModel();
}
/*!
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 39fe61ea4e..a78397e46c 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -4,6 +4,8 @@ HEADERS += \
kernel/qabstracteventdispatcher.h \
kernel/qabstractnativeeventfilter.h \
kernel/qbasictimer.h \
+ kernel/qdeadlinetimer.h \
+ kernel/qdeadlinetimer_p.h \
kernel/qelapsedtimer.h \
kernel/qeventloop.h\
kernel/qpointer.h \
@@ -46,6 +48,7 @@ SOURCES += \
kernel/qabstracteventdispatcher.cpp \
kernel/qabstractnativeeventfilter.cpp \
kernel/qbasictimer.cpp \
+ kernel/qdeadlinetimer.cpp \
kernel/qelapsedtimer.cpp \
kernel/qeventloop.cpp \
kernel/qcoreapplication.cpp \
@@ -120,6 +123,11 @@ mac {
# We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit
}
+
+ watchos {
+ # We need WatchKit for WKExtension in qeventdispatcher_cf.mm
+ LIBS_PRIVATE += -framework WatchKit
+ }
}
nacl {
@@ -144,21 +152,20 @@ unix|integrity {
kernel/qpoll_p.h \
kernel/qtimerinfo_unix_p.h
- contains(QT_CONFIG, poll_select): SOURCES += kernel/qpoll.cpp
- contains(QT_CONFIG, poll_poll): DEFINES += QT_HAVE_POLL
- contains(QT_CONFIG, poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL
- contains(QT_CONFIG, poll_pollts): DEFINES += QT_HAVE_POLL QT_HAVE_POLLTS
+ qtConfig(poll_select): SOURCES += kernel/qpoll.cpp
+ qtConfig(poll_poll): DEFINES += QT_HAVE_POLL
+ qtConfig(poll_ppoll): DEFINES += QT_HAVE_POLL QT_HAVE_PPOLL
+ qtConfig(poll_pollts): DEFINES += QT_HAVE_POLL QT_HAVE_POLLTS
- contains(QT_CONFIG, glib) {
+ qtConfig(glib) {
SOURCES += \
kernel/qeventdispatcher_glib.cpp
HEADERS += \
kernel/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QMAKE_LIBS_GLIB
+ QMAKE_USE_PRIVATE += glib
}
- contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
+ qtConfig(clock-gettime): include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
!android {
SOURCES += kernel/qsharedmemory_posix.cpp \
@@ -181,7 +188,7 @@ vxworks {
}
qqnx_pps {
- LIBS_PRIVATE += -lpps
+ QMAKE_USE_PRIVATE += pps
SOURCES += \
kernel/qppsattribute.cpp \
kernel/qppsobject.cpp
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index 068b6b0440..ee1a290386 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -101,7 +101,7 @@ QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TY
QAppleOperatingSystemVersion qt_apple_os_version()
{
QAppleOperatingSystemVersion v = {0, 0, 0};
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS)
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS) || defined(Q_OS_WATCHOS)
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion;
v.major = osv.majorVersion;
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index c393609188..b5756af994 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -299,7 +299,7 @@ static inline int qt_safe_close(int fd)
#undef QT_CLOSE
#define QT_CLOSE qt_safe_close
-// - VxWorks & iOS/tvOS don't have processes
+// - VxWorks & iOS/tvOS/watchOS don't have processes
#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 72645b4d9b..0413e06665 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -72,7 +72,7 @@
#ifndef QT_NO_QOBJECT
#if defined(Q_OS_UNIX)
-# if defined(Q_OS_OSX)
+# if defined(Q_OS_DARWIN)
# include "qeventdispatcher_cf_p.h"
# else
# if !defined(QT_NO_GLIB)
@@ -483,7 +483,7 @@ void QCoreApplicationPrivate::createEventDispatcher()
{
Q_Q(QCoreApplication);
#if defined(Q_OS_UNIX)
-# if defined(Q_OS_OSX)
+# if defined(Q_OS_DARWIN)
bool ok = false;
int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
if (ok && value > 0)
@@ -687,7 +687,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p)
If you are doing graphical changes inside a loop that does not
return to the event loop on asynchronous window systems like X11
- or double buffered window systems like Quartz (OS X and iOS), and you want to
+ or double buffered window systems like Quartz (\macos and iOS), and you want to
visualize these changes immediately (e.g. Splash Screens), call
this function.
@@ -2059,7 +2059,7 @@ void QCoreApplicationPrivate::setApplicationFilePath(const QString &path)
directory, and you run the \c{regexp} example, this function will
return "C:/Qt/examples/tools/regexp".
- On OS X and iOS this will point to the directory actually containing
+ On \macos and iOS this will point to the directory actually containing
the executable, which may be inside an application bundle (if the
application is bundled).
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 00c120093f..e3d0185004 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -174,7 +174,7 @@ QT_BEGIN_NAMESPACE
\value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area.
\value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area.
\value NonClientAreaMouseMove A mouse move occurred outside the client area.
- \value MacSizeChange The user changed his widget sizes (OS X only).
+ \value MacSizeChange The user changed his widget sizes (\macos only).
\value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod().
\value ModifiedChange Widgets modification state has been changed.
\value MouseButtonDblClick Mouse press again (QMouseEvent).
@@ -219,7 +219,7 @@ QT_BEGIN_NAMESPACE
\omitvalue ThemeChange
\value ThreadChange The object is moved to another thread. This is the last event sent to this object in the previous thread. See QObject::moveToThread().
\value Timer Regular timer events (QTimerEvent).
- \value ToolBarChange The toolbar button is toggled on OS X.
+ \value ToolBarChange The toolbar button is toggled on \macos.
\value ToolTip A tooltip was requested (QHelpEvent).
\value ToolTipChange The widget's tooltip has changed.
\value TouchBegin Beginning of a sequence of touch-screen or track-pad events (QTouchEvent).
diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp
new file mode 100644
index 0000000000..7906b29ece
--- /dev/null
+++ b/src/corelib/kernel/qdeadlinetimer.cpp
@@ -0,0 +1,827 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
+#include <qpair.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECL_CONST_FUNCTION static inline QPair<qint64, qint64> toSecsAndNSecs(qint64 nsecs)
+{
+ qint64 secs = nsecs / (1000*1000*1000);
+ if (nsecs < 0)
+ --secs;
+ nsecs -= secs * 1000*1000*1000;
+ return qMakePair(secs, nsecs);
+}
+
+/*!
+ \class QDeadlineTimer
+ \inmodule QtCore
+ \brief The QDeadlineTimer class marks a deadline in the future.
+ \since 5.8
+
+ \reentrant
+ \ingroup tools
+
+ The QDeadlineTimer class is usually used to calculate future deadlines and
+ verify whether the deadline has expired. QDeadlineTimer can also be used
+ for deadlines without expiration ("forever"). It forms a counterpart to
+ QElapsedTimer, which calculates how much time has elapsed since
+ QElapsedTimer::start() was called.
+
+ QDeadlineTimer provides a more convenient API compared to
+ QElapsedTimer::hasExpired().
+
+ The typical use-case for the class is to create a QDeadlineTimer before the
+ operation in question is started, and then use remainingTime() or
+ hasExpired() to determine whether to continue trying the operation.
+ QDeadlineTimer objects can be passed to functions being called to execute
+ this operation so they know how long to still operate.
+
+ \code
+ void executeOperation(int msecs)
+ {
+ QDeadlineTimer deadline(msecs);
+ do {
+ if (readFromDevice(deadline.remainingTime())
+ break;
+ waitForReadyRead(deadline);
+ } while (!deadline.hasExpired());
+ }
+ \endcode
+
+ Many QDeadlineTimer functions deal with time out values, which all are
+ measured in milliseconds. There are two special values, the same as many
+ other Qt functions named \c{waitFor} or similar:
+
+ \list
+ \o 0: no time left, expired
+ \o -1: infinite time left, timer never expires
+ \endlist
+
+ \section1 Reference Clocks
+
+ QDeadlineTimer will use the same clock as QElapsedTimer (see
+ QElapsedTimer::clockType() and QElapsedTimer::isMonotonic()).
+
+ \section1 Timer types
+
+ Like QTimer, QDeadlineTimer can select among different levels of coarseness
+ on the timers. You can select precise timing by passing Qt::PreciseTimer to
+ the functions that set of change the timer, or you can select coarse timing
+ by passing Qt::CoarseTimer. Qt::VeryCoarseTimer is currently interpreted
+ the same way as Qt::CoarseTimer.
+
+ This feature is dependent on support from the operating system: if the OS
+ does not support a coarse timer functionality, then QDeadlineTimer will
+ behave like Qt::PreciseTimer was passed.
+
+ QDeadlineTimer defaults to Qt::CoarseTimer because on operating systems
+ that do support coarse timing, making timing calls to that clock source is
+ often much more efficient. The level of coarseness depends on the
+ operating system, but should be in the order of a couple of milliseconds.
+
+ \section1 \c{std::chrono} Compatibility
+
+ QDeadlineTimer is compatible with the \c{std::chrono} API from C++11 and
+ can be constructed from or compared to both \c{std::chrono::duration} and
+ \c{std::chrono::time_point} objects. In addition, it is fully compatible
+ with the time literals from C++14, which allow one to write code as:
+
+ \code
+ using namespace std::chrono;
+
+ QDeadlineTimer deadline(30s);
+ device->waitForReadyRead(deadline);
+ if (deadline.remainingTime<nanoseconds>() > 300ms)
+ cleanup();
+ \endcode
+
+ As can be seen in the example above, QDeadlineTimer offers a templated
+ version of remainingTime() and deadline() that can be used to return
+ \c{std::chrono} objects.
+
+ Note that comparing to \c{time_point} is not as efficient as comparing to
+ \c{duration}, since QDeadlineTimer may need to convert from its own
+ internal clock source to the clock source used by the \c{time_point} object.
+ Also note that, due to this conversion, the deadlines will not be precise,
+ so the following code is not expected to compare equally:
+
+ \code
+ using namespace std::chrono;
+ auto now = steady_clock::now();
+ QDeadlineTimer deadline(now + 1s);
+ Q_ASSERT(deadline == now + 1s);
+ \endcode
+
+ \sa QTime, QTimer, QDeadlineTimer, Qt::TimerType
+*/
+
+/*!
+ \enum QDeadlineTimer::ForeverConstant
+
+ \value Forever Used when creating a QDeadlineTimer to indicate the
+ deadline should not expire
+*/
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(Qt::TimerType timerType)
+
+ Constructs an expired QDeadlineTimer object. For this object,
+ remainingTime() will return 0.
+
+ The timer type \a timerType may be ignored, since the timer is already
+ expired. Similarly, for optimization purposes, this function will not
+ attempt to obtain the current time and will use a value known to be in the
+ past. Therefore, deadline() may return an unexpected value and this object
+ cannot be used in calculation of how long it is overdue. If that
+ functionality is required, use QDeadlineTimer::current().
+
+ \sa hasExpired(), remainingTime(), timerType(), current()
+*/
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(ForeverConstant, Qt::TimerType timerType)
+
+ Constructs a QDeadlineTimer object that never expires. For this object,
+ remainingTime() will return -1, deadline() will return the maximum value,
+ and isForever() will return true.
+
+ The timer type \a timerType may be ignored, since the timer is already
+ expired.
+
+ \sa hasExpired(), isForever(), remainingTime(), timerType()
+*/
+
+/*!
+ Constructs a QDeadlineTimer object with an expiry time of \a msecs msecs
+ from the moment of the creation of this object, if msecs is positive. If \a
+ msecs is zero, this QDeadlineTimer will be marked as expired, causing
+ remainingTime() to return zero and deadline() to return an indeterminate
+ time point in the past. If \a msecs is -1, the timer will be set it to
+ never expire, causing remainingTime() to return -1 and deadline() to return
+ the maximum value.
+
+ The QDeadlineTimer object will be constructed with a timer type of \a
+ timerType.
+
+ For optimization purposes, if \a msecs is zero, this function may skip
+ obtaining the current time and may instead use a value known to be in the
+ past. If that happens, deadline() may return an unexpected value and this
+ object cannot be used in calculation of how long it is overdue. If that
+ functionality is required, use QDeadlineTimer::current() and add time to
+ it.
+
+ \sa hasExpired(), isForever(), remainingTime(), setRemainingTime()
+*/
+QDeadlineTimer::QDeadlineTimer(qint64 msecs, Qt::TimerType type) Q_DECL_NOTHROW
+ : t2(0)
+{
+ setRemainingTime(msecs, type);
+}
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(std::chrono::time_point<Clock, Duration> deadline, Qt::TimerType type)
+
+ Constructs a QDeadlineTimer object with a deadline at \a deadline time
+ point, converting from the clock source \c{Clock} to Qt's internal clock
+ source (see QElapsedTimer::clcokType()).
+
+ If \a deadline is in the past, this QDeadlineTimer object is set to
+ expired, whereas if \a deadline is equal to \c{Duration::max()}, then this
+ object is set to never expire.
+
+ The QDeadlineTimer object will be constructed with a timer type of \a
+ timerType.
+
+ \sa hasExpired(), isForever(), remainingTime<Duration>(), setDeadline()
+*/
+
+/*!
+ \fn QDeadlineTimer::QDeadlineTimer(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type)
+
+ Constructs a QDeadlineTimer object with a remaining time of \a remaining.
+ If \a remaining is zero or negative, this QDeadlineTimer object will be
+ mark as expired, whereas if \a remaining is equal to \c{duration::max()},
+ the object will be set to never expire.
+
+ The QDeadlineTimer object will be constructed with a timer type of \a
+ timerType.
+
+ This constructor can be used with C++14's user-defined literals for time, such as in:
+
+ \code
+ using namespace std::chrono;
+ QDeadlineTimer deadline(250ms);
+ \endcode
+
+ For optimization purposes, if \a remaining is zero or negative, this
+ function may skip obtaining the current time and may instead use a value
+ known to be in the past. If that happens, deadline() may return an
+ unexpected value and this object cannot be used in calculation of how long
+ it is overdue. If that functionality is required, use
+ QDeadlineTimer::current() and add time to it.
+
+ \sa hasExpired(), isForever(), remainingTime<Duration>(), setRemainingTime()
+*/
+
+/*!
+ \fn void QDeadlineTimer::setDeadline(std::chrono::time_point<Clock, Duration> deadline, Qt::TimerType type)
+
+ Sets this QDeadlineTimer to the deadline marked by \a deadline time
+ point, converting from the clock source \c{Clock} to Qt's internal clock
+ source (see QElapsedTimer::clcokType()).
+
+ If \a deadline is in the past, this QDeadlineTimer object is set to
+ expired, whereas if \a deadline is equal to \c{Duration::max()}, then this
+ object is set to never expire.
+
+ The timer type for this QDeadlineTimer object will be set to \a timerType type.
+
+ \sa hasExpired(), isForever(), remainingTime<Duration>(),
+*/
+
+/*!
+ Sets the remaining time for this QDeadlineTimer object to \a msecs
+ milliseconds from now, if \a msecs has a positive value. If \a msecs is
+ zero, this QDeadlineTimer object will be marked as expired, whereas a value
+ of -1 will set it to never expire.
+
+ The timer type for this QDeadlineTimer object will be set to \a timerType type.
+
+ \sa setPreciseRemainingTime(), hasExpired(), isForever(), remainingTime()
+*/
+void QDeadlineTimer::setRemainingTime(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ if (msecs == -1)
+ *this = QDeadlineTimer(Forever, timerType);
+ else
+ setPreciseRemainingTime(0, msecs * 1000 * 1000, timerType);
+}
+
+/*!
+ Sets the remaining time for this QDeadlineTimer object to \a secs seconds
+ plus \a nsecs nanoseconds from now, if \a secs has a positive value. If \a
+ secs is -1, this QDeadlineTimer will be set it to never expire. If both
+ parameters are zero, this QDeadlineTimer will be marked as expired.
+
+ The timer type for this QDeadlineTimer object will be set to \a timerType type.
+
+ \sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
+*/
+void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ if (secs == -1) {
+ *this = QDeadlineTimer(Forever, timerType);
+ return;
+ }
+
+ *this = current(timerType);
+ if (QDeadlineTimerNanosecondsInT2) {
+ t1 += secs + toSecsAndNSecs(nsecs).first;
+ t2 += toSecsAndNSecs(nsecs).second;
+ if (t2 > 1000*1000*1000) {
+ t2 -= 1000*1000*1000;
+ ++t1;
+ }
+ } else {
+ t1 += secs * 1000 * 1000 * 1000 + nsecs;
+ }
+}
+
+/*!
+ \overload
+ \fn void QDeadlineTimer::setRemainingTime(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type)
+
+ Sets the remaining time for this QDeadlineTimer object to \a remaining. If
+ \a remaining is zero or negative, this QDeadlineTimer object will be mark
+ as expired, whereas if \a remaining is equal to \c{duration::max()}, the
+ object will be set to never expire.
+
+ The timer type for this QDeadlineTimer object will be set to \a timerType type.
+
+ This function can be used with C++14's user-defined literals for time, such as in:
+
+ \code
+ using namespace std::chrono;
+ deadline.setRemainingTime(250ms);
+ \endcode
+
+ \sa setDeadline(), remainingTime<Duration>(), hasExpired(), isForever()
+*/
+
+/*!
+ \fn void QDeadlineTimer::setPreciseRemainingTime(qint64 secs, unsigned nsecs, Qt::TimerType type)
+
+ Sets the remaining time for this QDeadlineTimer object to \a secs seconds
+ and \a nsecs nanoseconds from now, if \a secs is a positive value. If both
+ values are zero, this QDeadlineTimer object will be marked as expired,
+ whereas if \a secs is -1, it will set it to never expire.
+
+ If value of \a nsecs is more than 1 billion nanoseconds (1 second), this
+ function will adjust \a secs accordingly.
+
+ The timer type for this QDeadlineTimer object will be set to \a timerType type.
+
+ \sa setRemainingTime(), hasExpired(), isForever(), remainingTime()
+*/
+
+/*!
+ \overload
+ \fn Duration QDeadlineTimer::remainingTime() const
+
+ Returns a \c{std::chrono::duration} object of type \c{Duration} containing
+ the remaining time in this QDeadlineTimer, if it still has time left. If
+ the deadline has passed, this returns \c{Duration::zero()}, whereas if the
+ object is set to never expire, it returns \c{Duration::max()} (instead of
+ -1).
+
+ It is not possible to obtain the overdue time for expired timers with this
+ function. To do that, see deadline().
+
+ \note The overload of this function without template parameter always
+ returns milliseconds.
+
+ \sa setRemainingTime(), deadline<Clock, Duration>()
+*/
+
+/*!
+ \overload
+ \fn std::chrono::time_point<Clock, Duration> QDeadlineTimer::deadline() const
+
+ Returns the absolute time point for the deadline stored in QDeadlineTimer
+ object as a \c{std::chrono::time_point} object. The template parameter
+ \c{Clock} is mandatory and indicates which of the C++ timekeeping clocks to
+ use as a reference. The value will be in the past if this QDeadlineTimer
+ has expired.
+
+ If this QDeadlineTimer never expires, this function returns
+ \c{std::chrono::time_point<Clock, Duration>::max()}.
+
+ This function can be used to calculate the amount of time a timer is
+ overdue, by subtracting the current time point of the reference clock, as
+ in the following example:
+
+ \code
+ auto realTimeLeft = std::chrono::nanoseconds::max();
+ auto tp = deadline.deadline<std::chrono::steady_clock>();
+ if (tp != std::chrono::steady_clock::max())
+ realTimeLeft = tp - std::chrono::steady_clock::now();
+ \endcode
+
+ \note Timers that were created as expired have an indetermine time point in
+ the past as their deadline, so the above calculation may not work.
+
+ \sa remainingTime(), deadlineNSecs(), setDeadline()
+*/
+
+/*!
+ Returns true if this QDeadlineTimer object never expires, false otherwise.
+ For timers that never expire, remainingTime() always returns -1 and
+ deadline() returns the maximum value.
+
+ \sa ForeverConstant, hasExpired(), remainingTime()
+*/
+bool QDeadlineTimer::isForever() const Q_DECL_NOTHROW
+{
+ return t1 == (std::numeric_limits<qint64>::max)();
+}
+
+/*!
+ Returns true if this QDeadlineTimer object has expired, false if there
+ remains time left. For objects that have expired, remainingTime() will
+ return zero and deadline() will return a time point in the past.
+
+ QDeadlineTimer objects created with the \ref{ForeverConstant} never expire
+ and this function always returns false for them.
+
+ \sa isForever(), remainingTime()
+*/
+bool QDeadlineTimer::hasExpired() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return false;
+ return *this <= current(timerType());
+}
+
+/*!
+ \fn Qt::TimerType QDeadlineTimer::timerType() const Q_DECL_NOTHROW
+
+ Returns the timer type is active for this object.
+
+ \sa setTimerType()
+*/
+
+/*!
+ Changes the timer type for this object to \a timerType.
+
+ The behavior for each possible value of \a timerType is operating-system
+ dependent. Qt::PreciseTimer will use the most precise timer that Qt can
+ find, with resolution of 1 millisecond or better, whereas QDeadlineTimer
+ will try to use a more coarse timer for Qt::CoarseTimer and
+ Qt::VeryCoarseTimer.
+
+ \sa timerType()
+ */
+void QDeadlineTimer::setTimerType(Qt::TimerType timerType)
+{
+ type = timerType;
+}
+
+/*!
+ Returns the remaining time in this QDeadlineTimer object in milliseconds.
+ If the timer has already expired, this function will return zero and it is
+ not possible to obtain the amount of time overdue with this function (to do
+ that, see deadline()). If the timer was set to never expire, this function
+ returns -1.
+
+ This function is suitable for use in Qt APIs that take a millisecond
+ timeout, such as the many \ref QIODevice \c waitFor functions or the timed
+ lock functions in \ref QMutex, \ref QWaitCondition, \ref QSemaphore, or
+ \ref QReadWriteLock. For example:
+
+ \code
+ mutex.tryLock(deadline.remainingTime());
+ \code
+
+ \sa remainingTimeNSecs(), isForever(), hasExpired()
+*/
+qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW
+{
+ qint64 ns = remainingTimeNSecs();
+ return ns <= 0 ? ns : ns / (1000 * 1000);
+}
+
+/*!
+ Returns the remaining time in this QDeadlineTimer object in nanoseconds. If
+ the timer has already expired, this function will return zero and it is not
+ possible to obtain the amount of time overdue with this function. If the
+ timer was set to never expire, this function returns -1.
+
+ \sa remainingTime(), isForever(), hasExpired()
+*/
+qint64 QDeadlineTimer::remainingTimeNSecs() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return -1;
+ qint64 raw = rawRemainingTimeNSecs();
+ return raw < 0 ? 0 : raw;
+}
+
+/*!
+ \internal
+ Same as remainingTimeNSecs, but may return negative remaining times. Does
+ not deal with Forever.
+*/
+qint64 QDeadlineTimer::rawRemainingTimeNSecs() const Q_DECL_NOTHROW
+{
+ QDeadlineTimer now = current(timerType());
+ if (QDeadlineTimerNanosecondsInT2)
+ return (t1 - now.t1) * (1000*1000*1000) + t2 - now.t2;
+ return t1 - now.t1;
+}
+
+/*!
+ Returns the absolute time point for the deadline stored in QDeadlineTimer
+ object, calculated in milliseconds relative to the reference clock, the
+ same as QElapsedTimer::msecsSinceReference(). The value will be in the past
+ if this QDeadlineTimer has expired.
+
+ If this QDeadlineTimer never expires, this function returns
+ \c{std::numeric_limits<qint64>::max()}.
+
+ This function can be used to calculate the amount of time a timer is
+ overdue, by subtracting QDeadlineTimer::current() or
+ QElapsedTimer::msecsSinceReference(), as in the following example:
+
+ \code
+ qint64 realTimeLeft = deadline.deadline();
+ if (realTimeLeft != (std::numeric_limits<qint64>::max)()) {
+ realTimeLeft -= QDeadlineTimer::current().deadline();
+ // or:
+ //QElapsedTimer timer;
+ //timer.start();
+ //realTimeLeft -= timer.msecsSinceReference();
+ }
+ \endcode
+
+ \note Timers that were created as expired have an indetermine time point in
+ the past as their deadline, so the above calculation may not work.
+
+ \sa remainingTime(), deadlineNSecs(), setDeadline()
+*/
+qint64 QDeadlineTimer::deadline() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return t1;
+ return deadlineNSecs() / (1000 * 1000);
+}
+
+/*!
+ Returns the absolute time point for the deadline stored in QDeadlineTimer
+ object, calculated in nanoseconds relative to the reference clock, the
+ same as QElapsedTimer::msecsSinceReference(). The value will be in the past
+ if this QDeadlineTimer has expired.
+
+ If this QDeadlineTimer never expires, this function returns
+ \c{std::numeric_limits<qint64>::max()}.
+
+ This function can be used to calculate the amount of time a timer is
+ overdue, by subtracting QDeadlineTimer::current(), as in the following
+ example:
+
+ \code
+ qint64 realTimeLeft = deadline.deadlineNSecs();
+ if (realTimeLeft != std::numeric_limits<qint64>::max())
+ realTimeLeft -= QDeadlineTimer::current().deadlineNSecs();
+ \endcode
+
+ \note Timers that were created as expired have an indetermine time point in
+ the past as their deadline, so the above calculation may not work.
+
+ \sa remainingTime(), deadlineNSecs()
+*/
+qint64 QDeadlineTimer::deadlineNSecs() const Q_DECL_NOTHROW
+{
+ if (isForever())
+ return t1;
+ if (QDeadlineTimerNanosecondsInT2)
+ return t1 * 1000 * 1000 * 1000 + t2;
+ return t1;
+}
+
+/*!
+ Sets the deadline for this QDeadlineTimer object to be the \a msecs
+ absolute time point, counted in milliseconds since the reference clock (the
+ same as QElapsedTimer::msecsSinceReference()), and the timer type to \a
+ timerType. If the value is in the past, this QDeadlineTimer will be marked
+ as expired.
+
+ If \a msecs is \c{std::numeric_limits<qint64>::max()}, this QDeadlineTimer
+ will be set to never expire.
+
+ \sa setPreciseDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
+*/
+void QDeadlineTimer::setDeadline(qint64 msecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ if (msecs == (std::numeric_limits<qint64>::max)()) {
+ setPreciseDeadline(msecs, 0, timerType); // msecs == MAX implies Forever
+ } else {
+ setPreciseDeadline(msecs / 1000, msecs % 1000 * 1000 * 1000, timerType);
+ }
+}
+
+/*!
+ Sets the deadline for this QDeadlineTimer object to be \a secs seconds and
+ \a nsecs nanoseconds since the reference clock epoch (the same as
+ QElapsedTimer::msecsSinceReference()), and the timer type to \a timerType.
+ If the value is in the past, this QDeadlineTimer will be marked as expired.
+
+ If \a secs or \a nsecs is \c{std::numeric_limits<qint64>::max()}, this
+ QDeadlineTimer will be set to never expire. If \a nsecs is more than 1
+ billion nanoseconds (1 second), then \a secs will be adjusted accordingly.
+
+ \sa setDeadline(), deadline(), deadlineNSecs(), setRemainingTime()
+*/
+void QDeadlineTimer::setPreciseDeadline(qint64 secs, qint64 nsecs, Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ type = timerType;
+ if (secs == (std::numeric_limits<qint64>::max)() || nsecs == (std::numeric_limits<qint64>::max)()) {
+ *this = QDeadlineTimer(Forever, timerType);
+ } else if (QDeadlineTimerNanosecondsInT2) {
+ t1 = secs + toSecsAndNSecs(nsecs).first;
+ t2 = toSecsAndNSecs(nsecs).second;
+ } else {
+ t1 = secs * (1000*1000*1000) + nsecs;
+ }
+}
+
+/*!
+ Returns a QDeadlineTimer object whose deadline is extended from \a dt's
+ deadline by \a nsecs nanoseconds. If \a dt was set to never expire, this
+ function returns a QDeadlineTimer that will not expire either.
+
+ \note if \a dt was created as expired, its deadline is indeterminate and
+ adding an amount of time may or may not cause it to become unexpired.
+*/
+QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW
+{
+ if (dt.isForever() || nsecs == (std::numeric_limits<qint64>::max)()) {
+ dt = QDeadlineTimer(Forever, dt.timerType());
+ } else if (QDeadlineTimerNanosecondsInT2) {
+ dt.t1 += toSecsAndNSecs(nsecs).first;
+ dt.t2 += toSecsAndNSecs(nsecs).second;
+ if (dt.t2 > 1000*1000*1000) {
+ dt.t2 -= 1000*1000*1000;
+ ++dt.t1;
+ }
+ } else {
+ dt.t1 += nsecs;
+ }
+ return dt;
+}
+
+/*!
+ \fn QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType)
+
+ Returns a QDeadlineTimer that is expired but is guaranteed to contain the
+ current time. Objects created by this function can participate in the
+ calculation of how long a timer is overdue, using the deadline() function.
+
+ The QDeadlineTimer object will be constructed with a timer type of \a
+ timerType.
+*/
+
+/*!
+ \fn qint64 QDeadlineTimer::resolution(Qt::TimerType timerType)
+
+ Returns the resolution in nanoseconds of the system clock that backs timers
+ of type \a timerType, or 0 if the resolution could not be determined.
+
+ The resolution is not a guarantee that applications will get time values
+ with an accuracy down to that level. It is only the minimum change value
+ that can be expected.
+*/
+
+/*!
+ \fn bool operator==(QDeadlineTimer d1, QDeadlineTimer d2)
+ \related QDeadlineTimer
+
+ Returns true if the deadline on \a d1 and the deadline in \a d2 are the
+ same, false otherwise. The timer type used to create the two deadlines is
+ ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() == d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2)
+ \related QDeadlineTimer
+
+ Returns true if the deadline on \a d1 and the deadline in \a d2 are
+ diferent, false otherwise. The timer type used to create the two deadlines
+ is ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() != d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator<(QDeadlineTimer d1, QDeadlineTimer d2)
+ \related QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is earlier than the deadline in \a
+ d2, false otherwise. The timer type used to create the two deadlines is
+ ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() < d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2)
+ \related QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is earlier than or the same as the
+ deadline in \a d2, false otherwise. The timer type used to create the two
+ deadlines is ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() <= d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator>(QDeadlineTimer d1, QDeadlineTimer d2)
+ \related QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is later than the deadline in \a
+ d2, false otherwise. The timer type used to create the two deadlines is
+ ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() > d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2)
+ \related QDeadlineTimer
+
+ Returns true if the deadline on \a d1 is later than or the same as the
+ deadline in \a d2, false otherwise. The timer type used to create the two
+ deadlines is ignored. This function is equivalent to:
+
+ \code
+ return d1.deadlineNSecs() >= d2.deadlineNSecs();
+ \endcode
+
+ \note comparing QDeadlineTimer objects with different timer types is
+ not supported and may result in unpredictable behavior.
+*/
+
+/*!
+ \fn QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
+ \related QDeadlineTimer
+
+ Returns a QDeadlineTimer object whose deadline is \a msecs later than the
+ deadline stored in \a dt. If \a dt is set to never expire, this function
+ returns a QDeadlineTimer that does not expire either.
+
+ To add times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt)
+ \related QDeadlineTimer
+
+ Returns a QDeadlineTimer object whose deadline is \a msecs later than the
+ deadline stored in \a dt. If \a dt is set to never expire, this function
+ returns a QDeadlineTimer that does not expire either.
+
+ To add times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs)
+ \related QDeadlineTimer
+
+ Returns a QDeadlineTimer object whose deadline is \a msecs before the
+ deadline stored in \a dt. If \a dt is set to never expire, this function
+ returns a QDeadlineTimer that does not expire either.
+
+ To subtract times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer &QDeadlineTimer::operator+=(qint64 msecs)
+
+ Extends this QDeadlineTimer object by \a msecs milliseconds and returns
+ itself. If this object is set to never expire, this function does nothing.
+
+ To add times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+/*!
+ \fn QDeadlineTimer &QDeadlineTimer::operator-=(qint64 msecs)
+
+ Shortens this QDeadlineTimer object by \a msecs milliseconds and returns
+ itself. If this object is set to never expire, this function does nothing.
+
+ To subtract times of precision greater than 1 millisecond, use addNSecs().
+*/
+
+// the rest of the functions are in qelapsedtimer_xxx.cpp
+
+QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h
new file mode 100644
index 0000000000..ac8a09ba97
--- /dev/null
+++ b/src/corelib/kernel/qdeadlinetimer.h
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Intel Corporation.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDEADLINETIMER_H
+#define QDEADLINETIMER_H
+
+#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qmetatype.h>
+#include <QtCore/qnamespace.h>
+
+#ifdef max
+// un-pollute the namespace. We need std::numeric_limits::max() and std::chrono::duration::max()
+# undef max
+#endif
+
+#include <limits>
+
+#if QT_HAS_INCLUDE(<chrono>)
+# include <chrono>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class Q_CORE_EXPORT QDeadlineTimer
+{
+public:
+ enum ForeverConstant { Forever };
+
+ Q_DECL_CONSTEXPR QDeadlineTimer(Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
+ : t1(0), t2(0), type(type_) {}
+ Q_DECL_CONSTEXPR QDeadlineTimer(ForeverConstant, Qt::TimerType type_ = Qt::CoarseTimer) Q_DECL_NOTHROW
+ : t1(std::numeric_limits<qint64>::max()), t2(0), type(type_) {}
+ explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ void swap(QDeadlineTimer &other)
+ { qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
+
+ bool isForever() const Q_DECL_NOTHROW;
+ bool hasExpired() const Q_DECL_NOTHROW;
+
+ Qt::TimerType timerType() const Q_DECL_NOTHROW
+ { return Qt::TimerType(type & 0xff); }
+ void setTimerType(Qt::TimerType type);
+
+ qint64 remainingTime() const Q_DECL_NOTHROW;
+ qint64 remainingTimeNSecs() const Q_DECL_NOTHROW;
+ void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+ void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0,
+ Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ qint64 deadline() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
+ qint64 deadlineNSecs() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
+ void setDeadline(qint64 msecs, Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
+ void setPreciseDeadline(qint64 secs, qint64 nsecs = 0,
+ Qt::TimerType type = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
+ static QDeadlineTimer current(Qt::TimerType timerType = Qt::CoarseTimer) Q_DECL_NOTHROW;
+
+ friend bool operator==(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d1.t1 == d2.t1 && d1.t2 == d2.t2; }
+ friend bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return !(d1 == d2); }
+ friend bool operator<(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d1.t1 < d2.t1 || (d1.t1 == d2.t1 && d1.t2 < d2.t2); }
+ friend bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d1 == d2 || d1 < d2; }
+ friend bool operator>(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return d2 < d1; }
+ friend bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2)
+ { return !(d1 < d2); }
+
+ friend QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
+ { return QDeadlineTimer::addNSecs(dt, msecs * 1000 * 1000); }
+ friend QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt)
+ { return dt + msecs; }
+ friend QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs)
+ { return dt + (-msecs); }
+ friend qint64 operator-(QDeadlineTimer dt1, QDeadlineTimer dt2)
+ { return (dt1.deadlineNSecs() - dt2.deadlineNSecs()) / (1000 * 1000); }
+ QDeadlineTimer &operator+=(qint64 msecs)
+ { *this = *this + msecs; return *this; }
+ QDeadlineTimer &operator-=(qint64 msecs)
+ { *this = *this + (-msecs); return *this; }
+
+#if QT_HAS_INCLUDE(<chrono>) || defined(Q_QDOC)
+ template <class Clock, class Duration>
+ QDeadlineTimer(std::chrono::time_point<Clock, Duration> deadline_,
+ Qt::TimerType type_ = Qt::CoarseTimer) : t2(0)
+ { setDeadline(deadline_, type_); }
+ template <class Clock, class Duration>
+ QDeadlineTimer &operator=(std::chrono::time_point<Clock, Duration> deadline_)
+ { setDeadline(deadline_); return *this; }
+
+ template <class Clock, class Duration>
+ void setDeadline(std::chrono::time_point<Clock, Duration> deadline_,
+ Qt::TimerType type_ = Qt::CoarseTimer)
+ { setRemainingTime(deadline_ == deadline_.max() ? Duration::max() : deadline_ - Clock::now(), type_); }
+
+ template <class Clock, class Duration = typename Clock::duration>
+ std::chrono::time_point<Clock, Duration> deadline() const
+ {
+ auto val = std::chrono::nanoseconds(rawRemainingTimeNSecs()) + Clock::now();
+ return std::chrono::time_point_cast<Duration>(val);
+ }
+
+ template <class Rep, class Period>
+ QDeadlineTimer(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type_ = Qt::CoarseTimer)
+ : t2(0)
+ { setRemainingTime(remaining, type_); }
+
+ template <class Rep, class Period>
+ QDeadlineTimer &operator=(std::chrono::duration<Rep, Period> remaining)
+ { setRemainingTime(remaining); return *this; }
+
+ template <class Rep, class Period>
+ void setRemainingTime(std::chrono::duration<Rep, Period> remaining, Qt::TimerType type_ = Qt::CoarseTimer)
+ {
+ if (remaining == remaining.max())
+ *this = QDeadlineTimer(Forever, type_);
+ else
+ setPreciseRemainingTime(0, std::chrono::nanoseconds(remaining).count(), type_);
+ }
+
+ std::chrono::nanoseconds remainingTimeAsDuration() const Q_DECL_NOTHROW
+ {
+ if (isForever())
+ return std::chrono::nanoseconds::max();
+ qint64 nsecs = rawRemainingTimeNSecs();
+ if (nsecs <= 0)
+ return std::chrono::nanoseconds::zero();
+ return std::chrono::nanoseconds(nsecs);
+ }
+
+ template <class Rep, class Period>
+ friend QDeadlineTimer operator+(QDeadlineTimer dt, std::chrono::duration<Rep, Period> value)
+ { return QDeadlineTimer::addNSecs(dt, std::chrono::duration_cast<std::chrono::nanoseconds>(value).count()); }
+ template <class Rep, class Period>
+ friend QDeadlineTimer operator+(std::chrono::duration<Rep, Period> value, QDeadlineTimer dt)
+ { return dt + value; }
+ template <class Rep, class Period>
+ friend QDeadlineTimer operator+=(QDeadlineTimer &dt, std::chrono::duration<Rep, Period> value)
+ { return dt = dt + value; }
+#endif
+
+private:
+ qint64 t1;
+ unsigned t2;
+ unsigned type;
+
+ qint64 rawRemainingTimeNSecs() const Q_DECL_NOTHROW;
+};
+
+Q_DECLARE_SHARED(QDeadlineTimer)
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QDeadlineTimer)
+
+#endif // QDEADLINETIMER_H
diff --git a/src/corelib/kernel/qdeadlinetimer_p.h b/src/corelib/kernel/qdeadlinetimer_p.h
new file mode 100644
index 0000000000..46e12de6c1
--- /dev/null
+++ b/src/corelib/kernel/qdeadlinetimer_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QDEADLINETIMER_P_H
+#define QDEADLINETIMER_P_H
+
+//
+// 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.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+enum {
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
+ // t1 contains seconds and t2 contains nanoseconds
+ QDeadlineTimerNanosecondsInT2 = 1
+#else
+ // t1 contains nanoseconds, t2 is always zero
+ QDeadlineTimerNanosecondsInT2 = 0
+#endif
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp
index 2eabb4c3a3..5e9d1317ac 100644
--- a/src/corelib/kernel/qelapsedtimer.cpp
+++ b/src/corelib/kernel/qelapsedtimer.cpp
@@ -83,6 +83,9 @@ QT_BEGIN_NAMESPACE
\snippet qelapsedtimer/main.cpp 2
+ It is often more convenient to use \ref{QDeadlineTimer} in this case, which
+ counts towards a timeout in the future instead of tracking elapsed time.
+
\section1 Reference Clocks
QElapsedTimer will use the platform's monotonic reference clock in all
@@ -120,7 +123,7 @@ QT_BEGIN_NAMESPACE
The information on which clocks types may overflow and how to remedy that
issue is documented along with the clock types.
- \sa QTime, QTimer
+ \sa QTime, QTimer, QDeadlineTimer
*/
/*!
@@ -137,7 +140,7 @@ QT_BEGIN_NAMESPACE
\value SystemTime The human-readable system time. This clock is not monotonic.
\value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow.
\value TickCounter The system's tick counter, used on Windows systems. This clock may overflow.
- \value MachAbsoluteTime The Mach kernel's absolute time (OS X and iOS). This clock is monotonic and does not overflow.
+ \value MachAbsoluteTime The Mach kernel's absolute time (\macos and iOS). This clock is monotonic and does not overflow.
\value PerformanceCounter The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow.
\section2 SystemTime
@@ -179,8 +182,8 @@ QT_BEGIN_NAMESPACE
\section2 MachAbsoluteTime
This clock type is based on the absolute time presented by Mach kernels,
- such as that found on OS X. This clock type is presented separately
- from MonotonicClock since OS X and iOS are also Unix systems and may support
+ such as that found on \macos. This clock type is presented separately
+ from MonotonicClock since \macos and iOS are also Unix systems and may support
a POSIX monotonic clock with values differing from the Mach absolute
time.
@@ -255,7 +258,7 @@ bool QElapsedTimer::isValid() const Q_DECL_NOTHROW
The value of \a timeout can be -1 to indicate that this timer does not
expire, in which case this function will always return false.
- \sa elapsed()
+ \sa elapsed(), QDeadlineTimer
*/
bool QElapsedTimer::hasExpired(qint64 timeout) const Q_DECL_NOTHROW
{
diff --git a/src/corelib/kernel/qelapsedtimer_generic.cpp b/src/corelib/kernel/qelapsedtimer_generic.cpp
index 8c724247be..fdeb385188 100644
--- a/src/corelib/kernel/qelapsedtimer_generic.cpp
+++ b/src/corelib/kernel/qelapsedtimer_generic.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
#include "qdatetime.h"
QT_BEGIN_NAMESPACE
@@ -145,7 +146,7 @@ qint64 QElapsedTimer::elapsed() const Q_DECL_NOTHROW
number of milliseconds since January 1st, 1970 at 0:00 UTC (that is, it
is the Unix time expressed in milliseconds).
- On Linux, Windows and OS X/iOS systems, this value is usually the time
+ On Linux, Windows and Apple platforms, this value is usually the time
since the system boot, though it usually does not include the time the
system has spent in sleep states.
@@ -201,4 +202,12 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return v1.t1 < v2.t1;
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ QDeadlineTimer result;
+ result.t1 = QDateTime::currentMSecsSinceEpoch() * 1000 * 1000;
+ result.type = timerType;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qelapsedtimer_mac.cpp b/src/corelib/kernel/qelapsedtimer_mac.cpp
index 886e0f41b2..7490693991 100644
--- a/src/corelib/kernel/qelapsedtimer_mac.cpp
+++ b/src/corelib/kernel/qelapsedtimer_mac.cpp
@@ -41,6 +41,8 @@
#define _POSIX_C_SOURCE 200809L
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
@@ -50,6 +52,12 @@
QT_BEGIN_NAMESPACE
+#ifdef __LP64__
+typedef __int128_t LargeInt;
+#else
+typedef qint64 LargeInt;
+#endif
+
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
{
return MachAbsoluteTime;
@@ -65,13 +73,13 @@ static qint64 absoluteToNSecs(qint64 cpuTime)
{
if (info.denom == 0)
mach_timebase_info(&info);
-#ifdef __LP64__
- __uint128_t nsecs = static_cast<__uint128_t>(cpuTime) * info.numer / info.denom;
- return static_cast<qint64>(nsecs);
-#else
- qint64 nsecs = cpuTime * info.numer / info.denom;
+
+ // don't do multiplication & division if those are equal
+ // (mathematically it would be the same, but it's computationally expensive)
+ if (info.numer == info.denom)
+ return cpuTime;
+ qint64 nsecs = LargeInt(cpuTime) * info.numer / info.denom;
return nsecs;
-#endif
}
static qint64 absoluteToMSecs(qint64 cpuTime)
@@ -146,4 +154,13 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return v1.t1 < v2.t1;
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
+ QDeadlineTimer result;
+ result.type = timerType;
+ result.t1 = absoluteToNSecs(mach_absolute_time());
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qelapsedtimer_unix.cpp b/src/corelib/kernel/qelapsedtimer_unix.cpp
index e2c3ae6280..e166d4e3d2 100644
--- a/src/corelib/kernel/qelapsedtimer_unix.cpp
+++ b/src/corelib/kernel/qelapsedtimer_unix.cpp
@@ -39,6 +39,8 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
#if defined(Q_OS_VXWORKS)
#include "qfunctions_vxworks.h"
#else
@@ -248,4 +250,16 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2);
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ Q_STATIC_ASSERT(QDeadlineTimerNanosecondsInT2);
+ QDeadlineTimer result;
+ qint64 cursec, curnsec;
+ do_gettime(&cursec, &curnsec);
+ result.t1 = cursec;
+ result.t2 = curnsec;
+ result.type = timerType;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qelapsedtimer_win.cpp b/src/corelib/kernel/qelapsedtimer_win.cpp
index 520126d262..0c380b2f6a 100644
--- a/src/corelib/kernel/qelapsedtimer_win.cpp
+++ b/src/corelib/kernel/qelapsedtimer_win.cpp
@@ -38,6 +38,8 @@
****************************************************************************/
#include "qelapsedtimer.h"
+#include "qdeadlinetimer.h"
+#include "qdeadlinetimer_p.h"
#include <qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -76,6 +78,17 @@ static inline qint64 ticksToNanoseconds(qint64 ticks)
}
}
+static inline qint64 nanosecondsToTicks(qint64 nsec)
+{
+ if (counterFrequency > 0) {
+ // QueryPerformanceCounter uses an arbitrary frequency
+ return double(nsec) * counterFrequency / 1000000000.;
+ } else {
+ // GetTickCount(64) uses milliseconds
+ return nsec / 1000000;
+ }
+}
+
static quint64 getTickCount()
{
resolveCounterFrequency();
@@ -161,4 +174,13 @@ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) Q_DECL_NOTHROW
return (v1.t1 - v2.t1) < 0;
}
+QDeadlineTimer QDeadlineTimer::current(Qt::TimerType timerType) Q_DECL_NOTHROW
+{
+ Q_STATIC_ASSERT(!QDeadlineTimerNanosecondsInT2);
+ QDeadlineTimer result;
+ result.t1 = ticksToNanoseconds(getTickCount());
+ result.type = timerType;
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm
index 437e4062ad..eecc72fd94 100644
--- a/src/corelib/kernel/qeventdispatcher_cf.mm
+++ b/src/corelib/kernel/qeventdispatcher_cf.mm
@@ -51,6 +51,8 @@
#ifdef Q_OS_OSX
# include <AppKit/NSApplication.h>
+#elif defined(Q_OS_WATCHOS)
+# include <WatchKit/WatchKit.h>
#else
# include <UIKit/UIApplication.h>
#endif
@@ -75,6 +77,8 @@ QT_USE_NAMESPACE
name:nil
#ifdef Q_OS_OSX
object:[NSApplication sharedApplication]];
+#elif defined(Q_OS_WATCHOS)
+ object:[WKExtension sharedExtension]];
#else
object:[UIApplication sharedApplication]];
#endif
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 26c3ce2443..e901d8cefa 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4248,7 +4248,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
This macro registers an enum type with the meta-object system.
It must be placed after the enum declaration in a class that has the Q_OBJECT or the
- Q_GADGET macro.
+ Q_GADGET macro. For namespaces use \l Q_ENUM_NS instead.
For example:
@@ -4275,7 +4275,7 @@ QDebug operator<<(QDebug dbg, const QObject *o)
This macro registers a single \l{QFlags}{flags type} with the
meta-object system. It is typically used in a class definition to declare
that values of a given enum can be used as flags and combined using the
- bitwise OR operator.
+ bitwise OR operator. For namespaces use \l Q_FLAG_NS instead.
The macro must be placed after the enum declaration.
@@ -4294,6 +4294,48 @@ QDebug operator<<(QDebug dbg, const QObject *o)
\sa {Qt's Property System}
*/
+/*!
+ \macro Q_ENUM_NS(...)
+ \since 5.8
+
+ This macro registers an enum type with the meta-object system.
+ It must be placed after the enum declaration in a namespace that
+ has the Q_NAMESPACE macro. It is the same as \l Q_ENUM but in a
+ namespace.
+
+ Enumerations that are declared with Q_ENUM_NS have their QMetaEnum
+ registered in the enclosing QMetaObject. You can also use
+ QMetaEnum::fromType() to get the QMetaEnum.
+
+ Registered enumerations are automatically registered also to the Qt meta
+ type system, making them known to QMetaType without the need to use
+ Q_DECLARE_METATYPE(). This will enable useful features; for example, if
+ used in a QVariant, you can convert them to strings. Likewise, passing them
+ to QDebug will print out their names.
+
+ \sa {Qt's Property System}
+*/
+
+
+/*!
+ \macro Q_FLAG_NS(...)
+ \since 5.8
+
+ This macro registers a single \l{QFlags}{flags type} with the
+ meta-object system. It is used in a namespace that has the
+ Q_NAMESPACE macro, to declare that values of a given enum can be
+ used as flags and combined using the bitwise OR operator.
+ It is the same as \l Q_FLAG but in a namespace.
+
+ The macro must be placed after the enum declaration.
+
+ \note The Q_FLAG_NS macro takes care of registering individual flag
+ values with the meta-object system, so it is unnecessary to use
+ Q_ENUM_NS() in addition to this macro.
+
+ \sa {Qt's Property System}
+*/
+
/*!
\macro Q_OBJECT
@@ -4335,6 +4377,21 @@ QDebug operator<<(QDebug dbg, const QObject *o)
*/
/*!
+ \macro Q_NAMESPACE
+ \since 5.8
+
+ The Q_NAMESPACE macro can be used to add QMetaObject capabilities
+ to a namespace.
+
+ Q_NAMESPACEs can have Q_CLASSINFO, Q_ENUM_NS, Q_FLAG_NS, but they
+ cannot have Q_ENUM, Q_FLAG, Q_PROPERTY, Q_INVOKABLE, signals nor slots.
+
+ Q_NAMESPACE makes an external variable, \c{staticMetaObject}, available.
+ \c{staticMetaObject} is of type QMetaObject and provides access to the
+ enums declared with Q_ENUM_NS/Q_FLAG_NS.
+*/
+
+/*!
\macro Q_SIGNALS
\relates QObject
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 3660d1c0e1..7ed6088d3b 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -124,6 +124,11 @@ class QString;
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
+#define Q_ENUM_NS_IMPL(ENUM) \
+ inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \
+ inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
+#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
+#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
@@ -227,6 +232,12 @@ private: \
QT_WARNING_POP \
QT_ANNOTATE_CLASS(qt_qgadget, "") \
/*end*/
+
+#define Q_NAMESPACE \
+ extern const QMetaObject staticMetaObject; \
+ QT_ANNOTATE_CLASS(qt_qnamespace, "") \
+ /*end*/
+
#endif // QT_NO_META_MACROS
#else // Q_MOC_RUN
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index d21529d124..72ae3b063f 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -2722,7 +2722,7 @@ qlonglong QVariant::toLongLong(bool *ok) const
}
/*!
- Returns the variant as as an unsigned long long int if the
+ Returns the variant as an unsigned long long int if the
variant has type() \l QMetaType::ULongLong, \l QMetaType::Bool,
\l QMetaType::QByteArray, \l QMetaType::QChar, \l QMetaType::Double,
\l QMetaType::Int, \l QMetaType::LongLong, \l QMetaType::QString, or
@@ -3560,6 +3560,8 @@ int QVariant::compare(const QVariant &v) const
return v1.toTime() < v2.toTime() ? -1 : 1;
case QVariant::DateTime:
return v1.toDateTime() < v2.toDateTime() ? -1 : 1;
+ case QVariant::StringList:
+ return v1.toStringList() < v2.toStringList() ? -1 : 1;
}
int r = v1.toString().compare(v2.toString(), Qt::CaseInsensitive);
if (r == 0) {
diff --git a/src/corelib/mimetypes/mimetypes.pri b/src/corelib/mimetypes/mimetypes.pri
index 1ab773fc10..870b6c65a5 100644
--- a/src/corelib/mimetypes/mimetypes.pri
+++ b/src/corelib/mimetypes/mimetypes.pri
@@ -1,6 +1,7 @@
# Qt core mimetype module
-HEADERS += \
+qtConfig(mimetype) {
+ HEADERS += \
mimetypes/qmimedatabase.h \
mimetypes/qmimetype.h \
mimetypes/qmimemagicrulematcher_p.h \
@@ -11,7 +12,7 @@ HEADERS += \
mimetypes/qmimeglobpattern_p.h \
mimetypes/qmimeprovider_p.h
-SOURCES += \
+ SOURCES += \
mimetypes/qmimedatabase.cpp \
mimetypes/qmimetype.cpp \
mimetypes/qmimemagicrulematcher.cpp \
@@ -20,6 +21,5 @@ SOURCES += \
mimetypes/qmimeglobpattern.cpp \
mimetypes/qmimeprovider.cpp
-!contains(DEFINES, QT_NO_MIMETYPE) {
RESOURCES += mimetypes/mimetypes.qrc
}
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index d866d3bcf7..f786b2ae03 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -246,7 +246,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent)
The MIME type database is provided by the freedesktop.org shared-mime-info
project. If the MIME type database cannot be found on the system, as is the case
- on most Windows, OS X, and iOS systems, Qt will use its own copy of it.
+ on most Windows, \macos, and iOS systems, Qt will use its own copy of it.
Applications which want to define custom MIME types need to install an
XML file into the locations searched for MIME definitions.
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 93a901d614..aff2991ed1 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -608,7 +608,7 @@ bool QLibraryPrivate::loadPlugin()
\row \li Unix/Linux \li \c .so
\row \li AIX \li \c .a
\row \li HP-UX \li \c .sl, \c .so (HP-UXi)
- \row \li OS X and iOS \li \c .dylib, \c .bundle, \c .so
+ \row \li \macos and iOS \li \c .dylib, \c .bundle, \c .so
\endtable
Trailing versioning numbers on Unix are ignored.
@@ -845,7 +845,7 @@ QLibrary::QLibrary(QObject *parent)
We recommend omitting the file's suffix in \a fileName, since
QLibrary will automatically look for the file with the appropriate
suffix in accordance with the platform, e.g. ".so" on Unix,
- ".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.)
+ ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
*/
QLibrary::QLibrary(const QString& fileName, QObject *parent)
:QObject(parent), d(0), did_load(false)
@@ -862,7 +862,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent)
We recommend omitting the file's suffix in \a fileName, since
QLibrary will automatically look for the file with the appropriate
suffix in accordance with the platform, e.g. ".so" on Unix,
- ".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.)
+ ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
*/
QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
:QObject(parent), d(0), did_load(false)
@@ -878,7 +878,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
We recommend omitting the file's suffix in \a fileName, since
QLibrary will automatically look for the file with the appropriate
suffix in accordance with the platform, e.g. ".so" on Unix,
- ".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.)
+ ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.)
*/
QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent)
:QObject(parent), d(0), did_load(false)
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 4752f69ff3..4ec4e43952 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -145,7 +145,7 @@ QPluginLoader::QPluginLoader(QObject *parent)
To be loadable, the file's suffix must be a valid suffix for a
loadable library in accordance with the platform, e.g. \c .so on
- Unix, - \c .dylib on OS X and iOS, and \c .dll on Windows. The suffix
+ Unix, - \c .dylib on \macos and iOS, and \c .dll on Windows. The suffix
can be verified with QLibrary::isLibrary().
\sa setFileName()
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index e3cfd7b988..db395b24dd 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -57,7 +57,7 @@
#include "private/qobject_p.h"
#include "private/qthread_p.h"
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
#include "qeventtransition.h"
#include "qeventtransition_p.h"
#endif
@@ -2196,7 +2196,7 @@ void QStateMachinePrivate::maybeRegisterTransition(QAbstractTransition *transiti
if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
maybeRegisterSignalTransition(st);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
else if (QEventTransition *et = qobject_cast<QEventTransition*>(transition)) {
maybeRegisterEventTransition(et);
}
@@ -2208,7 +2208,7 @@ void QStateMachinePrivate::registerTransition(QAbstractTransition *transition)
if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
registerSignalTransition(st);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
registerEventTransition(oet);
}
@@ -2220,7 +2220,7 @@ void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition)
if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
unregisterSignalTransition(st);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
unregisterEventTransition(oet);
}
@@ -2342,7 +2342,7 @@ void QStateMachinePrivate::unregisterAllTransitions()
}
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
void QStateMachinePrivate::maybeRegisterEventTransition(QEventTransition *transition)
{
if ((state == Running) && configuration.contains(transition->sourceState()))
@@ -2872,7 +2872,7 @@ bool QStateMachine::event(QEvent *e)
return QState::event(e);
}
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
/*!
\reimp
*/
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 843844e172..031d9ceee2 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -141,7 +141,7 @@ public:
QSet<QAbstractState*> configuration() const;
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
#endif
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index 1305558ef8..45634e27fb 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -66,7 +66,7 @@
QT_BEGIN_NAMESPACE
class QEvent;
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
class QEventTransition;
#endif
class QSignalEventGenerator;
@@ -186,7 +186,7 @@ public:
void registerSignalTransition(QSignalTransition *transition);
void unregisterSignalTransition(QSignalTransition *transition);
void registerMultiThreadedSignalTransitions();
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
void maybeRegisterEventTransition(QEventTransition *transition);
void registerEventTransition(QEventTransition *transition);
void unregisterEventTransition(QEventTransition *transition);
@@ -301,7 +301,7 @@ public:
QHash<const QObject*, QVector<int> > connections;
QMutex connectionsMutex;
-#ifndef QT_NO_STATEMACHINE_EVENTFILTER
+#if QT_CONFIG(qeventtransition)
QHash<QObject*, QHash<QEvent::Type, int> > qobjectEvents;
#endif
QFreeList<void> delayedEventIdFreeList;
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
index c5396a2ef8..52df10a3bc 100644
--- a/src/corelib/statemachine/statemachine.pri
+++ b/src/corelib/statemachine/statemachine.pri
@@ -22,8 +22,10 @@ SOURCES += $$PWD/qstatemachine.cpp \
$$PWD/qabstracttransition.cpp \
$$PWD/qsignaltransition.cpp
-!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) {
-HEADERS += $$PWD/qeventtransition.h \
- $$PWD/qeventtransition_p.h
-SOURCES += $$PWD/qeventtransition.cpp
+qtConfig(qeventtransition) {
+ HEADERS += \
+ $$PWD/qeventtransition.h \
+ $$PWD/qeventtransition_p.h
+ SOURCES += \
+ $$PWD/qeventtransition.cpp
}
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h
index 7ae5c68bb9..1f0c747f40 100644
--- a/src/corelib/thread/qfuture.h
+++ b/src/corelib/thread/qfuture.h
@@ -65,13 +65,7 @@ public:
explicit QFuture(QFutureInterface<T> *p) // internal
: d(*p)
{ }
- QFuture(const QFuture &other)
- : d(other.d)
- { }
- ~QFuture()
- { }
- inline QFuture &operator=(const QFuture &other);
bool operator==(const QFuture &other) const { return (d == other.d); }
bool operator!=(const QFuture &other) const { return (d != other.d); }
@@ -157,13 +151,6 @@ public: // Warning: the d pointer is not documented and is considered private.
};
template <typename T>
-inline QFuture<T> &QFuture<T>::operator=(const QFuture<T> &other)
-{
- d = other.d;
- return *this;
-}
-
-template <typename T>
inline T QFuture<T>::result() const
{
d.waitForResult(0);
@@ -195,13 +182,7 @@ public:
explicit QFuture(QFutureInterfaceBase *p) // internal
: d(*p)
{ }
- QFuture(const QFuture &other)
- : d(other.d)
- { }
- ~QFuture()
- { }
- QFuture &operator=(const QFuture &other);
bool operator==(const QFuture &other) const { return (d == other.d); }
bool operator!=(const QFuture &other) const { return (d != other.d); }
@@ -248,12 +229,6 @@ public:
mutable QFutureInterfaceBase d;
};
-inline QFuture<void> &QFuture<void>::operator=(const QFuture<void> &other)
-{
- d = other.d;
- return *this;
-}
-
inline QFuture<void> QFutureInterface<void>::future()
{
return QFuture<void>(this);
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 1787ff3b93..559d26e231 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -285,21 +285,13 @@ template <>
class QFutureInterface<void> : public QFutureInterfaceBase
{
public:
- QFutureInterface<void>(State initialState = NoState)
+ explicit QFutureInterface<void>(State initialState = NoState)
: QFutureInterfaceBase(initialState)
{ }
- QFutureInterface<void>(const QFutureInterface<void> &other)
- : QFutureInterfaceBase(other)
- { }
static QFutureInterface<void> canceledResult()
{ return QFutureInterface(State(Started | Finished | Canceled)); }
- QFutureInterface<void> &operator=(const QFutureInterface<void> &other)
- {
- QFutureInterfaceBase::operator=(other);
- return *this;
- }
inline QFuture<void> future(); // implemented in qfuture.h
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index deedd61c17..ba5f2dca95 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -45,7 +45,7 @@
#include <private/qcoreapplication_p.h>
#include <private/qcore_unix_p.h>
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_DARWIN)
# include <private/qeventdispatcher_cf_p.h>
#else
# if !defined(QT_NO_GLIB)
@@ -279,7 +279,7 @@ typedef void*(*QtThreadCallback)(void*);
void QThreadPrivate::createEventDispatcher(QThreadData *data)
{
-#if defined(Q_OS_OSX)
+#if defined(Q_OS_DARWIN)
bool ok = false;
int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
if (ok && value > 0)
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 6e68bc7eb1..6e472e8b22 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -516,14 +516,19 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
#endif // QT_DEPRECATED_SINCE(5, 2)
+#ifdef Q_CC_CLANG
// Clang had a bug where __builtin_ctz/clz/popcount were not marked as constexpr.
-#if !defined Q_CC_CLANG || (defined __apple_build_version__ && __clang_major__ >= 7) \
- || (Q_CC_CLANG >= 307)
+# if (defined __apple_build_version__ && __clang_major__ >= 7) || (Q_CC_CLANG >= 307)
+# define QT_HAS_CONSTEXPR_BUILTINS
+# endif
+#elif defined(Q_CC_MSVC) && !defined(Q_CC_INTEL) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM)
+# define QT_HAS_CONSTEXPR_BUILTINS
+#elif defined(Q_CC_GNU)
# define QT_HAS_CONSTEXPR_BUILTINS
#endif
#if defined QT_HAS_CONSTEXPR_BUILTINS
-#if defined(Q_CC_GNU)
+#if defined(Q_CC_GNU) || defined(Q_CC_CLANG)
# define QT_HAS_BUILTIN_CTZS
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
{
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index 7482315909..c2b86014ba 100644
--- a/src/corelib/tools/qcommandlineoption.cpp
+++ b/src/corelib/tools/qcommandlineoption.cpp
@@ -147,7 +147,7 @@ QCommandLineOption::QCommandLineOption(const QStringList &names)
The description is set to \a description. It is customary to add a "."
at the end of the description.
- In addition, the \a valueName can be set if the option expects a value.
+ In addition, the \a valueName needs to be set if the option expects a value.
The default value for the option is set to \a defaultValue.
In Qt versions before 5.4, this constructor was \c explicit. In Qt 5.4
@@ -183,7 +183,7 @@ QCommandLineOption::QCommandLineOption(const QString &name, const QString &descr
The description is set to \a description. It is customary to add a "."
at the end of the description.
- In addition, the \a valueName can be set if the option expects a value.
+ In addition, the \a valueName needs to be set if the option expects a value.
The default value for the option is set to \a defaultValue.
In Qt versions before 5.4, this constructor was \c explicit. In Qt 5.4
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index 2450484ce9..4c55880915 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+extern void Q_CORE_EXPORT qt_call_post_routines();
+
typedef QHash<QString, int> NameHash_t;
class QCommandLineParserPrivate
@@ -588,6 +590,7 @@ void QCommandLineParser::process(const QStringList &arguments)
{
if (!d->parse(arguments)) {
showParserMessage(errorText() + QLatin1Char('\n'), ErrorMessage);
+ qt_call_post_routines();
::exit(EXIT_FAILURE);
}
@@ -1011,6 +1014,7 @@ Q_NORETURN void QCommandLineParser::showVersion()
showParserMessage(QCoreApplication::applicationName() + QLatin1Char(' ')
+ QCoreApplication::applicationVersion() + QLatin1Char('\n'),
UsageMessage);
+ qt_call_post_routines();
::exit(EXIT_SUCCESS);
}
@@ -1028,6 +1032,7 @@ Q_NORETURN void QCommandLineParser::showVersion()
Q_NORETURN void QCommandLineParser::showHelp(int exitCode)
{
showParserMessage(d->helpText(), UsageMessage);
+ qt_call_post_routines();
::exit(exitCode);
}
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index ac973b047f..3271e2a8c4 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -1723,11 +1723,9 @@ QDateTime QDateTimeParser::getMaximum() const
QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const
{
- if (ap == AmText) {
- return (cs == UpperCase ? tr("AM") : tr("am"));
- } else {
- return (cs == UpperCase ? tr("PM") : tr("pm"));
- }
+ const QLocale loc = locale();
+ QString raw = ap == AmText ? loc.amText() : loc.pmText();
+ return cs == UpperCase ? raw.toUpper() : raw.toLower();
}
/*
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index 90edeca0a8..406eb31923 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -539,9 +539,6 @@ void QMapDataBase::freeData(QMapDataBase *d)
Constructs a copy of \a other.
- This function is only available if Qt is configured with STL
- compatibility enabled.
-
\sa toStdMap()
*/
@@ -558,9 +555,6 @@ void QMapDataBase::freeData(QMapDataBase *d)
/*! \fn std::map<Key, T> QMap::toStdMap() const
Returns an STL map equivalent to this QMap.
-
- This function is only available if Qt is configured with STL
- compatibility enabled.
*/
/*! \fn QMap::~QMap()
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 7c4280d36b..bf1bc3e650 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5449,7 +5449,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2,
platform-dependent manner. Use this function to present sorted
lists of strings to the user.
- On OS X and iOS this function compares according the
+ On \macos and iOS this function compares according the
"Order for sorted lists" setting in the International preferences panel.
\sa compare(), QLocale
@@ -9419,7 +9419,7 @@ QStringRef QStringRef::appendTo(QString *string) const
platform-dependent manner. Use this function to present sorted
lists of strings to the user.
- On OS X and iOS, this function compares according the
+ On \macos and iOS, this function compares according the
"Order for sorted lists" setting in the International prefereces panel.
\sa compare(), QLocale
@@ -9478,7 +9478,7 @@ QString &QString::append(const QStringRef &str)
{
if (str.string() == this) {
str.appendTo(this);
- } else if (str.string()) {
+ } else if (!str.isNull()) {
int oldSize = size();
resize(oldSize + str.size());
memcpy(data() + oldSize, str.unicode(), str.size() * sizeof(QChar));
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 6e717f2233..96d04df0e2 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -909,13 +909,12 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch
&& !m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) {
const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year();
- const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
- QVector<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
- year + 1, lastMSecs);
+ QVector<QTimeZonePrivate::Data> posixTrans =
+ calculatePosixTransitions(m_posixRule, year - 1, year + 1,
+ m_tranTimes.last().atMSecsSinceEpoch);
for (int i = posixTrans.size() - 1; i >= 0; --i) {
if (posixTrans.at(i).atMSecsSinceEpoch <= forMSecsSinceEpoch) {
- QTimeZonePrivate::Data data;
- data = posixTrans.at(i);
+ QTimeZonePrivate::Data data = posixTrans.at(i);
data.atMSecsSinceEpoch = forMSecsSinceEpoch;
return data;
}
@@ -953,9 +952,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince
if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch
&& !m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) {
const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year();
- const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
- QVector<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
- year + 1, lastMSecs);
+ QVector<QTimeZonePrivate::Data> posixTrans =
+ calculatePosixTransitions(m_posixRule, year - 1, year + 1,
+ m_tranTimes.last().atMSecsSinceEpoch);
for (int i = 0; i < posixTrans.size(); ++i) {
if (posixTrans.at(i).atMSecsSinceEpoch > afterMSecsSinceEpoch)
return posixTrans.at(i);
@@ -979,9 +978,9 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecs
if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch
&& !m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) {
const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year();
- const int lastMSecs = (m_tranTimes.size() > 0) ? m_tranTimes.last().atMSecsSinceEpoch : 0;
- QVector<QTimeZonePrivate::Data> posixTrans = calculatePosixTransitions(m_posixRule, year - 1,
- year + 1, lastMSecs);
+ QVector<QTimeZonePrivate::Data> posixTrans =
+ calculatePosixTransitions(m_posixRule, year - 1, year + 1,
+ m_tranTimes.last().atMSecsSinceEpoch);
for (int i = posixTrans.size() - 1; i >= 0; --i) {
if (posixTrans.at(i).atMSecsSinceEpoch < beforeMSecsSinceEpoch)
return posixTrans.at(i);
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 853827e032..7ebd9cf710 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -146,14 +146,14 @@ else:win32 {
SOURCES += tools/qlocale_unix.cpp
}
-contains(QT_CONFIG, system-zlib) {
+qtConfig(system-zlib) {
include($$PWD/../../3rdparty/zlib_dependency.pri)
} else {
CONFIG += no_core_dep
include($$PWD/../../3rdparty/zlib.pri)
}
-contains(QT_CONFIG,icu) {
+qtConfig(icu) {
include($$PWD/../../3rdparty/icu_dependency.pri)
SOURCES += tools/qlocale_icu.cpp \
@@ -192,9 +192,9 @@ INCLUDEPATH += ../3rdparty/md5 \
../3rdparty/md4 \
../3rdparty/sha3
-contains(QT_CONFIG, system-doubleconversion) {
- LIBS_PRIVATE += -ldouble-conversion
-} else: contains(QT_CONFIG, doubleconversion) {
+qtConfig(system-doubleconversion) {
+ QMAKE_USE_PRIVATE += doubleconversion
+} else: qtConfig(doubleconversion) {
include($$PWD/../../3rdparty/double-conversion/double-conversion.pri)
}
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 96a798ed66..43050dcea2 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -1,17 +1,11 @@
TARGET = QtDBus
QT = core-private
-CONFIG += link_pkgconfig
MODULE_CONFIG = dbusadaptors dbusinterfaces
-!contains(QMAKE_LIBS_DBUS, .*dbus-1.*) {
- win32:CONFIG(debug, debug|release):QMAKE_LIBS_DBUS += -ldbus-1d
- else:QMAKE_LIBS_DBUS += -ldbus-1
-}
-
DEFINES += DBUS_API_SUBJECT_TO_CHANGE
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS
-contains(QT_CONFIG, dbus-linked) {
- LIBS_PRIVATE += $$QMAKE_LIBS_DBUS
+qtConfig(dbus-linked) {
+ QMAKE_USE_PRIVATE += dbus
DEFINES += QT_LINKED_LIBDBUS
}
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index bd100639d1..0b7c731810 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -280,7 +280,7 @@ public slots:
void socketWrite(int);
void objectDestroyed(QObject *o);
void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args);
- void addSignalHook(const QString &key, const SignalHook &hook);
+ bool addSignalHook(const QString &key, const SignalHook &hook);
bool removeSignalHook(const QString &key, const SignalHook &hook);
private slots:
@@ -293,7 +293,7 @@ signals:
void dispatchStatusChanged();
void spyHooksFinished(const QDBusMessage &msg);
void messageNeedsSending(QDBusPendingCallPrivate *pcall, void *msg, int timeout = -1);
- void signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
+ bool signalNeedsConnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
bool signalNeedsDisconnecting(const QString &key, const QDBusConnectionPrivate::SignalHook &hook);
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &message);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 54418c213a..21bc3c8ac2 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -2187,20 +2187,16 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service,
// check the slot
QDBusConnectionPrivate::SignalHook hook;
QString key;
- QString name2 = name;
- if (name2.isNull())
- name2.detach();
hook.signature = signature;
if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false))
return false; // don't connect
Q_ASSERT(thread() != QThread::currentThread());
- emit signalNeedsConnecting(key, hook);
- return true;
+ return emit signalNeedsConnecting(key, hook);
}
-void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook &hook)
+bool QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook &hook)
{
QDBusWriteLocker locker(ConnectAction, this);
@@ -2216,7 +2212,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
entry.midx == hook.midx &&
entry.argumentMatch == hook.argumentMatch) {
// no need to compare the parameters if it's the same slot
- return; // already there
+ return false; // already there
}
}
@@ -2228,7 +2224,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
if (mit != matchRefCounts.end()) { // Match already present
mit.value() = mit.value() + 1;
- return;
+ return true;
}
matchRefCounts.insert(hook.matchRule, 1);
@@ -2255,6 +2251,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook
}
}
}
+ return true;
}
bool QDBusConnectionPrivate::disconnectSignal(const QString &service,
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index b7f341d5b7..8dd821fe6a 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -1,6 +1,6 @@
# Qt accessibility module
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
HEADERS += \
accessible/qaccessible.h \
accessible/qaccessiblecache_p.h \
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index e95315aea8..874b99be4f 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE
to replace or extend the default behavior of the static functions
in QAccessible.
- Qt supports Microsoft Active Accessibility (MSAA), OS X
+ Qt supports Microsoft Active Accessibility (MSAA), \macos
Accessibility, and the Unix/X11 AT-SPI standard. Other backends
can be supported using QAccessibleBridge.
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index ae66579ba7..c6a417e063 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\ingroup accessibility
\inmodule QtWidgets
- Qt supports Microsoft Active Accessibility (MSAA), OS X
+ Qt supports Microsoft Active Accessibility (MSAA), \macos
Accessibility, and the Unix/X11 AT-SPI standard. By subclassing
QAccessibleBridge, you can support other backends than the
predefined ones.
diff --git a/src/gui/doc/images/qcolor-saturation.png b/src/gui/doc/images/qcolor-saturation.png
index f28776aff5..9c104f7389 100644
--- a/src/gui/doc/images/qcolor-saturation.png
+++ b/src/gui/doc/images/qcolor-saturation.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-saturation.svg b/src/gui/doc/images/qcolor-saturation.svg
new file mode 100644
index 0000000000..608c2555e8
--- /dev/null
+++ b/src/gui/doc/images/qcolor-saturation.svg
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ id="svg2"
+ viewBox="0 0 186.82259 45.046909"
+ height="12.713239mm"
+ width="52.725487mm">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3346">
+ <stop
+ id="stop3348"
+ offset="0"
+ style="stop-color:#808080;stop-opacity:1" />
+ <stop
+ id="stop3350"
+ offset="1"
+ style="stop-color:#0000ff;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="translate(109.31384,222.16879)"
+ gradientUnits="userSpaceOnUse"
+ y2="16.118341"
+ x2="200.35715"
+ y1="16.118341"
+ x1="3.7246187"
+ id="linearGradient3352"
+ xlink:href="#linearGradient3346" />
+ </defs>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="translate(-109.31384,-222.16879)"
+ id="layer1">
+ <rect
+ y="225.7121"
+ x="112.85714"
+ height="25.221529"
+ width="179.73599"
+ id="rect3336"
+ style="opacity:1;fill:url(#linearGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <text
+ id="text3338"
+ y="263.53079"
+ x="113.03048"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ xml:space="preserve"><tspan
+ y="263.53079"
+ x="113.03048"
+ id="tspan3340">0</tspan></text>
+ <text
+ id="text3342"
+ y="263.53079"
+ x="271.76645"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ xml:space="preserve"><tspan
+ y="263.53079"
+ x="271.76645"
+ id="tspan3344">255</tspan></text>
+ </g>
+</svg>
diff --git a/src/gui/doc/images/qcolor-value.png b/src/gui/doc/images/qcolor-value.png
index 0e069123a9..add9b7f83d 100644
--- a/src/gui/doc/images/qcolor-value.png
+++ b/src/gui/doc/images/qcolor-value.png
Binary files differ
diff --git a/src/gui/doc/images/qcolor-value.svg b/src/gui/doc/images/qcolor-value.svg
new file mode 100644
index 0000000000..51c2de0338
--- /dev/null
+++ b/src/gui/doc/images/qcolor-value.svg
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="52.725487mm"
+ height="12.713239mm"
+ viewBox="0 0 186.82259 45.046909"
+ id="svg2"
+ version="1.1">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3346">
+ <stop
+ style="stop-color:#000000;stop-opacity:1"
+ offset="0"
+ id="stop3348" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="1"
+ id="stop3350" />
+ </linearGradient>
+ <linearGradient
+ xlink:href="#linearGradient3346"
+ id="linearGradient3352"
+ x1="3.7246187"
+ y1="16.118341"
+ x2="183.57143"
+ y2="15.761199"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(109.31384,222.16879)" />
+ </defs>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ transform="translate(-109.31384,-222.16879)">
+ <rect
+ style="opacity:1;fill:url(#linearGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.1;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3336"
+ width="179.73599"
+ height="25.221529"
+ x="112.85714"
+ y="225.7121" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="113.03048"
+ y="263.53079"
+ id="text3338"><tspan
+ id="tspan3340"
+ x="113.03048"
+ y="263.53079">0</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:Sans;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="271.76645"
+ y="263.53079"
+ id="text3342"><tspan
+ id="tspan3344"
+ x="271.76645"
+ y="263.53079">255</tspan></text>
+ </g>
+</svg>
diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc
index 1238480be8..03b3cbfa24 100644
--- a/src/gui/doc/src/dnd.qdoc
+++ b/src/gui/doc/src/dnd.qdoc
@@ -399,7 +399,7 @@
On X11, the public \l{http://www.newplanetsoftware.com/xdnd/}{XDND
protocol} is used, while on Windows Qt uses the OLE standard, and
- Qt for OS X uses the Cocoa Drag Manager. On X11, XDND uses MIME,
+ Qt for \macos uses the Cocoa Drag Manager. On X11, XDND uses MIME,
so no translation is necessary. The Qt API is the same regardless of
the platform. On Windows, MIME-aware applications can communicate by
using clipboard format names that are MIME types. Already some
@@ -408,6 +408,6 @@
Custom classes for translating proprietary clipboard formats can be
registered by reimplementing QWinMime on Windows or
- QMacPasteboardMime on OS X.
+ QMacPasteboardMime on \macos.
*/
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index 9781135960..a9fe520d5e 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -187,6 +187,19 @@
More info in \l{Drag and Drop}
+ \section1 Licenses and Attributions
+
+ Qt GUI is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt GUI potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtgui}
+
\section1 Reference
\list
\li \l{Qt GUI C++ Classes}
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index d1d0041616..a6eaadd6c5 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -1,7 +1,7 @@
TARGET = QtGui
QT = core-private
-contains(QT_CONFIG, opengl.*): MODULE_CONFIG = opengl
+qtConfig(opengl.*): MODULE_CONFIG = opengl
DEFINES += QT_NO_USING_NAMESPACE
@@ -18,7 +18,7 @@ MODULE_PLUGIN_TYPES = \
egldeviceintegrations
# This is here only because the platform plugin is no module, obviously.
-contains(QT_CONFIG, angle) {
+qtConfig(angle) {
MODULE_AUX_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtANGLE
}
@@ -53,7 +53,7 @@ load(cmake_functions)
win32: CMAKE_WINDOWS_BUILD = True
-contains(QT_CONFIG, angle) {
+qtConfig(angle) {
CMAKE_GL_INCDIRS = $$CMAKE_INCLUDE_DIR
CMAKE_ANGLE_EGL_DLL_RELEASE = libEGL.dll
CMAKE_ANGLE_EGL_IMPLIB_RELEASE = libEGL.lib
@@ -66,22 +66,22 @@ contains(QT_CONFIG, angle) {
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
} else {
- contains(QT_CONFIG, egl) {
+ qtConfig(egl) {
CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL)
!isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL)
}
- contains(QT_CONFIG, opengles2) {
+ qtConfig(opengles2) {
!isEmpty(QMAKE_INCDIR_OPENGL_ES2): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES2)
CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES2)
!isEmpty(QMAKE_LIBDIR_OPENGL_ES2): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL_ES2)
CMAKE_GL_HEADER_NAME = GLES2/gl2.h
CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2
- } else:contains(QT_CONFIG, opengl) {
+ } else: qtConfig(opengl) {
!isEmpty(QMAKE_INCDIR_OPENGL): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL)
- !contains(QT_CONFIG, dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
+ !qtConfig(dynamicgl): CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL)
!isEmpty(QMAKE_LIBDIR_OPENGL): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL)
CMAKE_GL_HEADER_NAME = GL/gl.h
mac: CMAKE_GL_HEADER_NAME = gl.h
@@ -89,6 +89,6 @@ contains(QT_CONFIG, angle) {
}
}
-contains(QT_CONFIG, egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
+qtConfig(egl): CMAKE_EGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_EGL)
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 378256516c..3c4d2c0bbf 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -53,6 +53,8 @@ SOURCES += \
win32:!winrt: SOURCES += image/qpixmap_win.cpp
+darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
+
NO_PCH_SOURCES += image/qimage_compat.cpp
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
@@ -69,7 +71,7 @@ SOURCES += \
image/qxbmhandler.cpp \
image/qxpmhandler.cpp
-contains(QT_CONFIG, png) {
+qtConfig(png) {
HEADERS += image/qpnghandler_p.h
SOURCES += image/qpnghandler.cpp
include($$PWD/../../3rdparty/png_dependency.pri)
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index c65ac7f92d..62ec8e93b2 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1247,7 +1247,7 @@ void QIcon::setIsMask(bool isMask)
Returns \c true if this icon has been marked as a mask image.
Certain platforms render mask icons differently (for example,
- menu icons on OS X).
+ menu icons on \macos).
\sa setIsMask()
*/
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 219daace5c..0faf8820dd 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -316,10 +316,8 @@ QIconTheme::QIconTheme(const QString &themeName)
#ifndef QT_NO_SETTINGS
if (themeIndex.exists()) {
const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat);
- QStringListIterator keyIterator(indexReader.allKeys());
- while (keyIterator.hasNext()) {
-
- const QString key = keyIterator.next();
+ const QStringList keys = indexReader.allKeys();
+ for (const QString &key : keys) {
if (key.endsWith(QLatin1String("/Size"))) {
// Note the QSettings ini-format does not accept
// slashes in key names, hence we have to cheat
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index a99134d3bb..91aaf673d0 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -54,6 +54,10 @@
#include <QtCore/qstringlist.h>
#endif
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(CGImage);
+#endif
+
QT_BEGIN_NAMESPACE
@@ -321,6 +325,11 @@ public:
static QPixelFormat toPixelFormat(QImage::Format format) Q_DECL_NOTHROW;
static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW;
+ // Platform spesific conversion functions
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED;
+#endif
+
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const;
QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm
new file mode 100644
index 0000000000..d72733abd3
--- /dev/null
+++ b/src/gui/image/qimage_darwin.mm
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qimage.h"
+
+#include <private/qcore_mac_p.h>
+
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ Creates a \c CGImage equivalent to the QImage \a image. Returns a
+ \c CGImageRef handle.
+
+ The returned CGImageRef partakes in the QImage implicit sharing,
+ and holds a reference to the QImage data. CGImage is immutable
+ and will never detach the QImage. Writing to the QImage will detach
+ as usual.
+
+ This function is fast, and does not copy or convert image data.
+
+ The following image formats are supported, and will be mapped to
+ a corresponding native image type:
+
+ \table
+ \header
+ \li Qt
+ \li CoreGraphics
+ \row
+ \li Format_ARGB32
+ \li kCGImageAlphaFirst | kCGBitmapByteOrder32Host
+ \row
+ \li Format_RGB32
+ \li kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
+ \row
+ \li Format_RGBA8888_Premultiplied
+ \li kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_RGBA8888
+ \li kCGImageAlphaLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_RGBX8888
+ \li kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big
+ \row
+ \li Format_ARGB32_Premultiplied
+ \li kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host
+ \endtable
+
+ Other formats are not supported; this function returns a null
+ CGImageRef for those cases. Users of this function may then
+ convert the QImage to a supported formate first, for example
+ Format_ARGB32_Premultiplied.
+
+ The CGImageRef color space is set to the sRGB color space.
+
+ \sa toNSImage()
+*/
+CGImageRef QImage::toCGImage() const
+{
+ if (isNull())
+ return nil;
+
+ // Determine the target native format
+ uint cgflags = kCGImageAlphaNone;
+ switch (format()) {
+ case QImage::Format_ARGB32:
+ cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
+ break;
+ case QImage::Format_RGB32:
+ cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
+ break;
+ case QImage::Format_RGBA8888_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_RGBA8888:
+ cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_RGBX8888:
+ cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
+ break;
+ case QImage::Format_ARGB32_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
+ break;
+ default: break;
+ }
+
+ // Format not supported: return nil CGImageRef
+ if (cgflags == kCGImageAlphaNone)
+ return nil;
+
+ // Create a data provider that owns a copy of the QImage and references the image data.
+ auto deleter = [](void *image, const void *, size_t)
+ { delete static_cast<QImage *>(image); };
+ QCFType<CGDataProviderRef> dataProvider =
+ CGDataProviderCreateWithData(new QImage(*this), bits(), byteCount(), deleter);
+
+ QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+
+ const size_t bitsPerComponent = 8;
+ const size_t bitsPerPixel = 32;
+ const CGFloat *decode = nullptr;
+ const bool shouldInterpolate = false;
+
+ return CGImageCreate(width(), height(), bitsPerComponent, bitsPerPixel,
+ this->bytesPerLine(), colorSpace, cgflags, dataProvider,
+ decode, shouldInterpolate, kCGRenderingIntentDefault);
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index 546e2fef79..9889cfb8ec 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap
{
-// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap);
+// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap)
public:
QBlittablePlatformPixmap();
~QBlittablePlatformPixmap();
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 0e224df1ff..3b7e03a0ff 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -139,7 +139,7 @@ SOURCES += \
kernel/qhighdpiscaling.cpp
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += \
kernel/qplatformopenglcontext.h \
kernel/qopenglcontext.h \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index e9da36a42a..ec6c0bcc36 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -116,22 +116,22 @@ QT_BEGIN_NAMESPACE
\endlist
- \section1 Notes for OS X Users
+ \section1 Notes for \macos Users
- OS X supports a separate find buffer that holds the current
+ \macos supports a separate find buffer that holds the current
search string in Find operations. This find clipboard can be accessed
by specifying the FindBuffer mode.
- \section1 Notes for Windows and OS X Users
+ \section1 Notes for Windows and \macos Users
\list
- \li Windows and OS X do not support the global mouse
+ \li Windows and \macos do not support the global mouse
selection; they only supports the global clipboard, i.e. they
only add text to the clipboard when an explicit copy or cut is
made.
- \li Windows and OS X does not have the concept of ownership;
+ \li Windows and \macos does not have the concept of ownership;
the clipboard is a fully global resource so all applications are
notified of changes.
@@ -187,7 +187,7 @@ QClipboard::~QClipboard()
This signal is emitted when the clipboard data is changed.
- On OS X and with Qt version 4.3 or higher, clipboard
+ On \macos and with Qt version 4.3 or higher, clipboard
changes made by other applications will only be detected
when the application is activated.
@@ -199,7 +199,7 @@ QClipboard::~QClipboard()
This signal is emitted when the selection is changed. This only
applies to windowing systems that support selections, e.g. X11.
- Windows and OS X don't support selections.
+ Windows and \macos don't support selections.
\sa dataChanged(), findBufferChanged(), changed()
*/
@@ -209,7 +209,7 @@ QClipboard::~QClipboard()
\since 4.2
This signal is emitted when the find buffer is changed. This only
- applies to OS X.
+ applies to \macos.
With Qt version 4.3 or higher, clipboard changes made by other
applications will only be detected when the application is activated.
@@ -232,7 +232,7 @@ QClipboard::~QClipboard()
systems with a global mouse selection (e.g. X11).
\value FindBuffer indicates that data should be stored and retrieved from
- the Find buffer. This mode is used for holding search strings on OS X.
+ the Find buffer. This mode is used for holding search strings on \macos.
\omitvalue LastMode
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 99d8dcb737..5b36f496f1 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -226,7 +226,7 @@ QObject *QDrag::target() const
from are specified in \a supportedActions. The default proposed action will be selected
among the allowed actions in the following order: Move, Copy and Link.
- \b{Note:} On Linux and OS X, the drag and drop operation
+ \b{Note:} On Linux and \macos, the drag and drop operation
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
@@ -250,7 +250,7 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions)
The \a defaultDropAction determines which action will be proposed when the user performs a
drag without using modifier keys.
- \b{Note:} On Linux and OS X, the drag and drop operation
+ \b{Note:} On Linux and \macos, the drag and drop operation
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index d574ba5cc6..63876479bd 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -672,7 +672,7 @@ QHoverEvent::~QHoverEvent()
wheel event delta: angleDelta() returns the delta in wheel
degrees. This value is always provided. pixelDelta() returns
the delta in screen pixels and is available on platforms that
- have high-resolution trackpads, such as OS X. If that is the
+ have high-resolution trackpads, such as \macos. If that is the
case, source() will return Qt::MouseEventSynthesizedBySystem.
The functions pos() and globalPos() return the mouse cursor's
@@ -958,7 +958,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Returns the scrolling distance in pixels on screen. This value is
provided on platforms that support high-resolution pixel-based
- delta values, such as OS X. The value should be used directly
+ delta values, such as \macos. The value should be used directly
to scroll content on screen.
Example:
@@ -1099,7 +1099,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Returns the scrolling phase of this wheel event.
\note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently
- supported only on OS X.
+ supported only on \macos.
*/
@@ -1717,7 +1717,7 @@ QCloseEvent::~QCloseEvent()
\ingroup events
Icon drag events are sent to widgets when the main icon of a window
- has been dragged away. On OS X, this happens when the proxy
+ has been dragged away. On \macos, this happens when the proxy
icon of a window is dragged off the title bar.
It is normal to begin using drag and drop in response to this
@@ -2727,15 +2727,15 @@ Qt::MouseButtons QTabletEvent::buttons() const
\row
\li Qt::ZoomNativeGesture
\li Magnification delta in percent.
- \li OS X: Two-finger pinch.
+ \li \macos: Two-finger pinch.
\row
\li Qt::SmartZoomNativeGesture
\li Boolean magnification state.
- \li OS X: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).
+ \li \macos: Two-finger douple tap (trackpad) / One-finger douple tap (magic mouse).
\row
\li Qt::RotateNativeGesture
\li Rotation delta in degrees.
- \li OS X: Two-finger rotate.
+ \li \macos: Two-finger rotate.
\endtable
@@ -2758,7 +2758,7 @@ Qt::MouseButtons QTabletEvent::buttons() const
gesture position relative to the receiving widget or item,
window, and screen, respectively.
- \a realValue is the OS X event parameter, \a sequenceId and \a intValue are the Windows event parameters.
+ \a realValue is the \macos event parameter, \a sequenceId and \a intValue are the Windows event parameters.
*/
QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos,
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
@@ -3495,16 +3495,16 @@ QShowEvent::~QShowEvent()
when the operating system requests that a file or URL should be opened.
This is a high-level event that can be caused by different user actions
depending on the user's desktop environment; for example, double
- clicking on an file icon in the Finder on OS X.
+ clicking on an file icon in the Finder on \macos.
This event is only used to notify the application of a request.
It may be safely ignored.
- \note This class is currently supported for OS X only.
+ \note This class is currently supported for \macos only.
- \section1 OS X Example
+ \section1 \macos Example
- In order to trigger the event on OS X, the application must be configured
+ In order to trigger the event on \macos, the application must be configured
to let the OS know what kind of file(s) it should react on.
For example, the following \c Info.plist file declares that the application
@@ -3581,13 +3581,13 @@ bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
\internal
\class QToolBarChangeEvent
\brief The QToolBarChangeEvent class provides an event that is
- sent whenever a the toolbar button is clicked on OS X.
+ sent whenever a the toolbar button is clicked on \macos.
\ingroup events
\inmodule QtGui
- The QToolBarChangeEvent is sent when the toolbar button is clicked. On Mac
- OS X, this is the long oblong button on the right side of the window
+ The QToolBarChangeEvent is sent when the toolbar button is clicked. On
+ \macos, this is the long oblong button on the right side of the window
title bar. The default implementation is to toggle the appearance (hidden or
shown) of the associated toolbars for the window.
*/
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 416c899270..2ed7eb2cfb 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1060,7 +1060,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
\list
\li \c android
- \li \c cocoa is a platform plugin for OS X.
+ \li \c cocoa is a platform plugin for \macos.
\li \c directfb
\li \c eglfs is a platform plugin for running Qt5 applications on top of
EGL and OpenGL ES 2.0 without an actual windowing system (like X11
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index d6e467db59..76663cdc01 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -125,7 +125,7 @@ static inline qreal initialGlobalScaleFactor()
The devicePixelRatio seen by applications is the product of the Qt scale
factor and the OS scale factor. The value of the scale factors may be 1,
in which case two or more of the coordinate systems are equivalent. Platforms
- that (may) have an OS scale factor include OS X, iOS and Wayland.
+ that (may) have an OS scale factor include \macos, iOS and Wayland.
Note that the functions in this file do not work with the OS scale factor
directly and are limited to converting between device independent and native
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index e7b1f9e073..f1135db307 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -153,7 +153,7 @@ static bool qt_sequence_no_mnemonics = false;
Specifies whether mnemonics for menu items, labels, etc., should
be honored or not. On Windows and X11, this feature is
- on by default; on OS X, it is off. When this feature is off
+ on by default; on \macos, it is off. When this feature is off
(that is, when \a b is false), QKeySequence::mnemonic() always
returns an empty string.
@@ -217,7 +217,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
QKeySequence objects can be cast to a QString to obtain a human-readable
translated version of the sequence. Similarly, the toString() function
- produces human-readable strings for use in menus. On OS X, the
+ produces human-readable strings for use in menus. On \macos, the
appropriate symbols are used to describe keyboard shortcuts using special
keys on the Macintosh keyboard.
@@ -225,12 +225,12 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
code point of the character; for example, 'A' gives the same key sequence
as Qt::Key_A.
- \b{Note:} On OS X, references to "Ctrl", Qt::CTRL, Qt::Control
+ \note On \macos, references to "Ctrl", Qt::CTRL, Qt::Key_Control
and Qt::ControlModifier correspond to the \uicontrol Command keys on the
- Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and
+ Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and
Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on
- OS X can use the same shortcut descriptions across all platforms,
- and their applications will automatically work as expected on OS X.
+ \macos can use the same shortcut descriptions across all platforms,
+ and their applications will automatically work as expected on \macos.
\section1 Standard Shortcuts
@@ -239,18 +239,18 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
setting up actions in a typical application. The table below shows
some common key sequences that are often used for these standard
shortcuts by applications on four widely-used platforms. Note
- that on OS X, the \uicontrol Ctrl value corresponds to the \uicontrol
+ that on \macos, the \uicontrol Ctrl value corresponds to the \uicontrol
Command keys on the Macintosh keyboard, and the \uicontrol Meta value
corresponds to the \uicontrol Control keys.
\table
- \header \li StandardKey \li Windows \li OS X \li KDE \li GNOME
+ \header \li StandardKey \li Windows \li \macos \li KDE \li GNOME
\row \li HelpContents \li F1 \li Ctrl+? \li F1 \li F1
\row \li WhatsThis \li Shift+F1 \li Shift+F1 \li Shift+F1 \li Shift+F1
\row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O
\row \li Close \li Ctrl+F4, Ctrl+W \li Ctrl+W, Ctrl+F4 \li Ctrl+W \li Ctrl+W
\row \li Save \li Ctrl+S \li Ctrl+S \li Ctrl+S \li Ctrl+S
- \row \li Quit \li \li Ctrl+Q \li Qtrl+Q \li Qtrl+Q
+ \row \li Quit \li \li Ctrl+Q \li Ctrl+Q \li Ctrl+Q
\row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S
\row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N
\row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D
@@ -726,7 +726,7 @@ static const struct {
\value InsertLineSeparator Insert a new line.
\value InsertParagraphSeparator Insert a new paragraph.
\value Italic Italic text.
- \value MoveToEndOfBlock Move cursor to end of block. This shortcut is only used on the OS X.
+ \value MoveToEndOfBlock Move cursor to end of block. This shortcut is only used on the \macos.
\value MoveToEndOfDocument Move cursor to end of document.
\value MoveToEndOfLine Move cursor to end of line.
\value MoveToNextChar Move cursor to next character.
@@ -737,7 +737,7 @@ static const struct {
\value MoveToPreviousLine Move cursor to previous line.
\value MoveToPreviousPage Move cursor to previous page.
\value MoveToPreviousWord Move cursor to previous word.
- \value MoveToStartOfBlock Move cursor to start of a block. This shortcut is only used on OS X.
+ \value MoveToStartOfBlock Move cursor to start of a block. This shortcut is only used on \macos.
\value MoveToStartOfDocument Move cursor to start of document.
\value MoveToStartOfLine Move cursor to start of line.
\value New Create new document.
@@ -755,7 +755,7 @@ static const struct {
\value Save Save document.
\value SelectAll Select all text.
\value Deselect Deselect text. Since 5.1
- \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on OS X.
+ \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on \macos.
\value SelectEndOfDocument Extend selection to end of document.
\value SelectEndOfLine Extend selection to end of line.
\value SelectNextChar Extend selection to next character.
@@ -766,7 +766,7 @@ static const struct {
\value SelectPreviousLine Extend selection to previous line.
\value SelectPreviousPage Extend selection to previous page.
\value SelectPreviousWord Extend selection to previous word.
- \value SelectStartOfBlock Extend selection to the start of a text block. This shortcut is only used on OS X.
+ \value SelectStartOfBlock Extend selection to the start of a text block. This shortcut is only used on \macos.
\value SelectStartOfDocument Extend selection to start of document.
\value SelectStartOfLine Extend selection to start of line.
\value Underline Underline text.
@@ -1523,7 +1523,7 @@ bool QKeySequence::isDetached() const
If the key sequence has no keys, an empty string is returned.
- On OS X, the string returned resembles the sequence that is
+ On \macos, the string returned resembles the sequence that is
shown in the menu bar.
\sa fromString()
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 33e930eabe..57f70356b8 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -69,6 +69,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLFunctions;
class QOpenGLContext;
+class QOpenGLFramebufferObject;
class QOpenGLMultiGroupSharedResource;
class Q_GUI_EXPORT QOpenGLSharedResource
@@ -212,6 +213,7 @@ public:
, workaround_missingPrecisionQualifiers(false)
, active_engine(0)
, qgl_current_fbo_invalid(false)
+ , qgl_current_fbo(Q_NULLPTR)
, defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
@@ -250,6 +252,11 @@ public:
bool qgl_current_fbo_invalid;
+ // Set and unset in QOpenGLFramebufferObject::bind()/unbind().
+ // (Only meaningful for QOGLFBO since an FBO might be bound by other means)
+ // Saves us from querying the driver for the current FBO in most paths.
+ QOpenGLFramebufferObject *qgl_current_fbo;
+
QVariant nativeHandle;
GLuint defaultFboRedirect;
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index b5bcf94cd2..a992793246 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -388,7 +388,7 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
\warning Some styles do not use the palette for all drawing, for
instance, if they make use of native theme engines. This is the
- case for both the Windows XP, Windows Vista, and the OS X
+ case for both the Windows XP, Windows Vista, and the \macos
styles.
\sa QApplication::setPalette(), QWidget::setPalette(), QColor
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index c644d4769a..af0214e016 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -49,16 +49,6 @@
QT_BEGIN_NAMESPACE
-QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
-{
- QList<QPlatformCursor *> result;
- for (const QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list)) {
- if (QPlatformCursor *cursor = screen->handle()->cursor())
- result.push_back(cursor);
- }
- return result;
-}
-
/*!
\class QPlatformCursor
\since 5.0
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index f9c1607663..dddd9e5831 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.h
@@ -76,13 +76,6 @@ private:
QPoint hot;
};
-class QPlatformCursor;
-
-class Q_GUI_EXPORT QPlatformCursorPrivate {
-public:
- static QList<QPlatformCursor *> getInstances();
-};
-
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
QPlatformCursor();
@@ -96,7 +89,6 @@ public:
virtual void setPos(const QPoint &pos);
private:
- Q_DECLARE_PRIVATE(QPlatformCursor)
friend void qt_qpa_set_cursor(QWidget * w, bool force);
friend class QApplicationPrivate;
};
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 2cb9b8053f..73140b4f6f 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -448,6 +448,11 @@ void QWindowSystemInterface::unregisterTouchDevice(const QTouchDevice *device)
QTouchDevicePrivate::unregisterDevice(device);
}
+bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device)
+{
+ return QTouchDevicePrivate::isRegistered(device);
+}
+
void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 3e2e9803b8..e7e47ac6d9 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -134,6 +134,7 @@ public:
static void registerTouchDevice(const QTouchDevice *device);
static void unregisterTouchDevice(const QTouchDevice *device);
+ static bool isTouchDeviceRegistered(const QTouchDevice *device);
static void handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri
index bdda5381ce..2c3cca6b18 100644
--- a/src/gui/opengl/opengl.pri
+++ b/src/gui/opengl/opengl.pri
@@ -1,9 +1,9 @@
# Qt gui library, opengl module
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
-contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
+qtConfig(opengl(es2)?) {
HEADERS += opengl/qopengl.h \
opengl/qopengl_p.h \
@@ -58,7 +58,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengltexturehelper.cpp \
opengl/qopenglpixeltransferoptions.cpp
- !contains(QT_CONFIG, opengles2) {
+ !qtConfig(opengles2) {
HEADERS += opengl/qopenglfunctions_1_0.h \
opengl/qopenglfunctions_1_1.h \
opengl/qopenglfunctions_1_2.h \
@@ -117,7 +117,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) {
opengl/qopengltimerquery.cpp
}
- contains(QT_CONFIG, opengles2) {
+ qtConfig(opengles2) {
HEADERS += opengl/qopenglfunctions_es2.h
SOURCES += opengl/qopenglfunctions_es2.cpp
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 3e82d5a649..1ccd78d2ed 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1069,6 +1069,7 @@ bool QOpenGLFramebufferObject::bind()
d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo());
QOpenGLContextPrivate::get(current)->qgl_current_fbo_invalid = true;
+ QOpenGLContextPrivate::get(current)->qgl_current_fbo = this;
if (d->format.samples() == 0) {
// Create new textures to replace the ones stolen via takeTexture().
@@ -1108,7 +1109,9 @@ bool QOpenGLFramebufferObject::release()
if (current) {
d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->defaultFramebufferObject());
- QOpenGLContextPrivate::get(current)->qgl_current_fbo_invalid = true;
+ QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(current);
+ contextPrv->qgl_current_fbo_invalid = true;
+ contextPrv->qgl_current_fbo = Q_NULLPTR;
}
return true;
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 9fa224b0aa..54df2e5734 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -194,7 +194,7 @@ void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *co
Please note that some vendors, notably Apple, do not implement the
Compatibility profile. Therefore if you wish to target new OpenGL features
- on OS X then you should ensure that you request a Core profile context via
+ on \macos then you should ensure that you request a Core profile context via
QSurfaceFormat::setProfile().
Qt provides classes for all version and Core and Compatibility profile
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index d5e2e22799..24440c3c61 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -64,7 +64,7 @@ class QBlittablePrivate;
class Q_GUI_EXPORT QBlittable
{
- Q_DECLARE_PRIVATE(QBlittable);
+ Q_DECLARE_PRIVATE(QBlittable)
public:
enum Capability {
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 269e6f2d97..56180af693 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -527,9 +527,10 @@ QString QColor::name(NameFormat format) const
{
switch (format) {
case HexRgb:
- return QString::asprintf("#%02x%02x%02x", red(), green(), blue());
+ return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
case HexArgb:
- return QString::asprintf("#%02x%02x%02x%02x", alpha(), red(), green(), blue());
+ // it's called rgba() but it does return AARRGGBB
+ return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
}
return QString();
}
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index faeccf7b91..6cf3a8e262 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -264,6 +264,7 @@ private:
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColor &);
#endif
};
+Q_DECLARE_TYPEINFO(QColor, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_MOVABLE_TYPE : Q_RELOCATABLE_TYPE);
inline QColor::QColor() Q_DECL_NOTHROW
{ invalidate(); }
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
index 96f9620300..b4ade9dc58 100644
--- a/src/gui/painting/qcolor_p.cpp
+++ b/src/gui/painting/qcolor_p.cpp
@@ -40,31 +40,37 @@
#include "qglobal.h"
#include "qrgb.h"
#include "qstringlist.h"
+#include "private/qtools_p.h"
#include <algorithm>
QT_BEGIN_NAMESPACE
-static inline int h2i(char hex)
-{
- if (hex >= '0' && hex <= '9')
- return hex - '0';
- if (hex >= 'a' && hex <= 'f')
- return hex - 'a' + 10;
- if (hex >= 'A' && hex <= 'F')
- return hex - 'A' + 10;
- return -1;
-}
-
+/*!
+ \internal
+ If s[0..1] is a valid hex number, returns its integer value,
+ otherwise returns -1.
+ */
static inline int hex2int(const char *s)
{
- return (h2i(s[0]) << 4) | h2i(s[1]);
+ const int hi = QtMiscUtils::fromHex(s[0]);
+ if (hi < 0)
+ return -1;
+ const int lo = QtMiscUtils::fromHex(s[1]);
+ if (lo < 0)
+ return -1;
+ return (hi << 4) | lo;
}
+/*!
+ \internal
+ If s is a valid hex digit, returns its integer value,
+ multiplied by 0x11, otherwise returns -1.
+ */
static inline int hex2int(char s)
{
- int h = h2i(s);
- return (h << 4) | h;
+ const int h = QtMiscUtils::fromHex(s);
+ return h < 0 ? h : (h << 4) | h;
}
bool qt_get_hex_rgb(const char *name, QRgb *rgb)
@@ -130,7 +136,7 @@ bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
static const struct RGBData {
- const char *name;
+ const char name[21];
uint value;
} rgbTbl[] = {
{ "aliceblue", rgb(240, 248, 255) },
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 631584989a..77b5be0c4c 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
template <typename Type> class QDataBuffer
{
- Q_DISABLE_COPY(QDataBuffer);
+ Q_DISABLE_COPY(QDataBuffer)
public:
QDataBuffer(int res)
{
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 853855b148..a385332d6d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2180,6 +2180,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \
+ const qint64 min_fx = qint64(image_x1) * fixed_scale; \
+ const qint64 max_fx = qint64(image_x2) * fixed_scale; \
while (b < end) { \
int x1 = (fx >> 16); \
int x2; \
@@ -2195,11 +2197,11 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fx += fdx; \
++b; \
} \
- uint *boundedEnd; \
+ uint *boundedEnd = end; \
if (fdx > 0) \
- boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \
- else \
- boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
+ else if (fdx < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
boundedEnd -= 3;
#if defined(__SSE2__)
@@ -2336,6 +2338,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_ROTATE_BOUNDS_PROLOG \
+ const qint64 min_fx = qint64(image_x1) * fixed_scale; \
+ const qint64 max_fx = qint64(image_x2) * fixed_scale; \
+ const qint64 min_fy = qint64(image_y1) * fixed_scale; \
+ const qint64 max_fy = qint64(image_y2) * fixed_scale; \
while (b < end) { \
int x1 = (fx >> 16); \
int x2; \
@@ -2358,7 +2364,15 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fy += fdy; \
++b; \
} \
- uint *boundedEnd = end - 3; \
+ uint *boundedEnd = end; \
+ if (fdx > 0) \
+ boundedEnd = qMin(boundedEnd, b + (max_fx - fx) / fdx); \
+ else if (fdx < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fx - fx) / fdx); \
+ if (fdy > 0) \
+ boundedEnd = qMin(boundedEnd, b + (max_fy - fy) / fdy); \
+ else if (fdy < 0) \
+ boundedEnd = qMin(boundedEnd, b + (min_fy - fy) / fdy); \
boundedEnd -= 3;
#if defined(__SSE2__)
@@ -2377,15 +2391,6 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
while (b < boundedEnd) {
- if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
- break;
- if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
- break;
- if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
- break;
- if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
- break;
-
const __m128i vy = _mm_packs_epi32(_mm_srli_epi32(v_fy, 16), _mm_setzero_si128());
// 4x16bit * 4x16bit -> 4x32bit
__m128i offset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epi16(vy, vbpl));
@@ -2981,10 +2986,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
fx += fdx;
}
+ int fastLen;
+ if (fdx > 0)
+ fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11));
+ else
+ fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11));
+ fastLen -= 3;
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
- for (; i < len-3; i+=4) {
+ for (; i < fastLen; i += 4) {
int offset = _mm_extract_epi16(v_fx, 1);
sbuf1[i * 2 + 0] = ((const uint*)s1)[offset];
sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1];
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 2b850cfb2a..db3453898f 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -208,13 +208,13 @@
#define ONE_PIXEL ( 1L << PIXEL_BITS )
#define PIXEL_MASK ( -1L << PIXEL_BITS )
#define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) )
-#define SUBPIXELS( x ) ( (TPos)(x) << PIXEL_BITS )
+#define SUBPIXELS( x ) ( (TPos)(x) * ( 1 << PIXEL_BITS ) )
#define FLOOR( x ) ( (x) & -ONE_PIXEL )
#define CEILING( x ) ( ( (x) + ONE_PIXEL - 1 ) & -ONE_PIXEL )
#define ROUND( x ) ( ( (x) + ONE_PIXEL / 2 ) & -ONE_PIXEL )
#if PIXEL_BITS >= 6
-#define UPSCALE( x ) ( (x) << ( PIXEL_BITS - 6 ) )
+#define UPSCALE( x ) ( (x) * ( 1 << ( PIXEL_BITS - 6 ) ) )
#define DOWNSCALE( x ) ( (x) >> ( PIXEL_BITS - 6 ) )
#else
#define UPSCALE( x ) ( (x) >> ( 6 - PIXEL_BITS ) )
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
index f53285d9cb..8831d60d48 100644
--- a/src/gui/painting/qpagesize.cpp
+++ b/src/gui/painting/qpagesize.cpp
@@ -400,7 +400,7 @@ static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match
{
if (ppdKey.isEmpty())
return QPageSize::Custom;
- QString key = ppdKey;
+ QStringRef key(&ppdKey);
// Remove any Rotated or Tranverse modifiers
if (key.endsWith(QLatin1String("Rotated")))
key.chop(7);
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 020392409d..ddea168e72 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -155,7 +155,7 @@ QFont QTextItem::font() const
provided is the raster paint engine, which contains a software
rasterizer which supports the full feature set on all supported platforms.
This is the default for painting on QWidget-based classes in e.g. on Windows,
- X11 and OS X, it is the backend for painting on QImage and it is
+ X11 and \macos, it is the backend for painting on QImage and it is
used as a fallback for paint engines that do not support a certain
capability. In addition we provide QPaintEngine implementations for
OpenGL (accessible through QGLWidget) and printing (which allows using
@@ -372,8 +372,8 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw
\value X11
\value Windows
\value MacPrinter
- \value CoreGraphics OS X's Quartz2D (CoreGraphics)
- \value QuickDraw OS X's QuickDraw
+ \value CoreGraphics \macos's Quartz2D (CoreGraphics)
+ \value QuickDraw \macos's QuickDraw
\value QWindowSystem Qt for Embedded Linux
\value PostScript (No longer supported)
\value OpenGL
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 0aa2901b88..40f5347b26 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -63,7 +63,7 @@ class QBlittable;
class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine
{
- Q_DECLARE_PRIVATE(QBlitterPaintEngine);
+ Q_DECLARE_PRIVATE(QBlitterPaintEngine)
public:
QBlitterPaintEngine(QBlittablePlatformPixmap *p);
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index eca1cb590c..52501880e4 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
typedef int Q16Dot16;
#define Q16Dot16ToFloat(i) ((i)/65536.)
#define FloatToQ16Dot16(i) (int)((i) * 65536.)
-#define IntToQ16Dot16(i) ((i) << 16)
+#define IntToQ16Dot16(i) ((i) * (1 << 16))
#define Q16Dot16ToInt(i) ((i) >> 16)
#define Q16Dot16Factor 65536
@@ -612,7 +612,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6));
if (iTop <= iBottom) {
- Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x << 10) - rounding;
+ Q16Dot16 aFP = Q16Dot16Factor/2 + (a.x * (1 << 10)) - rounding;
if (b.x == a.x) {
Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding };
@@ -624,7 +624,7 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
Q16Dot16 xFP = aFP + Q16Dot16Multiply(slopeFP,
IntToQ16Dot16(iTop)
- + Q16Dot16Factor/2 - (a.y << 10));
+ + Q16Dot16Factor/2 - (a.y * (1 << 10)));
if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding))
return;
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index b39a23e7f2..1ba6345bf9 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1035,7 +1035,7 @@ QRegion QRegion::intersect(const QRect &r) const
sort key and X as the minor sort key.
\endlist
\omit
- Only some platforms have these restrictions (Qt for Embedded Linux, X11 and OS X).
+ Only some platforms have these restrictions (Qt for Embedded Linux, X11 and \macos).
\endomit
*/
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 72710553ef..4f0a071da8 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -178,6 +178,7 @@ Q_GUI_EXPORT
static const struct QRegionData shared_empty;
static void cleanUp(QRegionData *x);
};
+Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QRegion)
/*****************************************************************************
QRegion stream functions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 3e36a6d1c9..4548b6f8b9 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -403,8 +403,8 @@ ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette
LengthData ValueExtractor::lengthValue(const Value& v)
{
- QString s = v.variant.toString();
- s.reserve(s.length());
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
LengthData data;
data.unit = LengthData::None;
if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive))
@@ -1442,11 +1442,13 @@ bool Declaration::realValue(qreal *real, const char *unit) const
const Value &v = d->values.at(0);
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
qreal val = s.toDouble(&ok);
@@ -1459,11 +1461,13 @@ static bool intValueHelper(const QCss::Value &v, int *i, const char *unit)
{
if (unit && v.type != Value::Length)
return false;
- QString s = v.variant.toString();
+ const QString str = v.variant.toString();
+ QStringRef s(&str);
if (unit) {
- if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
+ const QLatin1String unitStr(unit);
+ if (!s.endsWith(unitStr, Qt::CaseInsensitive))
return false;
- s.chop(qstrlen(unit));
+ s.chop(unitStr.size());
}
bool ok = false;
int val = s.toInt(&ok);
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 37b8c22920..3b24039ea6 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -730,7 +730,7 @@ void QFont::setFamily(const QString &family)
Returns the requested font style name, it will be used to match the
font with irregular styles (that can't be normalized in other style
properties). It depends on system font support, thus only works for
- OS X and X11 so far. On Windows irregular styles will be added
+ \macos and X11 so far. On Windows irregular styles will be added
as separate font families so there is no need for this.
\sa setFamily(), setStyle()
@@ -825,7 +825,7 @@ int QFont::pointSize() const
\li Vertical hinting (light)
\li Full hinting
\row
- \li Cocoa on OS X
+ \li Cocoa on \macos
\li No hinting
\li No hinting
\li No hinting
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index cb1619e690..e8f29ce520 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2048,7 +2048,7 @@ bool QFontDatabase::hasFamily(const QString &family) const
Returns \c true if and only if the \a family font family is private.
- This happens, for instance, on OS X and iOS, where the system UI fonts are not
+ This happens, for instance, on \macos and iOS, where the system UI fonts are not
accessible to the user. For completeness, QFontDatabase::families() returns all
font families, including the private ones. You should use this function if you
are developing a font selection control in order to keep private fonts hidden.
@@ -2810,6 +2810,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
req.fallBackFamilies.clear();
}
+ Q_ASSERT(fe);
if (fe->symbol || (d->request.styleStrategy & QFont::NoFontMerging)) {
for (int i = 0; i < QChar::ScriptCount; ++i) {
if (!d->engineData->engines[i]) {
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index ca6d33c7aa..46f5e6c070 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1830,7 +1830,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
{
- if (glyph == Q_NULLPTR)
+ if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0)
return QImage();
QImage::Format format = QImage::Format_Invalid;
@@ -1878,11 +1878,15 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
+ const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0;
if (!cacheEnabled && glyph != &emptyGlyph) {
currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
delete glyph;
}
+ if (!glyphHasGeometry)
+ return Q_NULLPTR;
+
if (currentlyLockedAlphaMap.isNull())
return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 1fbe0ce9d1..8e6ffa5e94 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
also have accessors to some relevant data in the physical font.
QRawFont only provides support for the main font technologies: GDI and DirectWrite on Windows
- platforms, FreeType on Linux platforms and CoreText on OS X. For other
+ platforms, FreeType on Linux platforms and CoreText on \macos. For other
font back-ends, the APIs will be disabled.
QRawFont can be constructed in a number of ways:
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 1aaacdd00d..8a13455ee0 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1567,12 +1567,13 @@ void QTextEngine::validate() const
layoutData = new LayoutData();
if (block.docHandle()) {
layoutData->string = block.text();
- if (block.next().isValid()) {
- if (option.flags() & QTextOption::ShowLineAndParagraphSeparators)
- layoutData->string += QChar(0xb6);
- } else if (option.flags() & QTextOption::ShowDocumentTerminator) {
+ const bool nextBlockValid = block.next().isValid();
+ if (!nextBlockValid && option.flags() & QTextOption::ShowDocumentTerminator) {
layoutData->string += QChar(0xA7);
+ } else if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
+ layoutData->string += QLatin1Char(nextBlockValid ? 0xb6 : 0x20);
}
+
} else {
layoutData->string = text;
}
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 2109b15a85..8adeb3e659 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1335,7 +1335,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value WaveUnderline The text is underlined using a wave shaped line.
\value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle
style hint of the QApplication style. By default this is mapped to
- WaveUnderline, on OS X it is mapped to DashDotLine.
+ WaveUnderline, on \macos it is mapped to DashDotLine.
\sa Qt::PenStyle
*/
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 7cb89543ba..b68c36fd9e 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -498,11 +498,13 @@ QZipReader::FileInfo QZipPrivate::fillFileInfo(int index) const
// fix the file path, if broken (convert separators, eat leading and trailing ones)
fileInfo.filePath = QDir::fromNativeSeparators(fileInfo.filePath);
- while (!fileInfo.filePath.isEmpty() && (fileInfo.filePath.at(0) == QLatin1Char('.') || fileInfo.filePath.at(0) == QLatin1Char('/')))
- fileInfo.filePath = fileInfo.filePath.mid(1);
- while (!fileInfo.filePath.isEmpty() && fileInfo.filePath.at(fileInfo.filePath.size() - 1) == QLatin1Char('/'))
- fileInfo.filePath.chop(1);
+ QStringRef filePathRef(&fileInfo.filePath);
+ while (filePathRef.startsWith(QLatin1Char('.')) || filePathRef.startsWith(QLatin1Char('/')))
+ filePathRef = filePathRef.mid(1);
+ while (filePathRef.endsWith(QLatin1Char('/')))
+ filePathRef.chop(1);
+ fileInfo.filePath = filePathRef.toString();
return fileInfo;
}
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index be60ba72cc..3fe47a6645 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -85,7 +85,7 @@ SOURCES += \
HEADERS += \
text/qplatformfontdatabase.h
-contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) {
+qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
include($$PWD/../../3rdparty/harfbuzz_dependency.pri)
diff --git a/src/network/access/http2/http2frames.cpp b/src/network/access/http2/http2frames.cpp
index 55e9f93b19..978bee09b1 100644
--- a/src/network/access/http2/http2frames.cpp
+++ b/src/network/access/http2/http2frames.cpp
@@ -51,46 +51,125 @@ namespace Http2
// HTTP/2 frames are defined by RFC7540, clauses 4 and 6.
-FrameStatus validate_frame_header(FrameType type, FrameFlags flags, quint32 payloadSize)
+Frame::Frame()
+ : buffer(frameHeaderSize)
{
+}
+
+FrameType Frame::type() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+
+ if (int(buffer[3]) >= int(FrameType::LAST_FRAME_TYPE))
+ return FrameType::LAST_FRAME_TYPE;
+
+ return FrameType(buffer[3]);
+}
+
+quint32 Frame::streamID() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ return qFromBigEndian<quint32>(&buffer[5]);
+}
+
+FrameFlags Frame::flags() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ return FrameFlags(buffer[4]);
+}
+
+quint32 Frame::payloadSize() const
+{
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+ return buffer[0] << 16 | buffer[1] << 8 | buffer[2];
+}
+
+uchar Frame::padding() const
+{
+ Q_ASSERT(validateHeader() == FrameStatus::goodFrame);
+
+ if (!flags().testFlag(FrameFlag::PADDED))
+ return 0;
+
+ switch (type()) {
+ case FrameType::DATA:
+ case FrameType::PUSH_PROMISE:
+ case FrameType::HEADERS:
+ Q_ASSERT(buffer.size() > frameHeaderSize);
+ return buffer[frameHeaderSize];
+ default:
+ return 0;
+ }
+}
+
+bool Frame::priority(quint32 *streamID, uchar *weight) const
+{
+ Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
+
+ if (buffer.size() <= frameHeaderSize)
+ return false;
+
+ const uchar *src = &buffer[0] + frameHeaderSize;
+ if (type() == FrameType::HEADERS && flags().testFlag(FrameFlag::PADDED))
+ ++src;
+
+ if ((type() == FrameType::HEADERS && flags().testFlag(FrameFlag::PRIORITY))
+ || type() == FrameType::PRIORITY) {
+ if (streamID)
+ *streamID = qFromBigEndian<quint32>(src);
+ if (weight)
+ *weight = src[4];
+ return true;
+ }
+
+ return false;
+}
+
+FrameStatus Frame::validateHeader() const
+{
+ // Should be called only on a frame with
+ // a complete header.
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
+
+ const auto framePayloadSize = payloadSize();
// 4.2 Frame Size
- if (payloadSize > maxPayloadSize)
+ if (framePayloadSize > maxPayloadSize)
return FrameStatus::sizeError;
- switch (type) {
+ switch (type()) {
case FrameType::SETTINGS:
// SETTINGS ACK can not have any payload.
// The payload of a SETTINGS frame consists of zero
// or more parameters, each consisting of an unsigned
// 16-bit setting identifier and an unsigned 32-bit value.
// Thus the payload size must be a multiple of 6.
- if (flags.testFlag(FrameFlag::ACK) ? payloadSize : payloadSize % 6)
+ if (flags().testFlag(FrameFlag::ACK) ? framePayloadSize : framePayloadSize % 6)
return FrameStatus::sizeError;
break;
case FrameType::PRIORITY:
// 6.3 PRIORITY
- if (payloadSize != 5)
+ if (framePayloadSize != 5)
return FrameStatus::sizeError;
break;
case FrameType::PING:
// 6.7 PING
- if (payloadSize != 8)
+ if (framePayloadSize != 8)
return FrameStatus::sizeError;
break;
case FrameType::GOAWAY:
// 6.8 GOAWAY
- if (payloadSize < 8)
+ if (framePayloadSize < 8)
return FrameStatus::sizeError;
break;
case FrameType::RST_STREAM:
case FrameType::WINDOW_UPDATE:
// 6.4 RST_STREAM, 6.9 WINDOW_UPDATE
- if (payloadSize != 4)
+ if (framePayloadSize != 4)
return FrameStatus::sizeError;
break;
case FrameType::PUSH_PROMISE:
// 6.6 PUSH_PROMISE
- if (payloadSize < 4)
+ if (framePayloadSize < 4)
return FrameStatus::sizeError;
default:
// DATA/HEADERS/CONTINUATION will be verified
@@ -102,31 +181,37 @@ FrameStatus validate_frame_header(FrameType type, FrameFlags flags, quint32 payl
return FrameStatus::goodFrame;
}
-FrameStatus validate_frame_payload(FrameType type, FrameFlags flags,
- quint32 size, const uchar *src)
+FrameStatus Frame::validatePayload() const
{
- Q_ASSERT(!size || src);
+ // Should be called only on a complete frame with a valid header.
+ Q_ASSERT(validateHeader() == FrameStatus::goodFrame);
// Ignored, 5.1
- if (type == FrameType::LAST_FRAME_TYPE)
+ if (type() == FrameType::LAST_FRAME_TYPE)
return FrameStatus::goodFrame;
+ auto size = payloadSize();
+ Q_ASSERT(buffer.size() >= frameHeaderSize && size == buffer.size() - frameHeaderSize);
+
+ const uchar *src = size ? &buffer[0] + frameHeaderSize : nullptr;
+ const auto frameFlags = flags();
+ switch (type()) {
// 6.1 DATA, 6.2 HEADERS
- if (type == FrameType::DATA || type == FrameType::HEADERS) {
- if (flags.testFlag(FrameFlag::PADDED)) {
+ case FrameType::DATA:
+ case FrameType::HEADERS:
+ if (frameFlags.testFlag(FrameFlag::PADDED)) {
if (!size || size < src[0])
return FrameStatus::sizeError;
size -= src[0];
}
- if (type == FrameType::HEADERS && flags.testFlag(FrameFlag::PRIORITY)) {
+ if (type() == FrameType::HEADERS && frameFlags.testFlag(FrameFlag::PRIORITY)) {
if (size < 5)
return FrameStatus::sizeError;
}
- }
-
+ break;
// 6.6 PUSH_PROMISE
- if (type == FrameType::PUSH_PROMISE) {
- if (flags.testFlag(FrameFlag::PADDED)) {
+ case FrameType::PUSH_PROMISE:
+ if (frameFlags.testFlag(FrameFlag::PADDED)) {
if (!size || size < src[0])
return FrameStatus::sizeError;
size -= src[0];
@@ -134,284 +219,158 @@ FrameStatus validate_frame_payload(FrameType type, FrameFlags flags,
if (size < 4)
return FrameStatus::sizeError;
+ break;
+ default:
+ break;
}
return FrameStatus::goodFrame;
}
-FrameStatus validate_frame_payload(FrameType type, FrameFlags flags,
- const std::vector<uchar> &payload)
-{
- const uchar *src = payload.size() ? &payload[0] : nullptr;
- return validate_frame_payload(type, flags, quint32(payload.size()), src);
-}
-
-FrameReader::FrameReader(FrameReader &&rhs)
- : framePayload(std::move(rhs.framePayload))
+quint32 Frame::dataSize() const
{
- type = rhs.type;
- rhs.type = FrameType::LAST_FRAME_TYPE;
-
- flags = rhs.flags;
- rhs.flags = FrameFlag::EMPTY;
-
- streamID = rhs.streamID;
- rhs.streamID = 0;
+ Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
- payloadSize = rhs.payloadSize;
- rhs.payloadSize = 0;
+ quint32 size = payloadSize();
+ if (const uchar pad = padding()) {
+ // + 1 one for a byte with padding number itself:
+ size -= pad + 1;
+ }
- incompleteRead = rhs.incompleteRead;
- rhs.incompleteRead = false;
+ if (priority())
+ size -= 5;
- offset = rhs.offset;
- rhs.offset = 0;
+ return size;
}
-FrameReader &FrameReader::operator = (FrameReader &&rhs)
+const uchar *Frame::dataBegin() const
{
- framePayload = std::move(rhs.framePayload);
-
- type = rhs.type;
- rhs.type = FrameType::LAST_FRAME_TYPE;
-
- flags = rhs.flags;
- rhs.flags = FrameFlag::EMPTY;
-
- streamID = rhs.streamID;
- rhs.streamID = 0;
-
- payloadSize = rhs.payloadSize;
- rhs.payloadSize = 0;
+ Q_ASSERT(validatePayload() == FrameStatus::goodFrame);
+ if (buffer.size() <= frameHeaderSize)
+ return nullptr;
- incompleteRead = rhs.incompleteRead;
- rhs.incompleteRead = false;
+ const uchar *src = &buffer[0] + frameHeaderSize;
+ if (padding())
+ ++src;
- offset = rhs.offset;
- rhs.offset = 0;
+ if (priority())
+ src += 5;
- return *this;
+ return src;
}
FrameStatus FrameReader::read(QAbstractSocket &socket)
{
- if (!incompleteRead) {
+ if (offset < frameHeaderSize) {
if (!readHeader(socket))
return FrameStatus::incompleteFrame;
- const auto status = validate_frame_header(type, flags, payloadSize);
+ const auto status = frame.validateHeader();
if (status != FrameStatus::goodFrame) {
// No need to read any payload.
return status;
}
- if (Http2PredefinedParameters::maxFrameSize < payloadSize)
+ if (Http2PredefinedParameters::maxFrameSize < frame.payloadSize())
return FrameStatus::sizeError;
- framePayload.resize(payloadSize);
- offset = 0;
- }
-
- if (framePayload.size()) {
- if (!readPayload(socket))
- return FrameStatus::incompleteFrame;
- }
-
- return validate_frame_payload(type, flags, framePayload);
-}
-
-bool FrameReader::padded(uchar *pad) const
-{
- Q_ASSERT(pad);
-
- if (!flags.testFlag(FrameFlag::PADDED))
- return false;
-
- if (type == FrameType::DATA
- || type == FrameType::PUSH_PROMISE
- || type == FrameType::HEADERS) {
- Q_ASSERT(framePayload.size() >= 1);
- *pad = framePayload[0];
- return true;
- }
-
- return false;
-}
-
-bool FrameReader::priority(quint32 *streamID, uchar *weight) const
-{
- Q_ASSERT(streamID);
- Q_ASSERT(weight);
-
- if (!framePayload.size())
- return false;
-
- const uchar *src = &framePayload[0];
- if (type == FrameType::HEADERS && flags.testFlag(FrameFlag::PADDED))
- ++src;
-
- if ((type == FrameType::HEADERS && flags.testFlag(FrameFlag::PRIORITY))
- || type == FrameType::PRIORITY) {
- *streamID = qFromBigEndian<quint32>(src);
- *weight = src[4];
- return true;
+ frame.buffer.resize(frame.payloadSize() + frameHeaderSize);
}
- return false;
-}
+ if (offset < frame.buffer.size() && !readPayload(socket))
+ return FrameStatus::incompleteFrame;
-quint32 FrameReader::dataSize() const
-{
- quint32 size = quint32(framePayload.size());
- uchar pad = 0;
- if (padded(&pad)) {
- // + 1 one for a byte with padding number itself:
- size -= pad + 1;
- }
-
- quint32 dummyID = 0;
- uchar dummyW = 0;
- if (priority(&dummyID, &dummyW))
- size -= 5;
+ // Reset the offset, our frame can be re-used
+ // now (re-read):
+ offset = 0;
- return size;
-}
-
-const uchar *FrameReader::dataBegin() const
-{
- if (!framePayload.size())
- return nullptr;
-
- const uchar *src = &framePayload[0];
- uchar dummyPad = 0;
- if (padded(&dummyPad))
- ++src;
-
- quint32 dummyID = 0;
- uchar dummyW = 0;
- if (priority(&dummyID, &dummyW))
- src += 5;
-
- return src;
+ return frame.validatePayload();
}
bool FrameReader::readHeader(QAbstractSocket &socket)
{
- if (socket.bytesAvailable() < frameHeaderSize)
- return false;
-
- uchar src[frameHeaderSize] = {};
- socket.read(reinterpret_cast<char*>(src), frameHeaderSize);
-
- payloadSize = src[0] << 16 | src[1] << 8 | src[2];
+ Q_ASSERT(offset < frameHeaderSize);
- type = FrameType(src[3]);
- if (int(type) >= int(FrameType::LAST_FRAME_TYPE))
- type = FrameType::LAST_FRAME_TYPE; // To be ignored, 5.1
+ auto &buffer = frame.buffer;
+ if (buffer.size() < frameHeaderSize)
+ buffer.resize(frameHeaderSize);
- flags = FrameFlags(src[4]);
- streamID = qFromBigEndian<quint32>(src + 5);
+ const auto chunkSize = socket.read(reinterpret_cast<char *>(&buffer[offset]),
+ frameHeaderSize - offset);
+ if (chunkSize > 0)
+ offset += chunkSize;
- return true;
+ return offset == frameHeaderSize;
}
bool FrameReader::readPayload(QAbstractSocket &socket)
{
- Q_ASSERT(offset <= framePayload.size());
+ Q_ASSERT(offset < frame.buffer.size());
+ Q_ASSERT(frame.buffer.size() > frameHeaderSize);
+ auto &buffer = frame.buffer;
// Casts and ugliness - to deal with MSVC. Values are guaranteed to fit into quint32.
- if (const auto residue = std::min(qint64(framePayload.size() - offset), socket.bytesAvailable())) {
- socket.read(reinterpret_cast<char *>(&framePayload[offset]), residue);
- offset += quint32(residue);
- }
+ const auto chunkSize = socket.read(reinterpret_cast<char *>(&buffer[offset]),
+ qint64(buffer.size() - offset));
+ if (chunkSize > 0)
+ offset += quint32(chunkSize);
- incompleteRead = offset < framePayload.size();
- return !incompleteRead;
+ return offset == buffer.size();
}
-
FrameWriter::FrameWriter()
{
- frameBuffer.reserve(Http2PredefinedParameters::maxFrameSize +
- Http2PredefinedParameters::frameHeaderSize);
}
FrameWriter::FrameWriter(FrameType type, FrameFlags flags, quint32 streamID)
{
- frameBuffer.reserve(Http2PredefinedParameters::maxFrameSize +
- Http2PredefinedParameters::frameHeaderSize);
start(type, flags, streamID);
}
void FrameWriter::start(FrameType type, FrameFlags flags, quint32 streamID)
{
- frameBuffer.resize(frameHeaderSize);
+ auto &buffer = frame.buffer;
+
+ buffer.resize(frameHeaderSize);
// The first three bytes - payload size, which is 0 for now.
- frameBuffer[0] = 0;
- frameBuffer[1] = 0;
- frameBuffer[2] = 0;
+ buffer[0] = 0;
+ buffer[1] = 0;
+ buffer[2] = 0;
- frameBuffer[3] = uchar(type);
- frameBuffer[4] = uchar(flags);
+ buffer[3] = uchar(type);
+ buffer[4] = uchar(flags);
- qToBigEndian(streamID, &frameBuffer[5]);
+ qToBigEndian(streamID, &buffer[5]);
}
void FrameWriter::setPayloadSize(quint32 size)
{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
+ auto &buffer = frame.buffer;
+
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
Q_ASSERT(size < maxPayloadSize);
- frameBuffer[0] = size >> 16;
- frameBuffer[1] = size >> 8;
- frameBuffer[2] = size;
-}
-
-quint32 FrameWriter::payloadSize() const
-{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
- return frameBuffer[0] << 16 | frameBuffer[1] << 8 | frameBuffer[2];
+ buffer[0] = size >> 16;
+ buffer[1] = size >> 8;
+ buffer[2] = size;
}
void FrameWriter::setType(FrameType type)
{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
- frameBuffer[3] = uchar(type);
-}
-
-FrameType FrameWriter::type() const
-{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
- return FrameType(frameBuffer[3]);
+ Q_ASSERT(frame.buffer.size() >= frameHeaderSize);
+ frame.buffer[3] = uchar(type);
}
void FrameWriter::setFlags(FrameFlags flags)
{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
- frameBuffer[4] = uchar(flags);
+ Q_ASSERT(frame.buffer.size() >= frameHeaderSize);
+ frame.buffer[4] = uchar(flags);
}
void FrameWriter::addFlag(FrameFlag flag)
{
- setFlags(flags() | flag);
-}
-
-FrameFlags FrameWriter::flags() const
-{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
- return FrameFlags(frameBuffer[4]);
-}
-
-quint32 FrameWriter::streamID() const
-{
- return qFromBigEndian<quint32>(&frameBuffer[5]);
-}
-
-void FrameWriter::append(uchar val)
-{
- frameBuffer.push_back(val);
- updatePayloadSize();
+ setFlags(frame.flags() | flag);
}
void FrameWriter::append(const uchar *begin, const uchar *end)
@@ -419,64 +378,71 @@ void FrameWriter::append(const uchar *begin, const uchar *end)
Q_ASSERT(begin && end);
Q_ASSERT(begin < end);
- frameBuffer.insert(frameBuffer.end(), begin, end);
+ frame.buffer.insert(frame.buffer.end(), begin, end);
updatePayloadSize();
}
void FrameWriter::updatePayloadSize()
{
- // First, compute size:
- const quint32 payloadSize = quint32(frameBuffer.size() - frameHeaderSize);
- Q_ASSERT(payloadSize <= maxPayloadSize);
- setPayloadSize(payloadSize);
+ const quint32 size = quint32(frame.buffer.size() - frameHeaderSize);
+ Q_ASSERT(size <= maxPayloadSize);
+ setPayloadSize(size);
}
bool FrameWriter::write(QAbstractSocket &socket) const
{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
+ auto &buffer = frame.buffer;
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
// Do some sanity check first:
- Q_ASSERT(int(type()) < int(FrameType::LAST_FRAME_TYPE));
- Q_ASSERT(validate_frame_header(type(), flags(), payloadSize()) == FrameStatus::goodFrame);
- const auto nWritten = socket.write(reinterpret_cast<const char *>(&frameBuffer[0]),
- frameBuffer.size());
- return nWritten != -1 && size_type(nWritten) == frameBuffer.size();
+ Q_ASSERT(int(frame.type()) < int(FrameType::LAST_FRAME_TYPE));
+ Q_ASSERT(frame.validateHeader() == FrameStatus::goodFrame);
+
+ const auto nWritten = socket.write(reinterpret_cast<const char *>(&buffer[0]),
+ buffer.size());
+ return nWritten != -1 && size_type(nWritten) == buffer.size();
}
bool FrameWriter::writeHEADERS(QAbstractSocket &socket, quint32 sizeLimit)
{
- Q_ASSERT(frameBuffer.size() >= frameHeaderSize);
+ auto &buffer = frame.buffer;
+ Q_ASSERT(buffer.size() >= frameHeaderSize);
if (sizeLimit > quint32(maxPayloadSize))
sizeLimit = quint32(maxPayloadSize);
- if (quint32(frameBuffer.size() - frameHeaderSize) <= sizeLimit) {
+ if (quint32(buffer.size() - frameHeaderSize) <= sizeLimit) {
+ addFlag(FrameFlag::END_HEADERS);
updatePayloadSize();
return write(socket);
}
+ // Our HPACK block does not fit into the size limit, remove
+ // END_HEADERS bit from the first frame, we'll later set
+ // it on the last CONTINUATION frame:
+ setFlags(frame.flags() & ~FrameFlags(FrameFlag::END_HEADERS));
// Write a frame's header (not controlled by sizeLimit) and
// as many bytes of payload as we can within sizeLimit,
// then send CONTINUATION frames, as needed.
setPayloadSize(sizeLimit);
const quint32 firstChunkSize = frameHeaderSize + sizeLimit;
- qint64 written = socket.write(reinterpret_cast<const char *>(&frameBuffer[0]),
+ qint64 written = socket.write(reinterpret_cast<const char *>(&buffer[0]),
firstChunkSize);
if (written != qint64(firstChunkSize))
return false;
- FrameWriter continuationFrame(FrameType::CONTINUATION, FrameFlag::EMPTY, streamID());
+ FrameWriter continuationWriter(FrameType::CONTINUATION, FrameFlag::EMPTY, frame.streamID());
quint32 offset = firstChunkSize;
- while (offset != frameBuffer.size()) {
- const auto chunkSize = std::min(sizeLimit, quint32(frameBuffer.size() - offset));
- if (chunkSize + offset == frameBuffer.size())
- continuationFrame.addFlag(FrameFlag::END_HEADERS);
- continuationFrame.setPayloadSize(chunkSize);
- if (!continuationFrame.write(socket))
+ while (offset != buffer.size()) {
+ const auto chunkSize = std::min(sizeLimit, quint32(buffer.size() - offset));
+ if (chunkSize + offset == buffer.size())
+ continuationWriter.addFlag(FrameFlag::END_HEADERS);
+ continuationWriter.setPayloadSize(chunkSize);
+ if (!continuationWriter.write(socket))
return false;
- written = socket.write(reinterpret_cast<const char *>(&frameBuffer[offset]),
+ written = socket.write(reinterpret_cast<const char *>(&buffer[offset]),
chunkSize);
if (written != qint64(chunkSize))
return false;
@@ -524,6 +490,6 @@ bool FrameWriter::writeDATA(QAbstractSocket &socket, quint32 sizeLimit,
return true;
}
-}
+} // Namespace Http2
QT_END_NAMESPACE
diff --git a/src/network/access/http2/http2frames_p.h b/src/network/access/http2/http2frames_p.h
index 6abed315ca..84ba9c3662 100644
--- a/src/network/access/http2/http2frames_p.h
+++ b/src/network/access/http2/http2frames_p.h
@@ -68,52 +68,53 @@ class QAbstractSocket;
namespace Http2
{
-class Q_AUTOTEST_EXPORT FrameReader
+struct Q_AUTOTEST_EXPORT Frame
{
- friend class QT_PREPEND_NAMESPACE(QHttp2ProtocolHandler);
-
-public:
- FrameReader() = default;
-
- FrameReader(const FrameReader &) = default;
- FrameReader(FrameReader &&rhs);
-
- FrameReader &operator = (const FrameReader &) = default;
- FrameReader &operator = (FrameReader &&rhs);
-
- FrameStatus read(QAbstractSocket &socket);
+ Frame();
+ // Reading these values without first forming a valid frame
+ // (either reading it from a socket or building it) will result
+ // in undefined behavior:
+ FrameType type() const;
+ quint32 streamID() const;
+ FrameFlags flags() const;
+ quint32 payloadSize() const;
+ uchar padding() const;
+ // In HTTP/2 a stream's priority is specified by its weight
+ // and a stream (id) it depends on:
+ bool priority(quint32 *streamID = nullptr,
+ uchar *weight = nullptr) const;
- bool padded(uchar *pad) const;
- bool priority(quint32 *streamID, uchar *weight) const;
+ FrameStatus validateHeader() const;
+ FrameStatus validatePayload() const;
- // N of bytes without padding and/or priority
+ // Number of payload bytes without padding and/or priority
quint32 dataSize() const;
// Beginning of payload without priority/padding
// bytes.
const uchar *dataBegin() const;
- FrameType type = FrameType::LAST_FRAME_TYPE;
- FrameFlags flags = FrameFlag::EMPTY;
- quint32 streamID = 0;
- quint32 payloadSize = 0;
+ std::vector<uchar> buffer;
+};
+class Q_AUTOTEST_EXPORT FrameReader
+{
+public:
+ FrameStatus read(QAbstractSocket &socket);
+
+ Frame &inboundFrame()
+ {
+ return frame;
+ }
private:
bool readHeader(QAbstractSocket &socket);
bool readPayload(QAbstractSocket &socket);
- // As soon as we got a header, we
- // know payload size, offset is
- // needed if we do not have enough
- // data and will read the next chunk.
- bool incompleteRead = false;
quint32 offset = 0;
- std::vector<uchar> framePayload;
+ Frame frame;
};
class Q_AUTOTEST_EXPORT FrameWriter
{
- friend class QT_PREPEND_NAMESPACE(QHttp2ProtocolHandler);
-
public:
using payload_type = std::vector<uchar>;
using size_type = payload_type::size_type;
@@ -121,19 +122,17 @@ public:
FrameWriter();
FrameWriter(FrameType type, FrameFlags flags, quint32 streamID);
- void start(FrameType type, FrameFlags flags, quint32 streamID);
+ Frame &outboundFrame()
+ {
+ return frame;
+ }
+ // Frame 'builders':
+ void start(FrameType type, FrameFlags flags, quint32 streamID);
void setPayloadSize(quint32 size);
- quint32 payloadSize() const;
-
void setType(FrameType type);
- FrameType type() const;
-
void setFlags(FrameFlags flags);
void addFlag(FrameFlag flag);
- FrameFlags flags() const;
-
- quint32 streamID() const;
// All append functions also update frame's payload
// length.
@@ -144,7 +143,11 @@ public:
qToBigEndian(val, wired);
append(wired, wired + sizeof val);
}
- void append(uchar val);
+ void append(uchar val)
+ {
+ frame.buffer.push_back(val);
+ updatePayloadSize();
+ }
void append(Settings identifier)
{
append(quint16(identifier));
@@ -156,25 +159,23 @@ public:
void append(const uchar *begin, const uchar *end);
- // Write 'frameBuffer' as a single frame:
+ // Write as a single frame:
bool write(QAbstractSocket &socket) const;
- // Write as a single frame if we can, or write headers and
- // CONTINUATION(s) frame(s).
+ // Two types of frames we are sending are affected by
+ // frame size limits: HEADERS and DATA. HEADERS' payload
+ // (hpacked HTTP headers, following a frame header)
+ // is always in our 'buffer', we send the initial HEADERS
+ // frame first and then CONTINUTATION frame(s) if needed:
bool writeHEADERS(QAbstractSocket &socket, quint32 sizeLimit);
- // Write either a single DATA frame or several DATA frames
- // depending on 'sizeLimit'. Data itself is 'external' to
- // FrameWriter, since it's a 'readPointer' from QNonContiguousData.
+ // With DATA frames the actual payload is never in our 'buffer',
+ // it's a 'readPointer' from QNonContiguousData. We split
+ // this payload as needed into DATA frames with correct
+ // payload size fitting into frame size limit:
bool writeDATA(QAbstractSocket &socket, quint32 sizeLimit,
const uchar *src, quint32 size);
-
- std::vector<uchar> &rawFrameBuffer()
- {
- return frameBuffer;
- }
-
private:
void updatePayloadSize();
- std::vector<uchar> frameBuffer;
+ Frame frame;
};
}
diff --git a/src/network/access/http2/http2streams.cpp b/src/network/access/http2/http2streams.cpp
index f57f8d8367..660100f5e4 100644
--- a/src/network/access/http2/http2streams.cpp
+++ b/src/network/access/http2/http2streams.cpp
@@ -49,6 +49,10 @@ QT_BEGIN_NAMESPACE
namespace Http2
{
+Stream::Stream()
+{
+}
+
Stream::Stream(const HttpMessagePair &message, quint32 id, qint32 sendSize, qint32 recvSize)
: httpPair(message),
streamID(id),
diff --git a/src/network/access/http2/http2streams_p.h b/src/network/access/http2/http2streams_p.h
index 5d9a6ab512..8a825a5457 100644
--- a/src/network/access/http2/http2streams_p.h
+++ b/src/network/access/http2/http2streams_p.h
@@ -73,11 +73,10 @@ struct Q_AUTOTEST_EXPORT Stream
closed
};
- Stream() = default;
+ Stream();
Stream(const HttpMessagePair &message, quint32 streamID, qint32 sendSize,
qint32 recvSize);
- // TODO: check includes!!!
QHttpNetworkReply *reply() const;
const QHttpNetworkRequest &request() const;
QHttpNetworkRequest &request();
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index 937686920c..68a00c6837 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -40,7 +40,7 @@
#include "qhttpnetworkconnection_p.h"
#include "qhttp2protocolhandler_p.h"
-#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#if !defined(QT_NO_HTTP)
#include "http2/bitstreams_p.h"
@@ -170,64 +170,63 @@ void QHttp2ProtocolHandler::_q_receiveReply()
Q_ASSERT(m_socket);
Q_ASSERT(m_channel);
- const auto result = inboundFrame.read(*m_socket);
- switch (result) {
- case FrameStatus::incompleteFrame:
- return;
- case FrameStatus::protocolError:
- return connectionError(PROTOCOL_ERROR, "invalid frame");
- case FrameStatus::sizeError:
- return connectionError(FRAME_SIZE_ERROR, "invalid frame size");
- default:
- break;
- }
+ do {
+ const auto result = frameReader.read(*m_socket);
+ switch (result) {
+ case FrameStatus::incompleteFrame:
+ return;
+ case FrameStatus::protocolError:
+ return connectionError(PROTOCOL_ERROR, "invalid frame");
+ case FrameStatus::sizeError:
+ return connectionError(FRAME_SIZE_ERROR, "invalid frame size");
+ default:
+ break;
+ }
- Q_ASSERT(result == FrameStatus::goodFrame);
+ Q_ASSERT(result == FrameStatus::goodFrame);
- if (continuationExpected && inboundFrame.type != FrameType::CONTINUATION)
- return connectionError(PROTOCOL_ERROR, "CONTINUATION expected");
+ inboundFrame = std::move(frameReader.inboundFrame());
- switch (inboundFrame.type) {
- case FrameType::DATA:
- handleDATA();
- break;
- case FrameType::HEADERS:
- handleHEADERS();
- break;
- case FrameType::PRIORITY:
- handlePRIORITY();
- break;
- case FrameType::RST_STREAM:
- handleRST_STREAM();
- break;
- case FrameType::SETTINGS:
- handleSETTINGS();
- break;
- case FrameType::PUSH_PROMISE:
- handlePUSH_PROMISE();
- break;
- case FrameType::PING:
- handlePING();
- break;
- case FrameType::GOAWAY:
- handleGOAWAY();
- break;
- case FrameType::WINDOW_UPDATE:
- handleWINDOW_UPDATE();
- break;
- case FrameType::CONTINUATION:
- handleCONTINUATION();
- break;
- case FrameType::LAST_FRAME_TYPE:
- // 5.1 - ignore unknown frames.
- break;
- }
-
- if (goingAway && !activeStreams.size())
- return;
+ const auto frameType = inboundFrame.type();
+ if (continuationExpected && frameType != FrameType::CONTINUATION)
+ return connectionError(PROTOCOL_ERROR, "CONTINUATION expected");
- if (m_socket->bytesAvailable())
- QMetaObject::invokeMethod(m_channel, "_q_receiveReply", Qt::QueuedConnection);
+ switch (frameType) {
+ case FrameType::DATA:
+ handleDATA();
+ break;
+ case FrameType::HEADERS:
+ handleHEADERS();
+ break;
+ case FrameType::PRIORITY:
+ handlePRIORITY();
+ break;
+ case FrameType::RST_STREAM:
+ handleRST_STREAM();
+ break;
+ case FrameType::SETTINGS:
+ handleSETTINGS();
+ break;
+ case FrameType::PUSH_PROMISE:
+ handlePUSH_PROMISE();
+ break;
+ case FrameType::PING:
+ handlePING();
+ break;
+ case FrameType::GOAWAY:
+ handleGOAWAY();
+ break;
+ case FrameType::WINDOW_UPDATE:
+ handleWINDOW_UPDATE();
+ break;
+ case FrameType::CONTINUATION:
+ handleCONTINUATION();
+ break;
+ case FrameType::LAST_FRAME_TYPE:
+ // 5.1 - ignore unknown frames.
+ break;
+ }
+ } while (!goingAway || activeStreams.size());
}
bool QHttp2ProtocolHandler::sendRequest()
@@ -293,14 +292,14 @@ bool QHttp2ProtocolHandler::sendClientPreface()
return false;
// 6.5 SETTINGS
- outboundFrame.start(FrameType::SETTINGS, FrameFlag::EMPTY, Http2::connectionStreamID);
+ frameWriter.start(FrameType::SETTINGS, FrameFlag::EMPTY, Http2::connectionStreamID);
// MAX frame size (16 kb), disable PUSH
- outboundFrame.append(Settings::MAX_FRAME_SIZE_ID);
- outboundFrame.append(quint32(Http2::maxFrameSize));
- outboundFrame.append(Settings::ENABLE_PUSH_ID);
- outboundFrame.append(quint32(0));
+ frameWriter.append(Settings::MAX_FRAME_SIZE_ID);
+ frameWriter.append(quint32(Http2::maxFrameSize));
+ frameWriter.append(Settings::ENABLE_PUSH_ID);
+ frameWriter.append(quint32(0));
- if (!outboundFrame.write(*m_socket))
+ if (!frameWriter.write(*m_socket))
return false;
sessionRecvWindowSize = sessionMaxRecvWindowSize;
@@ -323,38 +322,38 @@ bool QHttp2ProtocolHandler::sendSETTINGS_ACK()
if (!prefaceSent && !sendClientPreface())
return false;
- outboundFrame.start(FrameType::SETTINGS, FrameFlag::ACK, Http2::connectionStreamID);
+ frameWriter.start(FrameType::SETTINGS, FrameFlag::ACK, Http2::connectionStreamID);
- return outboundFrame.write(*m_socket);
+ return frameWriter.write(*m_socket);
}
bool QHttp2ProtocolHandler::sendHEADERS(Stream &stream)
{
using namespace HPack;
- outboundFrame.start(FrameType::HEADERS, FrameFlag::PRIORITY | FrameFlag::END_HEADERS,
- stream.streamID);
+ frameWriter.start(FrameType::HEADERS, FrameFlag::PRIORITY | FrameFlag::END_HEADERS,
+ stream.streamID);
if (!stream.data()) {
- outboundFrame.addFlag(FrameFlag::END_STREAM);
+ frameWriter.addFlag(FrameFlag::END_STREAM);
stream.state = Stream::halfClosedLocal;
} else {
stream.state = Stream::open;
}
- outboundFrame.append(quint32()); // No stream dependency in Qt.
- outboundFrame.append(stream.weight());
+ frameWriter.append(quint32()); // No stream dependency in Qt.
+ frameWriter.append(stream.weight());
const auto headers = build_headers(stream.request(), maxHeaderListSize);
if (!headers.size()) // nothing fits into maxHeaderListSize
return false;
// Compress in-place:
- BitOStream outputStream(outboundFrame.frameBuffer);
+ BitOStream outputStream(frameWriter.outboundFrame().buffer);
if (!encoder.encodeRequest(outputStream, headers))
return false;
- return outboundFrame.writeHEADERS(*m_socket, maxFrameSize);
+ return frameWriter.writeHEADERS(*m_socket, maxFrameSize);
}
bool QHttp2ProtocolHandler::sendDATA(Stream &stream)
@@ -384,10 +383,10 @@ bool QHttp2ProtocolHandler::sendDATA(Stream &stream)
return true;
}
- outboundFrame.start(FrameType::DATA, FrameFlag::EMPTY, stream.streamID);
+ frameWriter.start(FrameType::DATA, FrameFlag::EMPTY, stream.streamID);
const qint32 bytesWritten = std::min<qint32>(slot, chunkSize);
- if (!outboundFrame.writeDATA(*m_socket, maxFrameSize, src, bytesWritten))
+ if (!frameWriter.writeDATA(*m_socket, maxFrameSize, src, bytesWritten))
return false;
stream.data()->advanceReadPointer(bytesWritten);
@@ -400,9 +399,9 @@ bool QHttp2ProtocolHandler::sendDATA(Stream &stream)
}
if (replyPrivate->totallyUploadedData == request.contentLength()) {
- outboundFrame.start(FrameType::DATA, FrameFlag::END_STREAM, stream.streamID);
- outboundFrame.setPayloadSize(0);
- outboundFrame.write(*m_socket);
+ frameWriter.start(FrameType::DATA, FrameFlag::END_STREAM, stream.streamID);
+ frameWriter.setPayloadSize(0);
+ frameWriter.write(*m_socket);
stream.state = Stream::halfClosedLocal;
stream.data()->disconnect(this);
removeFromSuspended(stream.streamID);
@@ -417,61 +416,61 @@ bool QHttp2ProtocolHandler::sendWINDOW_UPDATE(quint32 streamID, quint32 delta)
{
Q_ASSERT(m_socket);
- outboundFrame.start(FrameType::WINDOW_UPDATE, FrameFlag::EMPTY, streamID);
- outboundFrame.append(delta);
- return outboundFrame.write(*m_socket);
+ frameWriter.start(FrameType::WINDOW_UPDATE, FrameFlag::EMPTY, streamID);
+ frameWriter.append(delta);
+ return frameWriter.write(*m_socket);
}
bool QHttp2ProtocolHandler::sendRST_STREAM(quint32 streamID, quint32 errorCode)
{
Q_ASSERT(m_socket);
- outboundFrame.start(FrameType::RST_STREAM, FrameFlag::EMPTY, streamID);
- outboundFrame.append(errorCode);
- return outboundFrame.write(*m_socket);
+ frameWriter.start(FrameType::RST_STREAM, FrameFlag::EMPTY, streamID);
+ frameWriter.append(errorCode);
+ return frameWriter.write(*m_socket);
}
bool QHttp2ProtocolHandler::sendGOAWAY(quint32 errorCode)
{
Q_ASSERT(m_socket);
- outboundFrame.start(FrameType::GOAWAY, FrameFlag::EMPTY, connectionStreamID);
- outboundFrame.append(quint32(connectionStreamID));
- outboundFrame.append(errorCode);
- return outboundFrame.write(*m_socket);
+ frameWriter.start(FrameType::GOAWAY, FrameFlag::EMPTY, connectionStreamID);
+ frameWriter.append(quint32(connectionStreamID));
+ frameWriter.append(errorCode);
+ return frameWriter.write(*m_socket);
}
void QHttp2ProtocolHandler::handleDATA()
{
- Q_ASSERT(inboundFrame.type == FrameType::DATA);
+ Q_ASSERT(inboundFrame.type() == FrameType::DATA);
- const auto streamID = inboundFrame.streamID;
+ const auto streamID = inboundFrame.streamID();
if (streamID == connectionStreamID)
return connectionError(PROTOCOL_ERROR, "DATA on stream 0x0");
if (!activeStreams.contains(streamID) && !streamWasReset(streamID))
return connectionError(ENHANCE_YOUR_CALM, "DATA on invalid stream");
- if (qint32(inboundFrame.payloadSize) > sessionRecvWindowSize)
+ if (qint32(inboundFrame.payloadSize()) > sessionRecvWindowSize)
return connectionError(FLOW_CONTROL_ERROR, "Flow control error");
- sessionRecvWindowSize -= inboundFrame.payloadSize;
+ sessionRecvWindowSize -= inboundFrame.payloadSize();
if (activeStreams.contains(streamID)) {
auto &stream = activeStreams[streamID];
- if (qint32(inboundFrame.payloadSize) > stream.recvWindow) {
+ if (qint32(inboundFrame.payloadSize()) > stream.recvWindow) {
finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError,
QLatin1String("flow control error"));
sendRST_STREAM(streamID, FLOW_CONTROL_ERROR);
markAsReset(streamID);
deleteActiveStream(streamID);
} else {
- stream.recvWindow -= inboundFrame.payloadSize;
+ stream.recvWindow -= inboundFrame.payloadSize();
// Uncompress data if needed and append it ...
updateStream(stream, inboundFrame);
- if (inboundFrame.flags.testFlag(FrameFlag::END_STREAM)) {
+ if (inboundFrame.flags().testFlag(FrameFlag::END_STREAM)) {
finishStream(stream);
deleteActiveStream(stream.streamID);
} else if (stream.recvWindow < streamInitialRecvWindowSize / 2) {
@@ -493,22 +492,23 @@ void QHttp2ProtocolHandler::handleDATA()
void QHttp2ProtocolHandler::handleHEADERS()
{
- Q_ASSERT(inboundFrame.type == FrameType::HEADERS);
+ Q_ASSERT(inboundFrame.type() == FrameType::HEADERS);
- const auto streamID = inboundFrame.streamID;
+ const auto streamID = inboundFrame.streamID();
if (streamID == connectionStreamID)
return connectionError(PROTOCOL_ERROR, "HEADERS on 0x0 stream");
if (!activeStreams.contains(streamID) && !streamWasReset(streamID))
return connectionError(ENHANCE_YOUR_CALM, "HEADERS on invalid stream");
- if (inboundFrame.flags.testFlag(FrameFlag::PRIORITY)) {
+ const auto flags = inboundFrame.flags();
+ if (flags.testFlag(FrameFlag::PRIORITY)) {
handlePRIORITY();
if (goingAway)
return;
}
- const bool endHeaders = inboundFrame.flags.testFlag(FrameFlag::END_HEADERS);
+ const bool endHeaders = flags.testFlag(FrameFlag::END_HEADERS);
continuedFrames.clear();
continuedFrames.push_back(std::move(inboundFrame));
if (!endHeaders) {
@@ -521,10 +521,10 @@ void QHttp2ProtocolHandler::handleHEADERS()
void QHttp2ProtocolHandler::handlePRIORITY()
{
- Q_ASSERT(inboundFrame.type == FrameType::PRIORITY ||
- inboundFrame.type == FrameType::HEADERS);
+ Q_ASSERT(inboundFrame.type() == FrameType::PRIORITY ||
+ inboundFrame.type() == FrameType::HEADERS);
- const auto streamID = inboundFrame.streamID;
+ const auto streamID = inboundFrame.streamID();
if (streamID == connectionStreamID)
return connectionError(PROTOCOL_ERROR, "PIRORITY on 0x0 stream");
@@ -548,37 +548,38 @@ void QHttp2ProtocolHandler::handlePRIORITY()
void QHttp2ProtocolHandler::handleRST_STREAM()
{
- Q_ASSERT(inboundFrame.type == FrameType::RST_STREAM);
+ Q_ASSERT(inboundFrame.type() == FrameType::RST_STREAM);
// "RST_STREAM frames MUST be associated with a stream.
// If a RST_STREAM frame is received with a stream identifier of 0x0,
// the recipient MUST treat this as a connection error (Section 5.4.1)
// of type PROTOCOL_ERROR.
- if (inboundFrame.streamID == connectionStreamID)
+ const auto streamID = inboundFrame.streamID();
+ if (streamID == connectionStreamID)
return connectionError(PROTOCOL_ERROR, "RST_STREAM on 0x0");
- if (!(inboundFrame.streamID & 0x1)) {
+ if (!(streamID & 0x1)) {
// RST_STREAM on a promised stream:
// since we do not keep track of such streams,
// just ignore.
return;
}
- if (inboundFrame.streamID >= nextID) {
+ if (streamID >= nextID) {
// "RST_STREAM frames MUST NOT be sent for a stream
// in the "idle" state. .. the recipient MUST treat this
// as a connection error (Section 5.4.1) of type PROTOCOL_ERROR."
return connectionError(PROTOCOL_ERROR, "RST_STREAM on idle stream");
}
- if (!activeStreams.contains(inboundFrame.streamID)) {
+ if (!activeStreams.contains(streamID)) {
// 'closed' stream, ignore.
return;
}
Q_ASSERT(inboundFrame.dataSize() == 4);
- Stream &stream = activeStreams[inboundFrame.streamID];
+ Stream &stream = activeStreams[streamID];
finishStreamWithError(stream, qFromBigEndian<quint32>(inboundFrame.dataBegin()));
markAsReset(stream.streamID);
deleteActiveStream(stream.streamID);
@@ -587,12 +588,12 @@ void QHttp2ProtocolHandler::handleRST_STREAM()
void QHttp2ProtocolHandler::handleSETTINGS()
{
// 6.5 SETTINGS.
- Q_ASSERT(inboundFrame.type == FrameType::SETTINGS);
+ Q_ASSERT(inboundFrame.type() == FrameType::SETTINGS);
- if (inboundFrame.streamID != connectionStreamID)
+ if (inboundFrame.streamID() != connectionStreamID)
return connectionError(PROTOCOL_ERROR, "SETTINGS on invalid stream");
- if (inboundFrame.flags.testFlag(FrameFlag::ACK)) {
+ if (inboundFrame.flags().testFlag(FrameFlag::ACK)) {
if (!waitingForSettingsACK)
return connectionError(PROTOCOL_ERROR, "unexpected SETTINGS ACK");
waitingForSettingsACK = false;
@@ -618,7 +619,7 @@ void QHttp2ProtocolHandler::handleSETTINGS()
void QHttp2ProtocolHandler::handlePUSH_PROMISE()
{
// 6.6 PUSH_PROMISE.
- Q_ASSERT(inboundFrame.type == FrameType::PUSH_PROMISE);
+ Q_ASSERT(inboundFrame.type() == FrameType::PUSH_PROMISE);
if (prefaceSent && !waitingForSettingsACK) {
// This means, server ACKed our 'NO PUSH',
@@ -626,7 +627,7 @@ void QHttp2ProtocolHandler::handlePUSH_PROMISE()
return connectionError(PROTOCOL_ERROR, "unexpected PUSH_PROMISE frame");
}
- const auto streamID = inboundFrame.streamID;
+ const auto streamID = inboundFrame.streamID();
if (streamID == connectionStreamID) {
return connectionError(PROTOCOL_ERROR,
"PUSH_PROMISE with invalid associated stream (0x0)");
@@ -648,7 +649,7 @@ void QHttp2ProtocolHandler::handlePUSH_PROMISE()
sendRST_STREAM(reservedID, REFUSE_STREAM);
markAsReset(reservedID);
- const bool endHeaders = inboundFrame.flags.testFlag(FrameFlag::END_HEADERS);
+ const bool endHeaders = inboundFrame.flags().testFlag(FrameFlag::END_HEADERS);
continuedFrames.clear();
continuedFrames.push_back(std::move(inboundFrame));
@@ -664,30 +665,30 @@ void QHttp2ProtocolHandler::handlePING()
{
// Since we're implementing a client and not
// a server, we only reply to a PING, ACKing it.
- Q_ASSERT(inboundFrame.type == FrameType::PING);
+ Q_ASSERT(inboundFrame.type() == FrameType::PING);
Q_ASSERT(m_socket);
- if (inboundFrame.streamID != connectionStreamID)
+ if (inboundFrame.streamID() != connectionStreamID)
return connectionError(PROTOCOL_ERROR, "PING on invalid stream");
- if (inboundFrame.flags & FrameFlag::ACK)
+ if (inboundFrame.flags() & FrameFlag::ACK)
return connectionError(PROTOCOL_ERROR, "unexpected PING ACK");
Q_ASSERT(inboundFrame.dataSize() == 8);
- outboundFrame.start(FrameType::PING, FrameFlag::ACK, connectionStreamID);
- outboundFrame.append(inboundFrame.dataBegin(), inboundFrame.dataBegin() + 8);
- outboundFrame.write(*m_socket);
+ frameWriter.start(FrameType::PING, FrameFlag::ACK, connectionStreamID);
+ frameWriter.append(inboundFrame.dataBegin(), inboundFrame.dataBegin() + 8);
+ frameWriter.write(*m_socket);
}
void QHttp2ProtocolHandler::handleGOAWAY()
{
// 6.8 GOAWAY
- Q_ASSERT(inboundFrame.type == FrameType::GOAWAY);
+ Q_ASSERT(inboundFrame.type() == FrameType::GOAWAY);
// "An endpoint MUST treat a GOAWAY frame with a stream identifier
// other than 0x0 as a connection error (Section 5.4.1) of type PROTOCOL_ERROR."
- if (inboundFrame.streamID != connectionStreamID)
+ if (inboundFrame.streamID() != connectionStreamID)
return connectionError(PROTOCOL_ERROR, "GOAWAY on invalid stream");
const auto src = inboundFrame.dataBegin();
@@ -740,12 +741,12 @@ void QHttp2ProtocolHandler::handleGOAWAY()
void QHttp2ProtocolHandler::handleWINDOW_UPDATE()
{
- Q_ASSERT(inboundFrame.type == FrameType::WINDOW_UPDATE);
+ Q_ASSERT(inboundFrame.type() == FrameType::WINDOW_UPDATE);
const quint32 delta = qFromBigEndian<quint32>(inboundFrame.dataBegin());
const bool valid = delta && delta <= quint32(std::numeric_limits<qint32>::max());
- const auto streamID = inboundFrame.streamID;
+ const auto streamID = inboundFrame.streamID();
if (streamID == Http2::connectionStreamID) {
if (!valid || sum_will_overflow(sessionSendWindowSize, delta))
@@ -776,13 +777,13 @@ void QHttp2ProtocolHandler::handleWINDOW_UPDATE()
void QHttp2ProtocolHandler::handleCONTINUATION()
{
- Q_ASSERT(inboundFrame.type == FrameType::CONTINUATION);
+ Q_ASSERT(inboundFrame.type() == FrameType::CONTINUATION);
Q_ASSERT(continuedFrames.size()); // HEADERS frame must be already in.
- if (inboundFrame.streamID != continuedFrames.front().streamID)
+ if (inboundFrame.streamID() != continuedFrames.front().streamID())
return connectionError(PROTOCOL_ERROR, "CONTINUATION on invalid stream");
- const bool endHeaders = inboundFrame.flags.testFlag(FrameFlag::END_HEADERS);
+ const bool endHeaders = inboundFrame.flags().testFlag(FrameFlag::END_HEADERS);
continuedFrames.push_back(std::move(inboundFrame));
if (!endHeaders)
@@ -796,9 +797,9 @@ void QHttp2ProtocolHandler::handleContinuedHEADERS()
{
Q_ASSERT(continuedFrames.size());
- const auto streamID = continuedFrames[0].streamID;
+ const auto streamID = continuedFrames[0].streamID();
- if (continuedFrames[0].type == FrameType::HEADERS) {
+ if (continuedFrames[0].type() == FrameType::HEADERS) {
if (activeStreams.contains(streamID)) {
Stream &stream = activeStreams[streamID];
if (stream.state != Stream::halfClosedLocal) {
@@ -841,11 +842,11 @@ void QHttp2ProtocolHandler::handleContinuedHEADERS()
if (!decoder.decodeHeaderFields(inputStream))
return connectionError(COMPRESSION_ERROR, "HPACK decompression failed");
- if (continuedFrames[0].type == FrameType::HEADERS) {
+ if (continuedFrames[0].type() == FrameType::HEADERS) {
if (activeStreams.contains(streamID)) {
Stream &stream = activeStreams[streamID];
updateStream(stream, decoder.decodedHeader());
- if (continuedFrames[0].flags & FrameFlag::END_STREAM) {
+ if (continuedFrames[0].flags() & FrameFlag::END_STREAM) {
finishStream(stream);
deleteActiveStream(stream.streamID);
}
@@ -953,9 +954,9 @@ void QHttp2ProtocolHandler::updateStream(Stream &stream, const HPack::HttpHeader
emit httpReply->headerChanged();
}
-void QHttp2ProtocolHandler::updateStream(Stream &stream, const Http2::FrameReader &frame)
+void QHttp2ProtocolHandler::updateStream(Stream &stream, const Frame &frame)
{
- Q_ASSERT(frame.type == FrameType::DATA);
+ Q_ASSERT(frame.type() == FrameType::DATA);
if (const auto length = frame.dataSize()) {
const char *data = reinterpret_cast<const char *>(frame.dataBegin());
@@ -1214,4 +1215,4 @@ void QHttp2ProtocolHandler::closeSession()
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#endif // !defined(QT_NO_HTTP)
diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h
index b146e37dd3..92c6851078 100644
--- a/src/network/access/qhttp2protocolhandler_p.h
+++ b/src/network/access/qhttp2protocolhandler_p.h
@@ -55,7 +55,7 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkrequest_p.h>
-#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#if !defined(QT_NO_HTTP)
#include "http2/http2protocol_p.h"
#include "http2/http2streams_p.h"
@@ -124,7 +124,7 @@ private:
bool acceptSetting(Http2::Settings identifier, quint32 newValue);
void updateStream(Stream &stream, const HPack::HttpHeader &headers);
- void updateStream(Stream &stream, const Http2::FrameReader &dataFrame);
+ void updateStream(Stream &stream, const Http2::Frame &dataFrame);
void finishStream(Stream &stream);
// Error code send by a peer (GOAWAY/RST_STREAM):
void finishStreamWithError(Stream &stream, quint32 errorCode);
@@ -161,12 +161,13 @@ private:
// Peer's max frame size.
quint32 maxFrameSize = Http2::maxFrameSize;
- Http2::FrameReader inboundFrame;
- Http2::FrameWriter outboundFrame;
+ Http2::FrameReader frameReader;
+ Http2::Frame inboundFrame;
+ Http2::FrameWriter frameWriter;
// Temporary storage to assemble HEADERS' block
// from several CONTINUATION frames ...
bool continuationExpected = false;
- std::vector<Http2::FrameReader> continuedFrames;
+ std::vector<Http2::Frame> continuedFrames;
// Peer's max number of streams ...
quint32 maxConcurrentStreams = Http2::maxConcurrentStreams;
@@ -202,6 +203,6 @@ private:
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#endif // !defined(QT_NO_HTTP)
#endif
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 09cea8e769..74fc23957c 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -86,7 +86,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
, channelCount((type == QHttpNetworkConnection::ConnectionTypeSPDY || type == QHttpNetworkConnection::ConnectionTypeHTTP2)
? 1 : defaultHttpChannelCount)
#else
-, channelCount(defaultHttpChannelCount)
+, channelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2 ? 1 : defaultHttpChannelCount)
#endif // QT_NO_SSL
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
@@ -619,13 +619,11 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
break;
}
}
-#ifndef QT_NO_SSL
- else { // SPDY
+ else { // SPDY, HTTP/2
if (!pair.second->d_func()->requestIsPrepared)
prepareRequest(pair);
channels[0].spdyRequestsToSend.insertMulti(request.priority(), pair);
}
-#endif // QT_NO_SSL
// For Happy Eyeballs the networkLayerState is set to Unknown
// untill we have started the first connection attempt. So no
@@ -1013,9 +1011,9 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
}
break;
}
- case QHttpNetworkConnection::ConnectionTypeSPDY:
- case QHttpNetworkConnection::ConnectionTypeHTTP2: {
-#ifndef QT_NO_SSL
+ case QHttpNetworkConnection::ConnectionTypeHTTP2:
+ case QHttpNetworkConnection::ConnectionTypeSPDY: {
+
if (channels[0].spdyRequestsToSend.isEmpty())
return;
@@ -1027,7 +1025,6 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
&& !channels[0].pendingEncrypt)
channels[0].sendRequest();
-#endif // QT_NO_SSL
break;
}
}
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 87f88aad5f..b6a9b80511 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -179,8 +179,11 @@ void QHttpNetworkConnectionChannel::init()
if (!sslConfiguration.isNull())
sslSocket->setSslConfiguration(sslConfiguration);
} else {
-#endif // QT_NO_SSL
- protocolHandler.reset(new QHttpProtocolHandler(this));
+#endif // !QT_NO_SSL
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2)
+ protocolHandler.reset(new QHttp2ProtocolHandler(this));
+ else
+ protocolHandler.reset(new QHttpProtocolHandler(this));
#ifndef QT_NO_SSL
}
#endif
@@ -835,10 +838,17 @@ void QHttpNetworkConnectionChannel::_q_connected()
#endif
} else {
state = QHttpNetworkConnectionChannel::IdleState;
- if (!reply)
- connection->d_func()->dequeueRequest(socket);
- if (reply)
- sendRequest();
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
+ if (spdyRequestsToSend.count() > 0) {
+ // wait for data from the server first (e.g. initial window, max concurrent requests)
+ QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ }
+ } else {
+ if (!reply)
+ connection->d_func()->dequeueRequest(socket);
+ if (reply)
+ sendRequest();
+ }
}
}
@@ -972,9 +982,12 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
}
} while (!connection->d_func()->highPriorityQueue.isEmpty()
|| !connection->d_func()->lowPriorityQueue.isEmpty());
+
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
#ifndef QT_NO_SSL
- if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY ||
- connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY
+#endif
+ ) {
QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
for (int a = 0; a < spdyPairs.count(); ++a) {
// emit error for all replies
@@ -983,7 +996,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
emit currentReply->finishedWithError(errorCode, errorString);
}
}
-#endif // QT_NO_SSL
// send the next request
QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
@@ -1005,20 +1017,19 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
#ifndef QT_NO_NETWORKPROXY
void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator* auth)
{
+ if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
#ifndef QT_NO_SSL
- if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY ||
- connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY
+#endif
+ ) {
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
} else { // HTTP
-#endif // QT_NO_SSL
// Need to dequeue the request before we can emit the error.
if (!reply)
connection->d_func()->dequeueRequest(socket);
if (reply)
connection->d_func()->emitProxyAuthenticationRequired(this, proxy, auth);
-#ifndef QT_NO_SSL
}
-#endif // QT_NO_SSL
}
#endif
@@ -1028,6 +1039,19 @@ void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead()
sendRequest();
}
+void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error,
+ const char *message)
+{
+ if (reply)
+ emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
+ QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
+ for (int a = 0; a < spdyPairs.count(); ++a) {
+ QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
+ Q_ASSERT(currentReply);
+ emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
+ }
+}
+
#ifndef QT_NO_SSL
void QHttpNetworkConnectionChannel::_q_encrypted()
{
@@ -1078,9 +1102,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY ||
connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
// we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent
- if (spdyRequestsToSend.count() > 0)
+ if (spdyRequestsToSend.count() > 0) {
// wait for data from the server first (e.g. initial window, max concurrent requests)
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ }
} else { // HTTP
if (!reply)
connection->d_func()->dequeueRequest(socket);
@@ -1102,19 +1127,6 @@ void QHttpNetworkConnectionChannel::requeueSpdyRequests()
spdyRequestsToSend.clear();
}
-void QHttpNetworkConnectionChannel::emitFinishedWithError(QNetworkReply::NetworkError error,
- const char *message)
-{
- if (reply)
- emit reply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
- QList<HttpMessagePair> spdyPairs = spdyRequestsToSend.values();
- for (int a = 0; a < spdyPairs.count(); ++a) {
- QHttpNetworkReply *currentReply = spdyPairs.at(a).second;
- Q_ASSERT(currentReply);
- emit currentReply->finishedWithError(error, QHttpNetworkConnectionChannel::tr(message));
- }
-}
-
void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
{
if (!socket)
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index d7d5d86a7a..61aea9d35d 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -121,18 +121,21 @@ public:
bool authenticationCredentialsSent;
bool proxyCredentialsSent;
QScopedPointer<QAbstractProtocolHandler> protocolHandler;
+ // SPDY or HTTP/2 requests; SPDY is TLS-only, but
+ // HTTP/2 can be cleartext also, that's why it's
+ // outside of QT_NO_SSL section. Sorted by priority:
+ QMultiMap<int, HttpMessagePair> spdyRequestsToSend;
#ifndef QT_NO_SSL
bool ignoreAllSslErrors;
QList<QSslError> ignoreSslErrorsList;
QSslConfiguration sslConfiguration;
- QMultiMap<int, HttpMessagePair> spdyRequestsToSend; // sorted by priority
void ignoreSslErrors();
void ignoreSslErrors(const QList<QSslError> &errors);
void setSslConfiguration(const QSslConfiguration &config);
void requeueSpdyRequests(); // when we wanted SPDY but got HTTP
+#endif
// to emit the signal for all in-flight replies:
void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message);
-#endif
#ifndef QT_NO_BEARERMANAGEMENT
QSharedPointer<QNetworkSession> networkSession;
#endif
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index e16519c2f2..1dca7f02fb 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -285,10 +285,11 @@ void QHttpThreadDelegate::startRequest()
urlCopy.setPort(urlCopy.port(ssl ? 443 : 80));
QHttpNetworkConnection::ConnectionType connectionType
- = QHttpNetworkConnection::ConnectionTypeHTTP;
+ = httpRequest.isHTTP2Allowed() ? QHttpNetworkConnection::ConnectionTypeHTTP2
+ : QHttpNetworkConnection::ConnectionTypeHTTP;
+
#ifndef QT_NO_SSL
if (httpRequest.isHTTP2Allowed() && ssl) {
- connectionType = QHttpNetworkConnection::ConnectionTypeHTTP2;
QList<QByteArray> protocols;
protocols << QSslConfiguration::ALPNProtocolHTTP2
<< QSslConfiguration::NextProtocolHttp1_1;
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 63332d4fd1..29362b81e2 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -260,6 +260,14 @@ QT_BEGIN_NAMESPACE
Indicates whether SPDY was used for receiving
this reply.
+ \value HTTP2AllowedAttribute
+ Requests only, type: QMetaType::Bool (default: false)
+ Indicates whether the QNetworkAccessManager code is
+ allowed to use HTTP/2 with this request. This applies
+ to SSL requests or 'cleartext' HTTP/2.
+
+ \omitvalue HTTP2WasUsedAttribute
+
\value EmitAllUploadProgressSignalsAttribute
Requests only, type: QMetaType::Bool (default: false)
Indicates whether all upload signals should be emitted.
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index 34d2f164e8..8f37e28669 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -56,14 +56,15 @@ win32: {
}
mac {
- LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation
+ LIBS_PRIVATE += -framework CoreFoundation
!uikit: LIBS_PRIVATE += -framework CoreServices
+ !if(watchos:CONFIG(device, simulator|device)): LIBS_PRIVATE += -framework SystemConfiguration
}
osx:SOURCES += kernel/qnetworkproxy_mac.cpp
else:win32:SOURCES += kernel/qnetworkproxy_win.cpp
-else:contains(QT_CONFIG, libproxy) {
+else: qtConfig(libproxy) {
SOURCES += kernel/qnetworkproxy_libproxy.cpp
- LIBS_PRIVATE += -lproxy
+ QMAKE_USE_PRIVATE += libproxy
}
else:SOURCES += kernel/qnetworkproxy_generic.cpp
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp
index 22d2e6bb70..c5d1adbef0 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -365,7 +365,7 @@ void QNetworkAddressEntry::setBroadcast(const QHostAddress &newBroadcast)
Not all operating systems support reporting all features. Only the
IPv4 addresses are guaranteed to be listed by this class in all
platforms. In particular, IPv6 address listing is only supported
- on Windows, Linux, OS X and the BSDs.
+ on Windows, Linux, \macos and the BSDs.
\sa QNetworkAddressEntry
*/
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 2f7e9d537d..bb1a7d0d8b 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -1557,7 +1557,7 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
those settings are not found, this function will attempt to obtain
Internet Explorer's settings and use them.
- On MacOS X, this function will obtain the proxy settings using the
+ On \macos, this function will obtain the proxy settings using the
SystemConfiguration framework from Apple. It will apply the FTP,
HTTP and HTTPS proxy configurations for queries that contain the
protocol tag "ftp", "http" and "https", respectively. If the SOCKS
@@ -1576,7 +1576,7 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
listed here.
\list
- \li On MacOS X, this function will ignore the Proxy Auto Configuration
+ \li On \macos, this function will ignore the Proxy Auto Configuration
settings, since it cannot execute the associated ECMAScript code.
\li On Windows platforms, this function may take several seconds to
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index be60d187ad..87ef31fb22 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -428,7 +428,7 @@
allowed to rebind, even if they pass ReuseAddressHint. This option
provides more security than ShareAddress, but on certain operating
systems, it requires you to run the server with administrator privileges.
- On Unix and OS X, not sharing is the default behavior for binding
+ On Unix and \macos, not sharing is the default behavior for binding
an address and port, so this option is ignored. On Windows, this
option uses the SO_EXCLUSIVEADDRUSE socket option.
@@ -438,7 +438,7 @@
socket option.
\value DefaultForPlatform The default option for the current platform.
- On Unix and OS X, this is equivalent to (DontShareAddress
+ On Unix and \macos, this is equivalent to (DontShareAddress
+ ReuseAddressHint), and on Windows, its equivalent to ShareAddress.
*/
@@ -693,19 +693,12 @@ bool QAbstractSocketPrivate::canReadNotification()
qDebug("QAbstractSocketPrivate::canReadNotification()");
#endif
- if (!isBuffered) {
- if (hasPendingData) {
- socketEngine->setReadNotificationEnabled(false);
- return true;
- }
- hasPendingData = true;
- }
-
// If buffered, read data from the socket into the read buffer
- qint64 newBytes = 0;
if (isBuffered) {
+ const qint64 oldBufferSize = buffer.size();
+
// Return if there is no space in the buffer
- if (readBufferMaxSize && buffer.size() >= readBufferMaxSize) {
+ if (readBufferMaxSize && oldBufferSize >= readBufferMaxSize) {
socketEngine->setReadNotificationEnabled(false);
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::canReadNotification() buffer is full");
@@ -715,7 +708,6 @@ bool QAbstractSocketPrivate::canReadNotification()
// If reading from the socket fails after getting a read
// notification, close the socket.
- newBytes = buffer.size();
if (!readFromSocket()) {
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::canReadNotification() disconnecting socket");
@@ -723,21 +715,28 @@ bool QAbstractSocketPrivate::canReadNotification()
q->disconnectFromHost();
return false;
}
- newBytes = buffer.size() - newBytes;
+
+ // Return if there is no new data available.
+ if (buffer.size() == oldBufferSize) {
+ // If the socket is opened only for writing, return true
+ // to indicate that the data was discarded.
+ return !q->isReadable();
+ }
+ } else {
+ if (hasPendingData) {
+ socketEngine->setReadNotificationEnabled(false);
+ return true;
+ }
+ hasPendingData = true;
}
- // Only emit readyRead() if there is data available.
- if (newBytes > 0 || !isBuffered)
- emitReadyRead();
+ emitReadyRead();
- // If we were closed as a result of the readyRead() signal,
- // return.
- if (state == QAbstractSocket::UnconnectedState || state == QAbstractSocket::ClosingState) {
#if defined (QABSTRACTSOCKET_DEBUG)
+ // If we were closed as a result of the readyRead() signal.
+ if (state == QAbstractSocket::UnconnectedState || state == QAbstractSocket::ClosingState)
qDebug("QAbstractSocketPrivate::canReadNotification() socket is closing - returning");
#endif
- return true;
- }
return true;
}
diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp
index a1085f726a..94143c2dc0 100644
--- a/src/network/socket/qlocalserver.cpp
+++ b/src/network/socket/qlocalserver.cpp
@@ -147,7 +147,7 @@ QLocalServer::~QLocalServer()
and are created based on the umask. Setting the access flags will
overide this and will restrict or permit access as specified.
- Other Unix-based operating systems, such as OS X, do not
+ Other Unix-based operating systems, such as \macos, do not
honor file permissions for Unix domain sockets and by default
have WorldAccess and these permission flags will have no effect.
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index 4348b819d9..379cdd096d 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -245,8 +245,8 @@ void QLocalSocket::connectToServer(OpenMode openMode)
QLatin1String("QLocalSocket::connectToServer"));
return;
}
- d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
QIODevice::open(openMode);
+ d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
}
bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index d7d7dad8e7..d1efc21e09 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -317,7 +317,7 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
case QNativeSocketEngine::BindExclusively:
case QNativeSocketEngine::NonBlockingSocketOption:
case QNativeSocketEngine::BroadcastSocketOption:
- return true;
+ return -1;
case QNativeSocketEngine::MaxStreamsSocketOption: {
#ifndef QT_NO_SCTP
sctp_initmsg sctpInitMsg;
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index b1c0b6bd6e..793ea60b07 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -27,7 +27,7 @@ SOURCES += socket/qabstractsocketengine.cpp \
# SCTP support.
-contains(QT_CONFIG, sctp) {
+qtConfig(sctp) {
HEADERS += socket/qsctpserver.h \
socket/qsctpserver_p.h \
socket/qsctpsocket.h \
@@ -80,6 +80,6 @@ integrity: {
DEFINES += QT_LOCALSOCKET_TCP
}
-contains(QT_CONFIG, system-proxies) {
+qtConfig(system-proxies) {
DEFINES += QT_USE_SYSTEM_PROXIES
}
diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
index dec8e12abb..c92d8fc3f8 100644
--- a/src/network/ssl/qsslcontext_openssl.cpp
+++ b/src/network/ssl/qsslcontext_openssl.cpp
@@ -320,7 +320,7 @@ init_context:
}
if (!dhparams.isEmpty()) {
- const QByteArray &params = dhparams.d.data()->derData;
+ const QByteArray &params = dhparams.d->derData;
const char *ptr = params.constData();
DH *dh = q_d2i_DHparams(NULL, reinterpret_cast<const unsigned char **>(&ptr), params.length());
if (dh == NULL)
diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp
index e75ffe4da5..d0fcb3189a 100644
--- a/src/network/ssl/qssldiffiehellmanparameters.cpp
+++ b/src/network/ssl/qssldiffiehellmanparameters.cpp
@@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE
QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters()
{
// The 1024-bit MODP group from RFC 2459 (Second Oakley Group)
- return QSslDiffieHellmanParameters(
+ return fromEncoded(
QByteArray::fromBase64(QByteArrayLiteral(
"MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR"
"Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL"
@@ -100,73 +100,82 @@ QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters()
QSslDiffieHellmanParameters::QSslDiffieHellmanParameters()
: d(new QSslDiffieHellmanParametersPrivate)
{
+ d->ref.ref();
}
/*!
Constructs a QSslDiffieHellmanParameters object using
the byte array \a encoded in either PEM or DER form as specified by \a encoding.
- After construction, the isValid() method should be used to
+ Use the isValid() method on the returned object to
check whether the Diffie-Hellman parameters were valid and
loaded correctly.
\sa isValid()
\sa QSslConfiguration
*/
-QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat encoding)
- : d(new QSslDiffieHellmanParametersPrivate)
+QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat encoding)
{
+ QSslDiffieHellmanParameters result;
switch (encoding) {
case QSsl::Der:
- d->decodeDer(encoded);
+ result.d->decodeDer(encoded);
break;
case QSsl::Pem:
- d->decodePem(encoded);
+ result.d->decodePem(encoded);
break;
}
+ return result;
}
/*!
Constructs a QSslDiffieHellmanParameters object by
reading from \a device in either PEM or DER form as specified by \a encoding.
- After construction, the isValid() method should be used
+ Use the isValid() method on the returned object
to check whether the Diffie-Hellman parameters were valid
and loaded correctly.
+ In particular, if \a device is \c nullptr or not open for reading, an invalid
+ object will be returned.
+
\sa isValid()
\sa QSslConfiguration
*/
-QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat encoding)
- : d(new QSslDiffieHellmanParametersPrivate)
+QSslDiffieHellmanParameters QSslDiffieHellmanParameters::fromEncoded(QIODevice *device, QSsl::EncodingFormat encoding)
{
- if (!device)
- return;
-
- const QByteArray encoded = device->readAll();
-
- switch (encoding) {
- case QSsl::Der:
- d->decodeDer(encoded);
- break;
- case QSsl::Pem:
- d->decodePem(encoded);
- break;
- }
+ if (device)
+ return fromEncoded(device->readAll(), encoding);
+ else
+ return QSslDiffieHellmanParameters();
}
/*!
Constructs an identical copy of \a other.
*/
-QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other) : d(other.d)
+QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other)
+ : d(other.d)
{
+ if (d)
+ d->ref.ref();
}
/*!
+ \fn QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other)
+
+ Move-constructs from \a other.
+
+ \note The moved-from object \a other is placed in a partially-formed state, in which
+ the only valid operations are destruction and assignment of a new value.
+*/
+
+/*!
Destroys the QSslDiffieHellmanParameters object.
*/
QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters()
{
+ if (d && !d->ref.deref())
+ delete d;
}
/*!
@@ -177,7 +186,8 @@ QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters()
*/
QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDiffieHellmanParameters &other)
{
- d = other.d;
+ QSslDiffieHellmanParameters copy(other);
+ swap(copy);
return *this;
}
@@ -185,6 +195,9 @@ QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDi
\fn QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(QSslDiffieHellmanParameters &&other)
Move-assigns \a other to this QSslDiffieHellmanParameters instance.
+
+ \note The moved-from object \a other is placed in a partially-formed state, in which
+ the only valid operations are destruction and assignment of a new value.
*/
/*!
@@ -265,6 +278,7 @@ QString QSslDiffieHellmanParameters::errorString() const Q_DECL_NOTHROW
}
/*!
+ \since 5.8
\relates QSslDiffieHellmanParameters
Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.
@@ -276,6 +290,7 @@ bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanP
#ifndef QT_NO_DEBUG_STREAM
/*!
+ \since 5.8
\relates QSslDiffieHellmanParameters
Writes the set of Diffie-Hellman parameters in \a dhparam into the debug object \a debug for
@@ -295,7 +310,8 @@ QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam)
#endif
/*!
- \relates QHash
+ \since 5.8
+ \relates QSslDiffieHellmanParameters
Returns an hash value for \a dhparam, using \a seed to seed
the calculation.
diff --git a/src/network/ssl/qssldiffiehellmanparameters.h b/src/network/ssl/qssldiffiehellmanparameters.h
index aa40be83a6..4533ea4ed2 100644
--- a/src/network/ssl/qssldiffiehellmanparameters.h
+++ b/src/network/ssl/qssldiffiehellmanparameters.h
@@ -82,24 +82,25 @@ public:
Q_NETWORK_EXPORT static QSslDiffieHellmanParameters defaultParameters();
Q_NETWORK_EXPORT QSslDiffieHellmanParameters();
- Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem);
- Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
Q_NETWORK_EXPORT QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other);
+ QSslDiffieHellmanParameters(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
Q_NETWORK_EXPORT ~QSslDiffieHellmanParameters();
+
Q_NETWORK_EXPORT QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other);
-#ifdef Q_COMPILER_RVALUE_REFS
QSslDiffieHellmanParameters &operator=(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW { swap(other); return *this; }
-#endif
void swap(QSslDiffieHellmanParameters &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
+ Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem);
+ Q_NETWORK_EXPORT static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
+
Q_NETWORK_EXPORT bool isEmpty() const Q_DECL_NOTHROW;
Q_NETWORK_EXPORT bool isValid() const Q_DECL_NOTHROW;
- Q_NETWORK_EXPORT QSslDiffieHellmanParameters::Error error() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT Error error() const Q_DECL_NOTHROW;
Q_NETWORK_EXPORT QString errorString() const Q_DECL_NOTHROW;
private:
- QExplicitlySharedDataPointer<QSslDiffieHellmanParametersPrivate> d;
+ QSslDiffieHellmanParametersPrivate *d;
friend class QSslContext;
friend Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW;
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 2371dd7212..29e1f32815 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -142,7 +142,7 @@
addDefaultCaCertificates(), and QSslConfiguration::defaultConfiguration().setCaCertificates().
\endlist
- \note If available, root certificates on Unix (excluding OS X) will be
+ \note If available, root certificates on Unix (excluding \macos) will be
loaded on demand from the standard certificate directories. If you do not
want to load root certificates on demand, you need to call either
QSslConfiguration::defaultConfiguration().setCaCertificates() before the first
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index 438ea9a38e..4c06404415 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -204,7 +204,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = false;
bool QSslSocketPrivate::s_loadRootCertsOnDemand = false;
-#if !defined(QT_PLATFORM_UIKIT) // dhparam is not used on iOS or tvOS. (see the SSLSetDiffieHellmanParams call below)
+#if !defined(QT_PLATFORM_UIKIT) // dhparam is only used on macOS. (see the SSLSetDiffieHellmanParams call below)
static const uint8_t dhparam[] =
"\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80"
"\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7"
@@ -223,7 +223,7 @@ static const uint8_t dhparam[] =
"\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02";
#endif
-// No ioErr on iOS/tvOS. (defined in MacErrors.h on OS X)
+// No ioErr on iOS/tvOS/watchOS. (defined in MacErrors.h on macOS)
#if defined(QT_PLATFORM_UIKIT)
# define ioErr -36
#endif
diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h
index 5210fb7f30..9e1d18981e 100644
--- a/src/network/ssl/qsslsocket_mac_p.h
+++ b/src/network/ssl/qsslsocket_mac_p.h
@@ -75,7 +75,7 @@ public:
private:
SSLContextRef context;
- Q_DISABLE_COPY(QSecureTransportContext);
+ Q_DISABLE_COPY(QSecureTransportContext)
};
class QSslSocketBackendPrivate : public QSslSocketPrivate
@@ -122,7 +122,7 @@ private:
QSecureTransportContext context;
- Q_DISABLE_COPY(QSslSocketBackendPrivate);
+ Q_DISABLE_COPY(QSslSocketBackendPrivate)
};
QT_END_NAMESPACE
diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
index edbbeadf51..8139af50af 100644
--- a/src/network/ssl/ssl.pri
+++ b/src/network/ssl/ssl.pri
@@ -1,5 +1,5 @@
# OpenSSL support; compile in QSslSocket.
-contains(QT_CONFIG, ssl) {
+qtConfig(ssl) {
HEADERS += ssl/qasn1element_p.h \
ssl/qssl.h \
ssl/qssl_p.h \
@@ -45,7 +45,7 @@ contains(QT_CONFIG, ssl) {
ssl/qsslellipticcurve_dummy.cpp
}
- contains(QT_CONFIG, securetransport) {
+ qtConfig(securetransport) {
HEADERS += ssl/qsslsocket_mac_p.h
SOURCES += ssl/qsslcertificate_qt.cpp \
ssl/qssldiffiehellmanparameters_dummy.cpp \
@@ -56,7 +56,7 @@ contains(QT_CONFIG, ssl) {
ssl/qsslellipticcurve_dummy.cpp
}
- contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
+ qtConfig(openssl)|qtConfig(openssl-linked) {
HEADERS += ssl/qsslcontext_openssl_p.h \
ssl/qsslsocket_openssl_p.h \
ssl/qsslsocket_openssl_symbols_p.h
diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc
index ae12fb8137..6ab888a14d 100644
--- a/src/opengl/doc/src/qtopengl-index.qdoc
+++ b/src/opengl/doc/src/qtopengl-index.qdoc
@@ -37,7 +37,7 @@
OpenGL is a standard API for rendering 3D graphics. OpenGL only
deals with 3D rendering and provides little or no support for GUI
programming issues. The user interface for an OpenGL application
- must be created with another toolkit, such as Cocoa on the OS X
+ must be created with another toolkit, such as Cocoa on the \macos
platform, Microsoft Foundation Classes (MFC) under Windows, or Qt
on both platforms.
diff --git a/src/opengl/doc/src/qtopengl-module.qdoc b/src/opengl/doc/src/qtopengl-module.qdoc
index 8722a9f972..e9b1258266 100644
--- a/src/opengl/doc/src/qtopengl-module.qdoc
+++ b/src/opengl/doc/src/qtopengl-module.qdoc
@@ -40,7 +40,7 @@
OpenGL is a standard API for rendering 3D graphics. OpenGL only
deals with 3D rendering and provides little or no support for GUI
programming issues. The user interface for an OpenGL application
- must be created with another toolkit, such as Cocoa on the OS X
+ must be created with another toolkit, such as Cocoa on the \macos
platform, Microsoft Foundation Classes (MFC) under Windows, or Qt
on both platforms.
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 2386ef5d19..25de6ad670 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -9,8 +9,8 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
HEADERS += qgl.h \
qgl_p.h \
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index f249984893..5aa807b12c 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -3697,7 +3697,7 @@ void QGLContext::doneCurrent()
QGLWidget. This will side-step the issue altogether, and is what
we recommend for users that need this kind of functionality.
- On OS X, when Qt is built with Cocoa support, a QGLWidget
+ On \macos, when Qt is built with Cocoa support, a QGLWidget
can't have any sibling widgets placed ontop of itself. This is due
to limitations in the Cocoa API and is not supported by Apple.
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index b0dc3b2e2c..e2f434ac3c 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -66,7 +66,7 @@
an OpenGL texture.} The texture is then updated automatically
when the pbuffer contents change, eliminating the need for
additional copy operations. This is supported only on Windows
- and OS X systems that provide the \c render_texture
+ and \macos systems that provide the \c render_texture
extension. Note that under Windows, a multi-sampled pbuffer
can't be used in conjunction with the \c render_texture
extension. If a multi-sampled pbuffer is requested under
@@ -293,7 +293,7 @@ QGLContext *QGLPixelBuffer::context() const
pbuffer contents to a texture using updateDynamicTexture().
\warning For the bindToDynamicTexture() call to succeed on the
- OS X, the pbuffer needs a shared context, i.e. the
+ \macos, the pbuffer needs a shared context, i.e. the
QGLPixelBuffer must be created with a share widget.
\sa generateDynamicTexture(), releaseFromDynamicTexture()
@@ -322,7 +322,7 @@ QGLContext *QGLPixelBuffer::context() const
\snippet code/src_opengl_qglpixelbuffer.cpp 1
- An alternative on Windows and OS X systems that support the
+ An alternative on Windows and \macos systems that support the
\c render_texture extension is to use bindToDynamicTexture() to
get dynamic updates of the texture.
diff --git a/src/openglextensions/openglextensions.pro b/src/openglextensions/openglextensions.pro
index 04a871114b..42ba4152d5 100644
--- a/src/openglextensions/openglextensions.pro
+++ b/src/openglextensions/openglextensions.pro
@@ -1,8 +1,8 @@
TARGET = QtOpenGLExtensions
CONFIG += static
-contains(QT_CONFIG, opengl):CONFIG += opengl
-contains(QT_CONFIG, opengles2):CONFIG += opengles2
+qtConfig(opengl): CONFIG += opengl
+qtConfig(opengles2): CONFIG += opengles2
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_FOREACH
diff --git a/src/platformheaders/nativecontexts/qeglnativecontext.h b/src/platformheaders/nativecontexts/qeglnativecontext.h
index acc5dd10ab..67a6d2b808 100644
--- a/src/platformheaders/nativecontexts/qeglnativecontext.h
+++ b/src/platformheaders/nativecontexts/qeglnativecontext.h
@@ -41,7 +41,7 @@
#define QEGLNATIVECONTEXT_H
#include <QtCore/QMetaType>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/accessibility/accessibility.pri b/src/platformsupport/accessibility/accessibility.pri
index fb56edbf1a..924f6a512f 100644
--- a/src/platformsupport/accessibility/accessibility.pri
+++ b/src/platformsupport/accessibility/accessibility.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
INCLUDEPATH += $$PWD
HEADERS += \
diff --git a/src/platformsupport/devicediscovery/devicediscovery.pri b/src/platformsupport/devicediscovery/devicediscovery.pri
index 9829ae88ba..f4e9103130 100644
--- a/src/platformsupport/devicediscovery/devicediscovery.pri
+++ b/src/platformsupport/devicediscovery/devicediscovery.pri
@@ -1,11 +1,10 @@
HEADERS += $$PWD/qdevicediscovery_p.h
-contains(QT_CONFIG, libudev) {
+qtConfig(libudev) {
SOURCES += $$PWD/qdevicediscovery_udev.cpp
HEADERS += $$PWD/qdevicediscovery_udev_p.h
- INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-} else: contains(QT_CONFIG, evdev) {
+ QMAKE_USE_PRIVATE += libudev
+} else: qtConfig(evdev) {
SOURCES += $$PWD/qdevicediscovery_static.cpp
HEADERS += $$PWD/qdevicediscovery_static_p.h
} else {
diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri
index fe6d0eb748..4a93d997fb 100644
--- a/src/platformsupport/eglconvenience/eglconvenience.pri
+++ b/src/platformsupport/eglconvenience/eglconvenience.pri
@@ -1,13 +1,14 @@
-contains(QT_CONFIG,egl) {
+qtConfig(egl) {
HEADERS += \
$$PWD/qeglconvenience_p.h \
- $$PWD/qeglstreamconvenience_p.h
+ $$PWD/qeglstreamconvenience_p.h \
+ $$PWD/qt_egl_p.h
SOURCES += \
$$PWD/qeglconvenience.cpp \
$$PWD/qeglstreamconvenience.cpp
- contains(QT_CONFIG,opengl) {
+ qtConfig(opengl) {
HEADERS += $$PWD/qeglplatformcontext_p.h \
$$PWD/qeglpbuffer_p.h
@@ -15,10 +16,10 @@ contains(QT_CONFIG,egl) {
$$PWD/qeglpbuffer.cpp
}
- # Avoid X11 header collision
- DEFINES += MESA_EGL_NO_X11_HEADERS
+ # Avoid X11 header collision, use generic EGL native types
+ DEFINES += QT_EGL_NO_X11
- contains(QT_CONFIG,xlib) {
+ qtConfig(xlib) {
HEADERS += \
$$PWD/qxlibeglintegration_p.h
SOURCES += \
diff --git a/src/platformsupport/eglconvenience/qeglconvenience_p.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h
index ec5c1e403a..fdd21b8f19 100644
--- a/src/platformsupport/eglconvenience/qeglconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h
@@ -54,7 +54,7 @@
#include <QtGui/QSurfaceFormat>
#include <QtCore/QVector>
#include <QtCore/QSizeF>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
index 19a29d5dd8..4f9ea9d5f3 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h
+++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
@@ -53,7 +53,6 @@
#include <qpa/qplatformoffscreensurface.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
-#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index e772f5df89..f6b2b876f7 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -55,7 +55,7 @@
#include <qpa/qplatformwindow.h>
#include <qpa/qplatformopenglcontext.h>
#include <QtCore/QVariant>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
index c8a8096816..f535afbc55 100644
--- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
@@ -52,8 +52,7 @@
//
#include <qglobal.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
// This provides runtime EGLDevice/Output/Stream support even when eglext.h in
// the sysroot is not up-to-date.
diff --git a/src/platformsupport/eglconvenience/qt_egl_p.h b/src/platformsupport/eglconvenience/qt_egl_p.h
new file mode 100644
index 0000000000..615ee4b80a
--- /dev/null
+++ b/src/platformsupport/eglconvenience/qt_egl_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui 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 QT_EGL_P_H
+#define QT_EGL_P_H
+
+//
+// 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.
+//
+
+#ifdef QT_EGL_NO_X11
+# define MESA_EGL_NO_X11_HEADERS // MESA
+# define WIN_INTERFACE_CUSTOM // NV
+#endif // QT_EGL_NO_X11
+
+#ifdef QT_EGL_WAYLAND
+# define WAYLAND // NV
+#endif // QT_EGL_WAYLAND
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <stdint.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtInternal {
+
+template <class FromType, class ToType>
+struct QtEglConverter
+{
+ static inline ToType convert(FromType v)
+ { return v; }
+};
+
+template <>
+struct QtEglConverter<uint32_t, uintptr_t>
+{
+ static inline uintptr_t convert(uint32_t v)
+ { return v; }
+};
+
+#if Q_PROCESSOR_WORDSIZE > 4
+template <>
+struct QtEglConverter<uintptr_t, uint32_t>
+{
+ static inline uint32_t convert(uintptr_t v)
+ { return uint32_t(v); }
+};
+#endif
+
+template <>
+struct QtEglConverter<uint32_t, void *>
+{
+ static inline void *convert(uint32_t v)
+ { return reinterpret_cast<void *>(uintptr_t(v)); }
+};
+
+template <>
+struct QtEglConverter<void *, uint32_t>
+{
+ static inline uint32_t convert(void *v)
+ { return uintptr_t(v); }
+};
+
+} // QtInternal
+
+template <class ToType, class FromType>
+static inline ToType qt_egl_cast(FromType from)
+{ return QtInternal::QtEglConverter<FromType, ToType>::convert(from); }
+
+QT_END_NAMESPACE
+
+#endif // QT_EGL_P_H
diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri
index 6a4689eb19..fb0f3b3827 100644
--- a/src/platformsupport/eventdispatchers/eventdispatchers.pri
+++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri
@@ -14,9 +14,8 @@ HEADERS +=\
$$PWD/qwindowsguieventdispatcher_p.h
}
-contains(QT_CONFIG, glib) {
+qtConfig(glib) {
SOURCES +=$$PWD/qeventdispatcher_glib.cpp
HEADERS +=$$PWD/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GLIB
- LIBS_PRIVATE += $$QMAKE_LIBS_GLIB
+ QMAKE_USE_PRIVATE += glib
}
diff --git a/src/platformsupport/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp
index 2429cb7c5c..102bc91647 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler.cpp
+++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp
@@ -39,8 +39,9 @@
#include "qfbvthandler_p.h"
#include <QtCore/QSocketNotifier>
+#include <QtCore/private/qglobal_p.h>
-#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (!defined(QT_NO_EVDEV) || !defined(QT_NO_LIBINPUT))
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (QT_CONFIG(evdev) || QT_CONFIG(libinput))
#define VTH_ENABLED
diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index 52cf771b2a..575c93fe20 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -1,5 +1,3 @@
-DEFINES += QT_NO_FONTCONFIG
-
HEADERS += \
$$PWD/qbasicfontdatabase_p.h \
$$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h
diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
index bd7294b818..63097c33c1 100644
--- a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
+++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri
@@ -2,5 +2,5 @@ HEADERS += $$PWD/qfontconfigdatabase_p.h \
$$PWD/qfontenginemultifontconfig_p.h
SOURCES += $$PWD/qfontconfigdatabase.cpp \
$$PWD/qfontenginemultifontconfig.cpp
-DEFINES -= QT_NO_FONTCONFIG
+
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_FONTCONFIG
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 652a9f4add..02b7e1bd63 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -365,6 +365,7 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
static void populateFromPattern(FcPattern *pattern)
{
QString familyName;
+ QString familyNameLang;
FcChar8 *value = 0;
int weight_value;
int slant_value;
@@ -382,6 +383,9 @@ static void populateFromPattern(FcPattern *pattern)
familyName = QString::fromUtf8((const char *)value);
+ if (FcPatternGetString(pattern, FC_FAMILYLANG, 0, &value) == FcResultMatch)
+ familyNameLang = QString::fromUtf8((const char *)value);
+
slant_value = FC_SLANT_ROMAN;
weight_value = FC_WEIGHT_REGULAR;
spacing_value = FC_PROPORTIONAL;
@@ -471,8 +475,30 @@ static void populateFromPattern(FcPattern *pattern)
QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile);
// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
- for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k)
- QPlatformFontDatabase::registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value));
+ for (int k = 1; FcPatternGetString(pattern, FC_FAMILY, k, &value) == FcResultMatch; ++k) {
+ const QString altFamilyName = QString::fromUtf8((const char *)value);
+ // Extra family names can be aliases or subfamilies.
+ // If it is a subfamily, register it as a separate font, so only members of the subfamily are
+ // matched when the subfamily is requested.
+ QString altStyleName;
+ if (FcPatternGetString(pattern, FC_STYLE, k, &value) == FcResultMatch)
+ altStyleName = QString::fromUtf8((const char *)value);
+ else
+ altStyleName = styleName;
+
+ QString altFamilyNameLang;
+ if (FcPatternGetString(pattern, FC_FAMILYLANG, k, &value) == FcResultMatch)
+ altFamilyNameLang = QString::fromUtf8((const char *)value);
+ else
+ altFamilyNameLang = familyNameLang;
+
+ if (familyNameLang == altFamilyNameLang && altStyleName != styleName) {
+ FontFile *altFontFile = new FontFile(*fontFile);
+ QPlatformFontDatabase::registerFont(altFamilyName, altStyleName, QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,altFontFile);
+ } else {
+ QPlatformFontDatabase::registerAliasToFontFamily(familyName, altFamilyName);
+ }
+ }
}
@@ -488,7 +514,7 @@ void QFontconfigDatabase::populateFontDatabase()
FC_FAMILY, FC_STYLE, FC_WEIGHT, FC_SLANT,
FC_SPACING, FC_FILE, FC_INDEX,
FC_LANG, FC_CHARSET, FC_FOUNDRY, FC_SCALABLE, FC_PIXEL_SIZE,
- FC_WIDTH,
+ FC_WIDTH, FC_FAMILYLANG,
#if FC_VERSION >= 20297
FC_CAPABILITY,
#endif
diff --git a/src/platformsupport/fontdatabases/fontdatabases.pri b/src/platformsupport/fontdatabases/fontdatabases.pri
index 12b06d64cc..f8e51f2a6d 100644
--- a/src/platformsupport/fontdatabases/fontdatabases.pri
+++ b/src/platformsupport/fontdatabases/fontdatabases.pri
@@ -1,16 +1,15 @@
-!win32|contains(QT_CONFIG, freetype):!mac {
- include($$PWD/basic/basic.pri)
-}
-
-unix:!mac {
- CONFIG += qpa/genericunixfontdatabase
- include($$PWD/genericunix/genericunix.pri)
- contains(QT_CONFIG,fontconfig) {
- include($$PWD/fontconfig/fontconfig.pri)
+darwin:!if(watchos:CONFIG(simulator, simulator|device)) {
+ include($$PWD/mac/coretext.pri)
+} else {
+ !win32|qtConfig(freetype) {
+ include($$PWD/basic/basic.pri)
}
-}
-mac {
- include($$PWD/mac/coretext.pri)
+ unix {
+ CONFIG += qpa/genericunixfontdatabase
+ include($$PWD/genericunix/genericunix.pri)
+ contains(QT_CONFIG,fontconfig) {
+ include($$PWD/fontconfig/fontconfig.pri)
+ }
+ }
}
-
diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri
index 272e7591ba..4d19a59226 100644
--- a/src/platformsupport/fontdatabases/mac/coretext.pri
+++ b/src/platformsupport/fontdatabases/mac/coretext.pri
@@ -1,14 +1,14 @@
HEADERS += $$PWD/qcoretextfontdatabase_p.h $$PWD/qfontengine_coretext_p.h
OBJECTIVE_SOURCES += $$PWD/qfontengine_coretext.mm $$PWD/qcoretextfontdatabase.mm
-contains(QT_CONFIG, freetype) {
+qtConfig(freetype) {
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
HEADERS += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h
SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp
}
uikit: \
- # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks
+ # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 5fec53d1ed..6b73134c8b 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -811,7 +811,7 @@ static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
}
-#endif // Q_OS_IOS, Q_OS_TVOS
+#endif // Q_OS_IOS, Q_OS_TVOS, Q_OS_WATCHOS
// OSX default case and iOS fallback case
CTFontUIFontType fontType = fontTypeFromTheme(f);
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 646212124b..0bc0416eec 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -453,31 +453,25 @@ void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextIt
CGContextSetTextDrawingMode(ctx, kCGTextFill);
-
- QVarLengthArray<CGSize> advances(glyphs.size());
+ QVarLengthArray<CGPoint> cgPositions(glyphs.size());
QVarLengthArray<CGGlyph> cgGlyphs(glyphs.size());
-
- for (int i = 0; i < glyphs.size() - 1; ++i) {
- advances[i].width = (positions[i + 1].x - positions[i].x).toReal();
- advances[i].height = (positions[i + 1].y - positions[i].y).toReal();
+ const qreal firstX = positions[0].x.toReal();
+ const qreal firstY = positions[0].y.toReal();
+ for (int i = 0; i < glyphs.size(); ++i) {
+ cgPositions[i].x = positions[i].x.toReal() - firstX;
+ cgPositions[i].y = positions[i].y.toReal() - firstY;
cgGlyphs[i] = glyphs[i];
}
- advances[glyphs.size() - 1].width = 0;
- advances[glyphs.size() - 1].height = 0;
- cgGlyphs[glyphs.size() - 1] = glyphs[glyphs.size() - 1];
- CGContextSetFont(ctx, cgFont);
//NSLog(@"Font inDraw %@ ctfont %@", CGFontCopyFullName(cgFont), CTFontCopyFamilyName(ctfont));
CGContextSetTextPosition(ctx, positions[0].x.toReal(), positions[0].y.toReal());
-
- CGContextShowGlyphsWithAdvances(ctx, cgGlyphs.data(), advances.data(), glyphs.size());
+ CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx);
if (synthesisFlags & QFontEngine::SynthesizedBold) {
CGContextSetTextPosition(ctx, positions[0].x.toReal() + 0.5 * lineThickness().toReal(),
positions[0].y.toReal());
-
- CGContextShowGlyphsWithAdvances(ctx, cgGlyphs.data(), advances.data(), glyphs.size());
+ CTFontDrawGlyphs(ctfont, cgGlyphs.data(), cgPositions.data(), glyphs.size(), ctx);
}
CGContextSetTextMatrix(ctx, oldTextMatrix);
@@ -661,14 +655,13 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CGContextSetTextMatrix(ctx, cgMatrix);
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
CGContextSetTextDrawingMode(ctx, kCGTextFill);
- CGContextSetFont(ctx, cgFont);
CGContextSetTextPosition(ctx, pos_x, pos_y);
- CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
if (synthesisFlags & QFontEngine::SynthesizedBold) {
CGContextSetTextPosition(ctx, pos_x + 0.5 * lineThickness().toReal(), pos_y);
- CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
+ CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
}
} else {
// CGContextSetTextMatrix does not work with color glyphs, so we use
diff --git a/src/platformsupport/glxconvenience/glxconvenience.pri b/src/platformsupport/glxconvenience/glxconvenience.pri
index cc5b198f6c..80e79ee663 100644
--- a/src/platformsupport/glxconvenience/glxconvenience.pri
+++ b/src/platformsupport/glxconvenience/glxconvenience.pri
@@ -1,6 +1,6 @@
-contains(QT_CONFIG, xlib) {
- contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2) {
- contains(QT_CONFIG, xrender): LIBS_PRIVATE += -lXrender
+qtConfig(xlib) {
+ qtConfig(opengl):!qtConfig(opengles2) {
+ qtConfig(xrender): QMAKE_USE_PRIVATE += xrender
LIBS_PRIVATE += $$QMAKE_LIBS_X11
HEADERS += $$PWD/qglxconvenience_p.h
SOURCES += $$PWD/qglxconvenience.cpp
diff --git a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
index c058498ba0..445f230fa5 100644
--- a/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
+++ b/src/platformsupport/input/evdevkeyboard/evdevkeyboard.pri
@@ -7,6 +7,5 @@ SOURCES += \
$$PWD/qevdevkeyboardhandler.cpp \
$$PWD/qevdevkeyboardmanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevmouse/evdevmouse.pri b/src/platformsupport/input/evdevmouse/evdevmouse.pri
index 7e7a9e1629..a8c9c663f3 100644
--- a/src/platformsupport/input/evdevmouse/evdevmouse.pri
+++ b/src/platformsupport/input/evdevmouse/evdevmouse.pri
@@ -6,7 +6,6 @@ SOURCES += \
$$PWD/qevdevmousehandler.cpp \
$$PWD/qevdevmousemanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevtablet/evdevtablet.pri b/src/platformsupport/input/evdevtablet/evdevtablet.pri
index fb9489353c..ea1712ad2f 100644
--- a/src/platformsupport/input/evdevtablet/evdevtablet.pri
+++ b/src/platformsupport/input/evdevtablet/evdevtablet.pri
@@ -6,6 +6,5 @@ SOURCES += \
$$PWD/qevdevtablethandler.cpp \
$$PWD/qevdevtabletmanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri
index c2edc13143..58fafcd8f9 100644
--- a/src/platformsupport/input/evdevtouch/evdevtouch.pri
+++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri
@@ -6,12 +6,12 @@ SOURCES += \
$$PWD/qevdevtouchhandler.cpp \
$$PWD/qevdevtouchmanager.cpp
-contains(QT_CONFIG, libudev) {
- LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
-}
+INCLUDEPATH += $$PWD/../shared
+
+qtConfig(libudev): \
+ QMAKE_USE_PRIVATE += libudev
-contains(QT_CONFIG, mtdev) {
+qtConfig(mtdev) {
CONFIG += link_pkgconfig
PKGCONFIG_PRIVATE += mtdev
}
-
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 6b98ed30a9..32ec9d5452 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qevdevtouchhandler_p.h"
+#include "qtouchoutputmapping_p.h"
#include <QStringList>
#include <QHash>
#include <QSocketNotifier>
@@ -49,7 +50,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <linux/input.h>
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
extern "C" {
#include <mtdev.h>
}
@@ -116,6 +117,7 @@ public:
int findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist);
void addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates);
void reportPoints();
+ void loadMultiScreenMappings();
int hw_range_x_min;
int hw_range_x_max;
@@ -124,10 +126,12 @@ public:
int hw_pressure_min;
int hw_pressure_max;
QString hw_name;
+ QString deviceNode;
bool m_forceToActiveWindow;
bool m_typeB;
QTransform m_rotate;
bool m_singleTouch;
+ int m_screenIndex;
};
QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args)
@@ -137,7 +141,8 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co
hw_range_x_min(0), hw_range_x_max(0),
hw_range_y_min(0), hw_range_y_max(0),
hw_pressure_min(0), hw_pressure_max(0),
- m_typeB(false), m_singleTouch(false)
+ m_typeB(false), m_singleTouch(false),
+ m_screenIndex(-1)
{
m_forceToActiveWindow = args.contains(QLatin1String("force_window"));
}
@@ -145,7 +150,7 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co
#define LONG_BITS (sizeof(long) << 3)
#define NUM_LONGS(bits) (((bits) + LONG_BITS - 1) / LONG_BITS)
-#if defined(QT_NO_MTDEV)
+#if !QT_CONFIG(mtdev)
static inline bool testBit(long bit, const long *array)
{
return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1;
@@ -154,7 +159,7 @@ static inline bool testBit(long bit, const long *array)
QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const QString &spec, QObject *parent)
: QObject(parent), m_notify(Q_NULLPTR), m_fd(-1), d(Q_NULLPTR), m_device(Q_NULLPTR)
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
, m_mtdev(Q_NULLPTR)
#endif
{
@@ -198,7 +203,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
return;
}
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
m_mtdev = static_cast<mtdev *>(calloc(1, sizeof(mtdev)));
int mtdeverr = mtdev_open(m_mtdev, m_fd);
if (mtdeverr) {
@@ -210,7 +215,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
d = new QEvdevTouchScreenData(this, args);
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
const char *mtdevStr = "(mtdev)";
d->m_typeB = true;
#else
@@ -222,7 +227,9 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
}
#endif
- qCDebug(qLcEvdevTouch, "evdevtouch: %s: Protocol type %c %s (%s)", qPrintable(device),
+ d->deviceNode = device;
+
+ qCDebug(qLcEvdevTouch, "evdevtouch: %s: Protocol type %c %s (%s)", qPrintable(d->deviceNode),
d->m_typeB ? 'B' : 'A', mtdevStr, d->m_singleTouch ? "single" : "multi");
input_absinfo absInfo;
@@ -292,12 +299,20 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
if (inverty)
d->m_rotate *= QTransform::fromTranslate(0.5, 0.5).scale(1.0, -1.0).translate(-0.5, -0.5);
+ QTouchOutputMapping mapping;
+ if (mapping.load()) {
+ d->m_screenIndex = mapping.screenIndexForDeviceNode(d->deviceNode);
+ if (d->m_screenIndex >= 0)
+ qCDebug(qLcEvdevTouch, "evdevtouch: Mapping device %s to screen index %d",
+ qPrintable(d->deviceNode), d->m_screenIndex);
+ }
+
registerTouchDevice();
}
QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
{
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
if (m_mtdev) {
mtdev_close(m_mtdev);
free(m_mtdev);
@@ -322,7 +337,7 @@ void QEvdevTouchScreenHandler::readData()
::input_event buffer[32];
int events = 0;
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
forever {
do {
events = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event));
@@ -400,9 +415,13 @@ void QEvdevTouchScreenHandler::unregisterTouchDevice()
if (!m_device)
return;
- QWindowSystemInterface::unregisterTouchDevice(m_device);
+ // At app exit the cleanup may have already been done, avoid
+ // double delete by checking the list first.
+ if (QWindowSystemInterface::isTouchDeviceRegistered(m_device)) {
+ QWindowSystemInterface::unregisterTouchDevice(m_device);
+ delete m_device;
+ }
- delete m_device;
m_device = Q_NULLPTR;
}
@@ -643,8 +662,23 @@ void QEvdevTouchScreenData::reportPoints()
return;
winRect = QHighDpi::toNativePixels(win->geometry(), win);
} else {
- QScreen *primary = QGuiApplication::primaryScreen();
- winRect = QHighDpi::toNativePixels(primary->geometry(), primary);
+ // Now it becomes tricky. Traditionally we picked the primaryScreen()
+ // and were done with it. But then, enter multiple screens, and
+ // suddenly it was all broken.
+ //
+ // For now we only support the display configuration of the KMS/DRM
+ // backends of eglfs. See QTouchOutputMapping.
+ //
+ // The good news it that once winRect refers to the correct screen
+ // geometry in the full virtual desktop space, there is nothing else
+ // left to do since qguiapp will handle the rest.
+ QScreen *screen = QGuiApplication::primaryScreen();
+ if (m_screenIndex >= 0) {
+ const QList<QScreen *> screens = QGuiApplication::screens();
+ if (m_screenIndex < screens.count())
+ screen = screens.at(m_screenIndex);
+ }
+ winRect = QHighDpi::toNativePixels(screen->geometry(), screen);
}
const int hw_w = hw_range_x_max - hw_range_x_min;
@@ -675,10 +709,12 @@ void QEvdevTouchScreenData::reportPoints()
tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min);
}
+ // Let qguiapp pick the target window.
QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, q->touchDevice(), m_touchPoints);
}
+
QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent)
: QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(Q_NULLPTR), m_touchDeviceRegistered(false)
{
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index a423bbd2ef..b29aa3a793 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -58,7 +58,7 @@
#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
struct mtdev;
#endif
@@ -88,7 +88,7 @@ private:
int m_fd;
QEvdevTouchScreenData *d;
QTouchDevice *m_device;
-#if !defined(QT_NO_MTDEV)
+#if QT_CONFIG(mtdev)
mtdev *m_mtdev;
#endif
};
diff --git a/src/platformsupport/input/input.pri b/src/platformsupport/input/input.pri
index 3b9593eb31..eb4d8a983d 100644
--- a/src/platformsupport/input/input.pri
+++ b/src/platformsupport/input/input.pri
@@ -1,14 +1,18 @@
-contains(QT_CONFIG, evdev) {
+qtConfig(evdev) {
include($$PWD/evdevmouse/evdevmouse.pri)
include($$PWD/evdevkeyboard/evdevkeyboard.pri)
include($$PWD/evdevtouch/evdevtouch.pri)
include($$PWD/evdevtablet/evdevtablet.pri)
}
-contains(QT_CONFIG, tslib) {
+qtConfig(tslib) {
include($$PWD/tslib/tslib.pri)
}
-contains(QT_CONFIG, libinput) {
+qtConfig(libinput) {
include($$PWD/libinput/libinput.pri)
}
+
+qtConfig(evdev)|qtConfig(libinput) {
+ include($$PWD/shared/shared.pri)
+}
diff --git a/src/platformsupport/input/libinput/libinput.pri b/src/platformsupport/input/libinput/libinput.pri
index 35d962ff3c..f922769a37 100644
--- a/src/platformsupport/input/libinput/libinput.pri
+++ b/src/platformsupport/input/libinput/libinput.pri
@@ -10,14 +10,11 @@ SOURCES += \
$$PWD/qlibinputkeyboard.cpp \
$$PWD/qlibinputtouch.cpp
-INCLUDEPATH += $$QMAKE_INCDIR_LIBUDEV $$QMAKE_INCDIR_LIBINPUT
-LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV $$QMAKE_LIBS_LIBINPUT
+QMAKE_USE_PRIVATE += libudev libinput
-contains(QT_CONFIG, xkbcommon-evdev) {
- INCLUDEPATH += $$QMAKE_INCDIR_XKBCOMMON_EVDEV
- LIBS_PRIVATE += $$QMAKE_LIBS_XKBCOMMON_EVDEV
-} else {
- DEFINES += QT_NO_XKBCOMMON_EVDEV
-}
+INCLUDEPATH += $$PWD/../shared
-DEFINES += QT_LIBINPUT_VERSION_MAJOR=$$QMAKE_LIBINPUT_VERSION_MAJOR QT_LIBINPUT_VERSION_MINOR=$$QMAKE_LIBINPUT_VERSION_MINOR
+qtConfig(xkbcommon-evdev): \
+ QMAKE_USE_PRIVATE += xkbcommon_evdev
+else: \
+ DEFINES += QT_NO_XKBCOMMON_EVDEV
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index d5a3a8b437..3b583ec99d 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_LIBINPUT_VERSION_MAJOR == 0 && QT_LIBINPUT_VERSION_MINOR <= 7
+#if QT_LIBRARY_VERSION(libinput) < QT_VERSION_CHECK(0, 8, 0)
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/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index 0a0e9daccb..42925a18e1 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -41,6 +41,7 @@
#include <libinput.h>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
+#include <QtGui/private/qhighdpiscaling_p.h>
QT_BEGIN_NAMESPACE
@@ -63,10 +64,14 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e
static inline QPointF getPos(libinput_event_touch *e)
{
- const QSize screenSize = QGuiApplication::primaryScreen()->geometry().size();
- const double x = libinput_event_touch_get_x_transformed(e, screenSize.width());
- const double y = libinput_event_touch_get_y_transformed(e, screenSize.height());
- return QPointF(x, y);
+ // TODO Map to correct screen using QTouchOutputMapping.
+ // Perhaps investigate libinput_device_get_output_name as well.
+ // For now just use the primary screen.
+ QScreen *screen = QGuiApplication::primaryScreen();
+ const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen);
+ const double x = libinput_event_touch_get_x_transformed(e, geom.width());
+ const double y = libinput_event_touch_get_y_transformed(e, geom.height());
+ return geom.topLeft() + QPointF(x, y);
}
void QLibInputTouch::registerDevice(libinput_device *dev)
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping.cpp b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
new file mode 100644
index 0000000000..55c1dc34f4
--- /dev/null
+++ b/src/platformsupport/input/shared/qtouchoutputmapping.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins 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$
+**
+****************************************************************************/
+
+#include "qtouchoutputmapping_p.h"
+#include <QFile>
+#include <QVariantMap>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+
+QT_BEGIN_NAMESPACE
+
+bool QTouchOutputMapping::load()
+{
+ static QByteArray configFile = qgetenv("QT_QPA_EGLFS_KMS_CONFIG");
+ if (configFile.isEmpty())
+ return false;
+
+ QFile file(QString::fromUtf8(configFile));
+ if (!file.open(QFile::ReadOnly)) {
+ qWarning("touch input support: Failed to open %s", configFile.constData());
+ return false;
+ }
+
+ const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
+ if (!doc.isObject()) {
+ qWarning("touch input support: Failed to parse %s", configFile.constData());
+ return false;
+ }
+
+ // What we are interested is the virtualIndex and touchDevice properties for
+ // each element in the outputs array.
+ const QJsonArray outputs = doc.object().value(QLatin1String("outputs")).toArray();
+ for (int i = 0; i < outputs.size(); ++i) {
+ const QVariantMap output = outputs.at(i).toObject().toVariantMap();
+ if (!output.contains(QStringLiteral("touchDevice")))
+ continue;
+ if (!output.contains(QStringLiteral("virtualIndex"))) {
+ qWarning("evdevtouch: Output %d specifies touchDevice but not virtualIndex, this is wrong", i);
+ continue;
+ }
+ const QString &deviceNode = output.value(QStringLiteral("touchDevice")).toString();
+ const int screenIndex = output.value(QStringLiteral("virtualIndex")).toInt();
+ m_screenIndexTable.insert(deviceNode, screenIndex);
+ }
+
+ return true;
+}
+
+int QTouchOutputMapping::screenIndexForDeviceNode(const QString &deviceNode)
+{
+ return m_screenIndexTable.value(deviceNode, -1);
+}
+
+QT_END_NAMESPACE
diff --git a/src/platformsupport/input/shared/qtouchoutputmapping_p.h b/src/platformsupport/input/shared/qtouchoutputmapping_p.h
new file mode 100644
index 0000000000..74999d93ce
--- /dev/null
+++ b/src/platformsupport/input/shared/qtouchoutputmapping_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 QTOUCHOUTPUTMAPPING_P_H
+#define QTOUCHOUTPUTMAPPING_P_H
+
+//
+// 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.
+//
+
+#include <QString>
+#include <QHash>
+
+QT_BEGIN_NAMESPACE
+
+class QTouchOutputMapping
+{
+public:
+ bool load();
+ int screenIndexForDeviceNode(const QString &deviceNode);
+
+private:
+ QHash<QString, int> m_screenIndexTable;
+};
+
+QT_END_NAMESPACE
+
+#endif // QTOUCHOUTPUTMAPPING_P_H
diff --git a/src/platformsupport/input/shared/shared.pri b/src/platformsupport/input/shared/shared.pri
new file mode 100644
index 0000000000..1443235244
--- /dev/null
+++ b/src/platformsupport/input/shared/shared.pri
@@ -0,0 +1,5 @@
+HEADERS += \
+ $$PWD/qtouchoutputmapping_p.h
+
+SOURCES += \
+ $$PWD/qtouchoutputmapping.cpp
diff --git a/src/platformsupport/input/tslib/tslib.pri b/src/platformsupport/input/tslib/tslib.pri
index c9fef1ca8f..9efd126e13 100644
--- a/src/platformsupport/input/tslib/tslib.pri
+++ b/src/platformsupport/input/tslib/tslib.pri
@@ -4,4 +4,4 @@ HEADERS += \
SOURCES += \
$$PWD/qtslib.cpp
-LIBS += -lts
+QMAKE_USE += tslib
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index 2b81de43a7..f6c126a771 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -778,9 +778,8 @@ void AtSpiAdaptor::updateEventListeners()
QDBusReply<QSpiEventListenerArray> listenersReply = m_dbus->connection().call(m);
if (listenersReply.isValid()) {
const QSpiEventListenerArray evList = listenersReply.value();
- Q_FOREACH (const QSpiEventListener &ev, evList) {
+ for (const QSpiEventListener &ev : evList)
setBitFlag(ev.eventName);
- }
m_applicationAdaptor->sendEvents(!evList.isEmpty());
} else {
qAtspiDebug("Could not query active accessibility event listeners.");
@@ -1508,11 +1507,10 @@ QStringList AtSpiAdaptor::accessibleInterfaces(QAccessibleInterface *interface)
QSpiRelationArray AtSpiAdaptor::relationSet(QAccessibleInterface *interface, const QDBusConnection &connection) const
{
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
- QVector<RelationPair> relationInterfaces;
- relationInterfaces = interface->relations();
+ const QVector<RelationPair> relationInterfaces = interface->relations();
QSpiRelationArray relations;
- Q_FOREACH (const RelationPair &pair, relationInterfaces) {
+ for (const RelationPair &pair : relationInterfaces) {
// FIXME: this loop seems a bit strange... "related" always have one item when we check.
//And why is it a list, when it always have one item? And it seems to assume that the QAccessible::Relation enum maps directly to AtSpi
QSpiObjectReferenceArray related;
@@ -1757,24 +1755,20 @@ QSpiActionArray AtSpiAdaptor::getActions(QAccessibleInterface *interface) const
QSpiActionArray actions;
const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface);
actions.reserve(actionNames.size());
- Q_FOREACH (const QString &actionName, actionNames) {
+ for (const QString &actionName : actionNames) {
QSpiAction action;
- QStringList keyBindings;
action.name = actionName;
if (actionInterface) {
action.description = actionInterface->localizedActionDescription(actionName);
- keyBindings = actionInterface->keyBindingsForAction(actionName);
+ const QStringList keyBindings = actionInterface->keyBindingsForAction(actionName);
+ if (!keyBindings.isEmpty())
+ action.keyBinding = keyBindings.front();
} else {
action.description = qAccessibleLocalizedActionDescription(actionName);
}
- if (keyBindings.length() > 0)
- action.keyBinding = keyBindings[0];
- else
- action.keyBinding = QString();
-
- actions << action;
+ actions.append(std::move(action));
}
return actions;
}
@@ -2085,7 +2079,6 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in
QSpiAttributeSet map;
int startOffset;
int endOffset;
- bool defined;
joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset);
attributes = joined.split (QLatin1Char(';'), QString::SkipEmptyParts, Qt::CaseSensitive);
@@ -2097,7 +2090,7 @@ QVariantList AtSpiAdaptor::getAttributeValue(QAccessibleInterface *interface, in
map[attribute.name] = attribute.value;
}
mapped = map[attributeName];
- defined = mapped.isEmpty();
+ const bool defined = !mapped.isEmpty();
QVariantList list;
list << mapped << startOffset << endOffset << defined;
return list;
diff --git a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
index 1b65fb1cad..1f36b815cf 100644
--- a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
+++ b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, accessibility-atspi-bridge) {
+qtConfig(accessibility-atspi-bridge) {
QT_FOR_PRIVATE += dbus
include(../../3rdparty/atspi2/atspi2.pri)
diff --git a/src/platformsupport/platformcompositor/platformcompositor.pri b/src/platformsupport/platformcompositor/platformcompositor.pri
index 923d7225da..1e908c9998 100644
--- a/src/platformsupport/platformcompositor/platformcompositor.pri
+++ b/src/platformsupport/platformcompositor/platformcompositor.pri
@@ -1,4 +1,4 @@
-contains(QT_CONFIG, opengl) {
+qtConfig(opengl) {
SOURCES += $$PWD/qopenglcompositor.cpp \
$$PWD/qopenglcompositorbackingstore.cpp
diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro
index 9f6f3380e1..0f1d709997 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -25,7 +25,7 @@ include(platformcompositor/platformcompositor.pri)
# dbus convenience, but not for darwin: the platform
# plugins for these platforms do not use dbus and we
# don't want to create a false dependency.
-!darwin: contains(QT_CONFIG, dbus) {
+!darwin:qtConfig(dbus) {
include(dbusmenu/dbusmenu.pri)
include(dbustray/dbustray.pri)
}
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index 8028e65147..8078a5708c 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -8,7 +8,7 @@ TEMPLATE = subdirs
#win32:SUBDIRS += nla
win32:SUBDIRS += generic
win32:!winrt: SUBDIRS += nativewifi
-mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
+darwin:qtConfig(corewlan): SUBDIRS += corewlan
mac:SUBDIRS += generic
android:SUBDIRS += android
diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro
index ab0257aecd..1dc09ebdd6 100644
--- a/src/plugins/bearer/corewlan/corewlan.pro
+++ b/src/plugins/bearer/corewlan/corewlan.pro
@@ -3,7 +3,7 @@ TARGET = qcorewlanbearer
QT = core-private network-private
LIBS += -framework Foundation -framework SystemConfiguration
-contains(QT_CONFIG, corewlan) {
+qtConfig(corewlan) {
LIBS += -framework CoreWLAN -framework Security
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index b0bc8a265e..3cd9290420 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -553,14 +553,13 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
emit configurationAdded(ptr);
}
-bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
+bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath) const
{
- QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
- while (i.hasNext()) {
- i.next();
- if (i.value()->connection().path() == settingsPath) {
- if (i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
- || i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
+ for (QNetworkManagerConnectionActive *activeConnection : activeConnectionsList) {
+ if (activeConnection->connection().path() == settingsPath) {
+ const auto state = activeConnection->state();
+ if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
+ || state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
return true;
} else {
break;
@@ -848,9 +847,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
if (ofonoManager && ofonoManager->isValid()) {
const QString contextPart = connectionPath.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
+ for (auto i = ofonoContextManagers.cbegin(), end = ofonoContextManagers.cend(); i != end; ++i) {
const QString path = i.key() + QLatin1Char('/') +contextPart;
if (isActiveContext(path)) {
cpPriv->state |= QNetworkConfiguration::Active;
@@ -863,14 +860,12 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
return cpPriv;
}
-bool QNetworkManagerEngine::isActiveContext(const QString &contextPath)
+bool QNetworkManagerEngine::isActiveContext(const QString &contextPath) const
{
if (ofonoManager && ofonoManager->isValid()) {
const QString contextPart = contextPath.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
- PathPropertiesList list = i.value()->contextsWithProperties();
+ for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) {
+ const PathPropertiesList list = iface->contextsWithProperties();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).path.path().contains(contextPart)) {
return list.at(i).properties.value(QStringLiteral("Active")).toBool();
@@ -1012,10 +1007,7 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend()
QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration()
{
- QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
- while (i.hasNext()) {
- i.next();
- QNetworkManagerConnectionActive *activeConnection = i.value();
+ for (QNetworkManagerConnectionActive *activeConnection : qAsConst(activeConnectionsList)) {
if ((activeConnection->defaultRoute() || activeConnection->default6Route())) {
return accessPointConfigurations.value(activeConnection->connection().path());
}
@@ -1024,12 +1016,10 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration(
return QNetworkConfigurationPrivatePointer();
}
-QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id)
+QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id) const
{
QString contextPart = id.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
+ for (auto i = ofonoContextManagers.begin(), end = ofonoContextManagers.end(); i != end; ++i) {
QString contextPath = i.key() + QLatin1Char('/') +contextPart;
if (i.value()->contexts().contains(contextPath)) {
@@ -1055,13 +1045,11 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const
return QNetworkConfiguration::BearerUnknown;
}
-QString QNetworkManagerEngine::contextName(const QString &path)
+QString QNetworkManagerEngine::contextName(const QString &path) const
{
QString contextPart = path.section('/', -1);
- QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
- while (i.hasNext()) {
- i.next();
- PathPropertiesList list = i.value()->contextsWithProperties();
+ for (QOfonoDataConnectionManagerInterface *iface : ofonoContextManagers) {
+ const PathPropertiesList list = iface->contextsWithProperties();
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).path.path().contains(contextPart)) {
return list.at(i).properties.value(QStringLiteral("Name")).toString();
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index bfe2d746ec..ac70881f63 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -74,26 +74,26 @@ public:
bool networkManagerAvailable() const;
- QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
+ QString getInterfaceFromId(const QString &id) override;
+ bool hasIdentifier(const QString &id) override;
- void connectToId(const QString &id);
- void disconnectFromId(const QString &id);
+ void connectToId(const QString &id) override;
+ void disconnectFromId(const QString &id) override;
Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
- QNetworkSession::State sessionStateForId(const QString &id);
+ QNetworkSession::State sessionStateForId(const QString &id) override;
- quint64 bytesWritten(const QString &id);
- quint64 bytesReceived(const QString &id);
- quint64 startTime(const QString &id);
+ quint64 bytesWritten(const QString &id) override;
+ quint64 bytesReceived(const QString &id) override;
+ quint64 startTime(const QString &id) override;
- QNetworkConfigurationManager::Capabilities capabilities() const;
+ QNetworkConfigurationManager::Capabilities capabilities() const override;
- QNetworkSessionPrivate *createSessionBackend();
+ QNetworkSessionPrivate *createSessionBackend() override;
- QNetworkConfigurationPrivatePointer defaultConfiguration();
+ QNetworkConfigurationPrivatePointer defaultConfiguration() override;
private Q_SLOTS:
void interfacePropertiesChanged(const QMap<QString, QVariant> &properties);
@@ -140,14 +140,14 @@ private:
QOfonoManagerInterface *ofonoManager;
QHash <QString, QOfonoDataConnectionManagerInterface *> ofonoContextManagers;
- QNetworkConfiguration::BearerType currentBearerType(const QString &id);
- QString contextName(const QString &path);
+ QNetworkConfiguration::BearerType currentBearerType(const QString &id) const;
+ QString contextName(const QString &path) const;
- bool isConnectionActive(const QString &settingsPath);
+ bool isConnectionActive(const QString &settingsPath) const;
QDBusServiceWatcher *ofonoWatcher;
QDBusServiceWatcher *nmWatcher;
- bool isActiveContext(const QString &contextPath);
+ bool isActiveContext(const QString &contextPath) const;
bool nmAvailable;
void setupConfigurations();
};
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 6c3c661db6..081cb1288d 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -215,9 +215,7 @@ QString QNetworkManagerInterface::version() const
void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("State")) {
@@ -334,11 +332,8 @@ quint32 QNetworkManagerInterfaceAccessPoint::strength() const
void QNetworkManagerInterfaceAccessPoint::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
propertyMap.insert(i.key(),i.value());
- }
}
QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
@@ -421,9 +416,7 @@ QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const
void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
if (i.key() == QLatin1String("AvailableConnections")) { //Device
const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
QDBusObjectPath path;
@@ -516,9 +509,7 @@ QStringList QNetworkManagerInterfaceDeviceWired::availableConnections()
void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("Carrier"))
Q_EMIT carrierChanged(i.value().toBool());
@@ -694,9 +685,7 @@ void QNetworkManagerInterfaceDeviceWireless::requestScan()
void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless
Q_EMIT propertiesChanged(map);
@@ -753,11 +742,8 @@ QNetworkManagerInterfaceDeviceModem::ModemCapabilities QNetworkManagerInterfaceD
void QNetworkManagerInterfaceDeviceModem::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i)
propertyMap.insert(i.key(),i.value());
- }
Q_EMIT propertiesChanged(map);
}
@@ -1051,9 +1037,7 @@ bool QNetworkManagerConnectionActive::default6Route() const
void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
{
- QMapIterator<QString, QVariant> i(map);
- while (i.hasNext()) {
- i.next();
+ for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) {
propertyMap.insert(i.key(),i.value());
if (i.key() == QLatin1String("State")) {
quint32 state = i.value().toUInt();
diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro
index 182a60fdb5..c0a81d4dc8 100644
--- a/src/plugins/generic/generic.pro
+++ b/src/plugins/generic/generic.pro
@@ -2,11 +2,11 @@ TEMPLATE = subdirs
load(qfeatures)
-contains(QT_CONFIG, evdev) {
+qtConfig(evdev) {
SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet
}
-contains(QT_CONFIG, tslib) {
+qtConfig(tslib) {
SUBDIRS += tslib
}
@@ -14,7 +14,7 @@ contains(QT_CONFIG, tslib) {
SUBDIRS += tuiotouch
}
-contains(QT_CONFIG, libinput) {
+qtConfig(libinput) {
SUBDIRS += libinput
}
diff --git a/src/plugins/generic/tslib/tslib.pro b/src/plugins/generic/tslib/tslib.pro
index 200d231cc8..d6a0eea3a0 100644
--- a/src/plugins/generic/tslib/tslib.pro
+++ b/src/plugins/generic/tslib/tslib.pro
@@ -4,7 +4,7 @@ SOURCES = main.cpp
QT += gui-private platformsupport-private
-LIBS += -lts
+QMAKE_USE += tslib
OTHER_FILES += tslib.json
diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro
index 3de77c056d..d2588c1b18 100644
--- a/src/plugins/imageformats/imageformats.pro
+++ b/src/plugins/imageformats/imageformats.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-!contains(QT_CONFIG, no-ico):SUBDIRS += ico
-contains(QT_CONFIG, jpeg): SUBDIRS += jpeg
-contains(QT_CONFIG, gif): SUBDIRS += gif
+qtConfig(ico): SUBDIRS += ico
+qtConfig(jpeg): SUBDIRS += jpeg
+qtConfig(gif): SUBDIRS += gif
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index 8954cc6402..89476e62f5 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -5,11 +5,8 @@ QT += core-private gui-private
SOURCES += main.cpp qjpeghandler.cpp
HEADERS += main.h qjpeghandler_p.h
-contains(QT_CONFIG, system-jpeg) {
- msvc: \
- LIBS += libjpeg.lib
- else: \
- LIBS += -ljpeg
+qtConfig(system-jpeg) {
+ QMAKE_USE += libjpeg
} else {
include($$PWD/../../../3rdparty/libjpeg.pri)
}
diff --git a/src/plugins/platforminputcontexts/compose/compose.pro b/src/plugins/platforminputcontexts/compose/compose.pro
index 86bdd4729b..17284874f6 100644
--- a/src/plugins/platforminputcontexts/compose/compose.pro
+++ b/src/plugins/platforminputcontexts/compose/compose.pro
@@ -12,13 +12,10 @@ HEADERS += $$PWD/qcomposeplatforminputcontext.h \
$$PWD/generator/qtablegenerator.h \
# libxkbcommon
-contains(QT_CONFIG, xkbcommon-qt): {
- # dont't need x11 dependency for compose key plugin
- QT_CONFIG -= use-xkbcommon-x11support
+!qtConfig(xkbcommon-system) {
include(../../../3rdparty/xkbcommon.pri)
} else {
- LIBS += $$QMAKE_LIBS_XKBCOMMON
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+ QMAKE_USE += xkbcommon
}
OTHER_FILES += $$PWD/compose.json
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
index ac82fa3931..a2551f1320 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
@@ -73,10 +73,7 @@ void QIBusSerializable::serializeTo(QDBusArgument &argument) const
argument.beginMap(qMetaTypeId<QString>(), qMetaTypeId<QDBusVariant>());
- QHashIterator<QString, QDBusArgument> i(attachments);
- while (i.hasNext()) {
- i.next();
-
+ for (auto i = attachments.begin(), end = attachments.end(); i != end; ++i) {
argument.beginMapEntry();
argument << i.key();
diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro
index faea54b874..f22b8b69db 100644
--- a/src/plugins/platforminputcontexts/platforminputcontexts.pro
+++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro
@@ -4,6 +4,6 @@ qtHaveModule(dbus) {
!mac:!win32:SUBDIRS += ibus
}
-contains(QT_CONFIG, xcb-plugin): SUBDIRS += compose
+qtConfig(xcb): SUBDIRS += compose
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index 5be128a0c5..5f05ab395e 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -1,7 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
-** Contact: https://www.qt.io/licensing/
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -120,6 +121,12 @@ namespace QtAndroidInput
return m_softwareKeyboardRect;
}
+ void updateHandles(int mode, QPoint cursor, QPoint anchor)
+ {
+ QJNIObjectPrivate::callStaticMethod<void>(applicationClass(), "updateHandles", "(IIIII)V",
+ mode, cursor.x(), cursor.y(), anchor.x(),
+ anchor.y());
+ }
static void mouseDown(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
{
@@ -168,6 +175,10 @@ namespace QtAndroidInput
static void longPress(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint x, jint y)
{
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext && qGuiApp)
+ QMetaObject::invokeMethod(inputContext, "longPress", Q_ARG(int, x), Q_ARG(int, y));
+
//### TODO: add proper API for Qt 5.2
static bool rightMouseFromLongPress = qEnvironmentVariableIntValue("QT_NECESSITAS_COMPATIBILITY_LONG_PRESS");
if (!rightMouseFromLongPress)
@@ -225,6 +236,12 @@ namespace QtAndroidInput
double(dw*size),
double(dh*size));
m_touchPoints.push_back(touchPoint);
+
+ if (state == Qt::TouchPointPressed) {
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext && qGuiApp)
+ QMetaObject::invokeMethod(inputContext, "touchDown", Q_ARG(int, x), Q_ARG(int, y));
+ }
}
static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint /*action*/)
@@ -786,6 +803,18 @@ namespace QtAndroidInput
#endif
}
+ static void handleLocationChanged(JNIEnv */*env*/, jobject /*thiz*/, int id, int x, int y)
+ {
+#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
+ qDebug() << "@@@ handleLocationChanged" << id << x << y;
+#endif
+ QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
+ if (inputContext && qGuiApp)
+ QMetaObject::invokeMethod(inputContext, "handleLocationChanged",
+ Q_ARG(int, id), Q_ARG(int, x), Q_ARG(int, y));
+
+ }
+
static JNINativeMethod methods[] = {
{"touchBegin","(I)V",(void*)touchBegin},
{"touchAdd","(IIIZIIFF)V",(void*)touchAdd},
@@ -799,7 +828,8 @@ namespace QtAndroidInput
{"keyDown", "(IIIZ)V", (void *)keyDown},
{"keyUp", "(IIIZ)V", (void *)keyUp},
{"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged},
- {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged}
+ {"keyboardGeometryChanged", "(IIII)V", (void *)keyboardGeometryChanged},
+ {"handleLocationChanged", "(III)V", (void *)handleLocationChanged}
};
bool registerNatives(JNIEnv *env)
diff --git a/src/plugins/platforms/android/androidjniinput.h b/src/plugins/platforms/android/androidjniinput.h
index 682abde098..af18a96dc1 100644
--- a/src/plugins/platforms/android/androidjniinput.h
+++ b/src/plugins/platforms/android/androidjniinput.h
@@ -39,6 +39,7 @@
#ifndef ANDROIDJNIINPUT_H
#define ANDROIDJNIINPUT_H
+
#include <jni.h>
#include <QtCore/qglobal.h>
#include <QtCore/QRect>
@@ -56,6 +57,9 @@ namespace QtAndroidInput
void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd);
// Software keyboard support
+ // cursor/selection handles
+ void updateHandles(int handleCount, QPoint cursor = QPoint(), QPoint anchor = QPoint());
+
bool registerNatives(JNIEnv *env);
}
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 6419ba2c51..677a2e2626 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -550,8 +550,11 @@ static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/)
static void terminateQt(JNIEnv *env, jclass /*clazz*/)
{
- sem_wait(&m_terminateSemaphore);
- sem_destroy(&m_terminateSemaphore);
+ // QAndroidEventDispatcherStopper is stopped when the user uses the task manager to kill the application
+ if (!QAndroidEventDispatcherStopper::instance()->stopped()) {
+ sem_wait(&m_terminateSemaphore);
+ sem_destroy(&m_terminateSemaphore);
+ }
env->DeleteGlobalRef(m_applicationClass);
env->DeleteGlobalRef(m_classLoaderObject);
if (m_resourcesObj)
@@ -571,8 +574,11 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/)
m_androidPlatformIntegration = nullptr;
delete m_androidAssetsFileEngineHandler;
m_androidAssetsFileEngineHandler = nullptr;
- sem_post(&m_exitSemaphore);
- pthread_join(m_qtAppThread, nullptr);
+
+ if (!QAndroidEventDispatcherStopper::instance()->stopped()) {
+ sem_post(&m_exitSemaphore);
+ pthread_join(m_qtAppThread, nullptr);
+ }
}
static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, jint w, jint h)
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 125a03469f..06a9c8c488 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -2,6 +2,7 @@
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -342,9 +343,28 @@ static JNINativeMethod methods[] = {
{"updateCursorPosition", "()Z", (void *)updateCursorPosition}
};
+static QRect inputItemRectangle()
+{
+ QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle();
+ QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect();
+ QWindow *window = qGuiApp->focusWindow();
+ if (window)
+ rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
+ double pixelDensity = window
+ ? QHighDpiScaling::factor(window)
+ : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
+ if (pixelDensity != 1.0) {
+ rect.setX(rect.x() * pixelDensity);
+ rect.setY(rect.y() * pixelDensity);
+ rect.setWidth(rect.width() * pixelDensity);
+ rect.setHeight(rect.height() * pixelDensity);
+ }
+ return rect;
+}
QAndroidInputContext::QAndroidInputContext()
- : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false), m_batchEditNestingLevel(0), m_focusObject(0)
+ : QPlatformInputContext(), m_composingTextStart(-1), m_blockUpdateSelection(false),
+ m_cursorHandleShown(CursorHandleNotShown), m_batchEditNestingLevel(0), m_focusObject(0)
{
jclass clazz = QJNIEnvironmentPrivate::findClass(QtNativeInputConnectionClassName);
if (Q_UNLIKELY(!clazz)) {
@@ -415,6 +435,9 @@ QAndroidInputContext::QAndroidInputContext()
qRegisterMetaType<QInputMethodEvent *>("QInputMethodEvent*");
qRegisterMetaType<QInputMethodQueryEvent *>("QInputMethodQueryEvent*");
m_androidInputContext = this;
+
+ QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged,
+ this, &QAndroidInputContext::updateSelectionHandles);
}
QAndroidInputContext::~QAndroidInputContext()
@@ -452,6 +475,7 @@ void QAndroidInputContext::reset()
{
clear();
m_batchEditNestingLevel = 0;
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown;
if (qGuiApp->focusObject()) {
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe(Qt::ImEnabled);
if (!query.isNull() && query->value(Qt::ImEnabled).toBool()) {
@@ -500,6 +524,119 @@ void QAndroidInputContext::updateCursorPosition()
}
}
+void QAndroidInputContext::updateSelectionHandles()
+{
+ auto im = qGuiApp->inputMethod();
+ if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) {
+ // Hide the handles
+ QtAndroidInput::updateHandles(0);
+ return;
+ }
+ QWindow *window = qGuiApp->focusWindow();
+ double pixelDensity = window
+ ? QHighDpiScaling::factor(window)
+ : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImEnabled);
+ QCoreApplication::sendEvent(m_focusObject, &query);
+ int cpos = query.value(Qt::ImCursorPosition).toInt();
+ int anchor = query.value(Qt::ImAnchorPosition).toInt();
+
+ if (cpos == anchor || im->anchorRectangle().isNull()) {
+ if (!query.value(Qt::ImEnabled).toBool()) {
+ QtAndroidInput::updateHandles(0);
+ return;
+ }
+
+ auto curRect = im->cursorRectangle();
+ QPoint cursorPoint(curRect.center().x(), curRect.bottom());
+ QPoint editMenuPoint(curRect.center().x(), curRect.top());
+ QtAndroidInput::updateHandles(m_cursorHandleShown, cursorPoint * pixelDensity,
+ editMenuPoint * pixelDensity);
+ return;
+ }
+
+ auto leftRect = im->cursorRectangle();
+ auto rightRect = im->anchorRectangle();
+ if (cpos > anchor)
+ std::swap(leftRect, rightRect);
+
+ QPoint leftPoint(leftRect.bottomLeft().toPoint() * pixelDensity);
+ QPoint righPoint(rightRect.bottomRight().toPoint() * pixelDensity);
+ QtAndroidInput::updateHandles(CursorHandleShowSelection, leftPoint, righPoint);
+
+ if (m_cursorHandleShown == CursorHandleShowPopup) {
+ // make sure the popup does not reappear when the selection menu closes
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown;
+ }
+}
+
+/*
+ Called from Java when a cursor/selection handle was dragged to a new position
+
+ handleId of 1 means the cursor handle, 2 means the left handle, 3 means the right handle
+ */
+void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y)
+{
+ auto im = qGuiApp->inputMethod();
+ auto leftRect = im->cursorRectangle();
+ // The handle is down of the cursor, but we want the position in the middle.
+ QWindow *window = qGuiApp->focusWindow();
+ double pixelDensity = window
+ ? QHighDpiScaling::factor(window)
+ : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
+ QPoint point(x / pixelDensity, y / pixelDensity);
+ y -= leftRect.width() / 2;
+ if (handleId == 1) {
+ setSelectionOnFocusObject(point, point);
+ return;
+ }
+
+ QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition);
+ QCoreApplication::sendEvent(m_focusObject, &query);
+ int cpos = query.value(Qt::ImCursorPosition).toInt();
+ int anchor = query.value(Qt::ImAnchorPosition).toInt();
+
+ auto rightRect = im->anchorRectangle();
+ if (cpos > anchor)
+ std::swap(leftRect, rightRect);
+
+ if (handleId == 2) {
+ QPoint rightPoint(rightRect.center().toPoint());
+ setSelectionOnFocusObject(point, rightPoint);
+ } else if (handleId == 3) {
+ QPoint leftPoint(leftRect.center().toPoint());
+ setSelectionOnFocusObject(leftPoint, point);
+ }
+}
+
+void QAndroidInputContext::touchDown(int x, int y)
+{
+ if (m_focusObject && inputItemRectangle().contains(x, y) && !m_cursorHandleShown) {
+ // If the user touch the input rectangle, we can show the cursor handle
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleShowNormal;
+ updateSelectionHandles();
+ }
+}
+
+void QAndroidInputContext::longPress(int x, int y)
+{
+ if (m_focusObject && inputItemRectangle().contains(x, y)) {
+ // Show the paste menu if there is something to paste.
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleShowPopup;
+ updateSelectionHandles();
+ }
+}
+
+void QAndroidInputContext::keyDown()
+{
+ if (m_cursorHandleShown) {
+ // When the user enter text on the keyboard, we hide the cursor handle
+ m_cursorHandleShown = QAndroidInputContext::CursorHandleNotShown;
+ updateSelectionHandles();
+ }
+}
+
void QAndroidInputContext::update(Qt::InputMethodQueries queries)
{
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe(queries);
@@ -543,22 +680,11 @@ void QAndroidInputContext::showInputPanel()
m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateCursorPosition()));
else
m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
- QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle();
- QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect();
- QWindow *window = qGuiApp->focusWindow();
- if (window)
- rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
- double pixelDensity = window ? QHighDpiScaling::factor(window)
- : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen());
-
- QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity,
- rect.top() * pixelDensity,
- rect.width() * pixelDensity,
- rect.height() * pixelDensity,
+ QRect rect = inputItemRectangle();
+ QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(),
query->value(Qt::ImHints).toUInt(),
- query->value(Qt::ImEnterKeyType).toUInt()
- );
+ query->value(Qt::ImEnterKeyType).toUInt());
}
void QAndroidInputContext::showInputPanelLater(Qt::ApplicationState state)
@@ -601,6 +727,7 @@ void QAndroidInputContext::setFocusObject(QObject *object)
reset();
}
QPlatformInputContext::setFocusObject(object);
+ updateSelectionHandles();
}
jboolean QAndroidInputContext::beginBatchEdit()
@@ -858,6 +985,8 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur
QInputMethodEvent event(m_composingText, attributes);
sendInputMethodEventThreadSafe(&event);
+ QMetaObject::invokeMethod(this, "keyDown");
+
updateCursorPosition();
return JNI_TRUE;
@@ -979,20 +1108,21 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end)
jboolean QAndroidInputContext::selectAll()
{
-#warning TODO
- return JNI_FALSE;
+ sendShortcut(QKeySequence::SelectAll);
+ return JNI_TRUE;
}
jboolean QAndroidInputContext::cut()
{
-#warning TODO
- return JNI_FALSE;
+ m_cursorHandleShown = CursorHandleNotShown;
+ sendShortcut(QKeySequence::Cut);
+ return JNI_TRUE;
}
jboolean QAndroidInputContext::copy()
{
-#warning TODO
- return JNI_FALSE;
+ sendShortcut(QKeySequence::Copy);
+ return JNI_TRUE;
}
jboolean QAndroidInputContext::copyURL()
@@ -1003,10 +1133,21 @@ jboolean QAndroidInputContext::copyURL()
jboolean QAndroidInputContext::paste()
{
-#warning TODO
- return JNI_FALSE;
+ m_cursorHandleShown = CursorHandleNotShown;
+ sendShortcut(QKeySequence::Paste);
+ return JNI_TRUE;
}
+void QAndroidInputContext::sendShortcut(const QKeySequence &sequence)
+{
+ for (int i = 0; i < sequence.count(); ++i) {
+ const int keys = sequence[i];
+ Qt::Key key = Qt::Key(keys & ~Qt::KeyboardModifierMask);
+ Qt::KeyboardModifiers mod = Qt::KeyboardModifiers(keys & Qt::KeyboardModifierMask);
+ QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyPress, key, mod));
+ QGuiApplication::postEvent(m_focusObject, new QKeyEvent(QEvent::KeyRelease, key, mod));
+ }
+}
Q_INVOKABLE QVariant QAndroidInputContext::queryFocusObjectUnsafe(Qt::InputMethodQuery query, QVariant argument)
{
diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h
index 5ab85dcab0..8a33ff71cc 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.h
+++ b/src/plugins/platforms/android/qandroidinputcontext.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
+** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -94,6 +95,7 @@ public:
bool isComposing() const;
void clear();
void setFocusObject(QObject *object);
+ void sendShortcut(const QKeySequence &);
//---------------//
jboolean beginBatchEdit();
@@ -117,6 +119,11 @@ public:
public slots:
void updateCursorPosition();
+ void updateSelectionHandles();
+ void handleLocationChanged(int handleId, int x, int y);
+ void touchDown(int x, int y);
+ void longPress(int x, int y);
+ void keyDown();
private slots:
void showInputPanelLater(Qt::ApplicationState);
@@ -138,6 +145,13 @@ private:
int m_composingCursor;
QMetaObject::Connection m_updateCursorPosConnection;
bool m_blockUpdateSelection;
+ enum CursorHandleShowMode {
+ CursorHandleNotShown,
+ CursorHandleShowNormal = 1,
+ CursorHandleShowSelection = 2,
+ CursorHandleShowPopup = 3
+ };
+ CursorHandleShowMode m_cursorHandleShown;
int m_batchEditNestingLevel;
QObject *m_focusObject;
};
diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
index 0667a9073f..a14271c8f5 100644
--- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
+++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp
@@ -60,7 +60,8 @@ void QAndroidPlatformFontDatabase::populateFontDatabase()
QStringList nameFilters;
nameFilters << QLatin1String("*.ttf")
- << QLatin1String("*.otf");
+ << QLatin1String("*.otf")
+ << QLatin1String("*.ttc");
const auto entries = dir.entryInfoList(nameFilters, QDir::Files);
for (const QFileInfo &fi : entries) {
diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
index edb4f4e660..e935d89c9f 100644
--- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
+++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
@@ -48,7 +48,7 @@
#include <qpa/qplatforminputcontext.h>
#include <qpa/qplatforminputcontextfactory_p.h>
-#if !defined(QT_NO_TSLIB)
+#if QT_CONFIG(tslib)
#include <QtPlatformSupport/private/qtslib_p.h>
#endif
@@ -127,7 +127,7 @@ QPlatformServices *QBsdFbIntegration::services() const
void QBsdFbIntegration::createInputHandlers()
{
-#ifndef QT_NO_TSLIB
+#if QT_CONFIG(tslib)
const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString());
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 02d8b16110..d9d3cb1627 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -71,7 +71,7 @@ HEADERS += qcocoaintegration.h \
messages.h \
qcocoamimetypes.h
-contains(QT_CONFIG, opengl.*) {
+qtConfig(opengl.*) {
OBJECTIVE_SOURCES += qcocoaglcontext.mm
HEADERS += qcocoaglcontext.h
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index 1ebcde0584..13ae0382ab 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -40,6 +40,9 @@
#include "qcocoadrag.h"
#include "qmacclipboard.h"
#include "qcocoahelpers.h"
+#ifndef QT_NO_WIDGETS
+#include <QtWidgets/qwidget.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -187,7 +190,18 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const
const int width = fm.width(s);
const int height = fm.height();
if (width > 0 && height > 0) {
- pm = QPixmap(width, height);
+ qreal dpr = 1.0;
+ if (const QWindow *sourceWindow = qobject_cast<QWindow *>(drag->source())) {
+ dpr = sourceWindow->devicePixelRatio();
+ }
+#ifndef QT_NO_WIDGETS
+ else if (const QWidget *sourceWidget = qobject_cast<QWidget *>(drag->source())) {
+ if (const QWindow *sourceWindow = sourceWidget->window()->windowHandle())
+ dpr = sourceWindow->devicePixelRatio();
+ }
+#endif
+ pm = QPixmap(width * dpr, height * dpr);
+ pm.setDevicePixelRatio(dpr);
QPainter p(&pm);
p.fillRect(0, 0, pm.width(), pm.height(), Qt::color0);
p.setPen(Qt::color1);
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 0375dd85f2..31a0a3d600 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -589,6 +589,15 @@ void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_panelClosed(bool accepted)
QCocoaMenuBar::resetKnownMenuItemsToQt();
if (accepted) {
emit accept();
+
+ QString filter = selectedNameFilter();
+ if (filter.isEmpty())
+ emit filterSelected(filter);
+
+ QList<QUrl> files = selectedFiles();
+ emit filesSelected(files);
+ if (files.count() == 1)
+ emit fileSelected(files.first());
} else {
emit reject();
}
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
index dc7dfb788f..dfda22d376 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm
@@ -365,6 +365,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
emit mHelper->reject();
} else {
emit mHelper->accept();
+ emit mHelper->fontSelected(mHelper->currentFont());
}
}
}
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 9b4055d92d..6920f75887 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -101,65 +101,23 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list)
return result;
}
-static void qt_mac_deleteImage(void *image, const void *, size_t)
-{
- delete static_cast<QImage *>(image);
-}
-
-// Creates a CGDataProvider with the data from the given image.
-// The data provider retains a copy of the image.
-CGDataProviderRef qt_mac_CGDataProvider(const QImage &image)
-{
- return CGDataProviderCreateWithData(new QImage(image), image.bits(),
- image.byteCount(), qt_mac_deleteImage);
-}
-
CGImageRef qt_mac_toCGImage(const QImage &inImage)
{
- if (inImage.isNull())
- return 0;
+ CGImageRef cgImage = inImage.toCGImage();
+ if (cgImage)
+ return cgImage;
- QImage image = inImage;
-
- uint cgflags = kCGImageAlphaNone;
- switch (image.format()) {
- case QImage::Format_ARGB32:
- cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
- break;
- case QImage::Format_RGB32:
- cgflags = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host;
- break;
- case QImage::Format_RGB888:
- cgflags = kCGImageAlphaNone | kCGBitmapByteOrder32Big;
- break;
- case QImage::Format_RGBA8888_Premultiplied:
- cgflags = kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big;
- break;
- case QImage::Format_RGBA8888:
- cgflags = kCGImageAlphaLast | kCGBitmapByteOrder32Big;
- break;
- case QImage::Format_RGBX8888:
- cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
- break;
- default:
- // Everything not recognized explicitly is converted to ARGB32_Premultiplied.
- image = inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- // no break;
- case QImage::Format_ARGB32_Premultiplied:
- cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
- break;
- }
-
- QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
- return CGImageCreate(image.width(), image.height(), 8, 32,
- image.bytesPerLine(),
- qt_mac_genericColorSpace(),
- cgflags, dataProvider, 0, false, kCGRenderingIntentDefault);
+ // Convert image data to a known-good format if the fast conversion fails.
+ return inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied).toCGImage();
}
CGImageRef qt_mac_toCGImageMask(const QImage &image)
{
- QCFType<CGDataProviderRef> dataProvider = qt_mac_CGDataProvider(image);
+ static const auto deleter = [](void *image, const void *, size_t) { delete static_cast<QImage *>(image); };
+ QCFType<CGDataProviderRef> dataProvider =
+ CGDataProviderCreateWithData(new QImage(image), image.bits(),
+ image.byteCount(), deleter);
+
return CGImageMaskCreate(image.width(), image.height(), 8, image.depth(),
image.bytesPerLine(), dataProvider, NULL, false);
}
@@ -647,7 +605,7 @@ QString qt_mac_removeAmpersandEscapes(QString s)
returned if it can't be obtained. It is the caller's responsibility to
CGContextRelease the context when finished using it.
- \warning This function is only available on OS X.
+ \warning This function is only available on \macos.
\warning This function is duplicated in qmacstyle_mac.mm
*/
CGContextRef qt_mac_cg_context(QPaintDevice *pdev)
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 3a3d634f5a..cb8ffee556 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -287,7 +287,8 @@ public:
const qreal devicePixelRatio = qGuiApp->devicePixelRatio();
const int sizes[] = {
qRound(16 * devicePixelRatio), qRound(32 * devicePixelRatio),
- qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio)
+ qRound(64 * devicePixelRatio), qRound(128 * devicePixelRatio),
+ qRound(256 * devicePixelRatio)
};
return QAbstractFileIconEngine::toSizeList(sizes, sizes + sizeof(sizes) / sizeof(sizes[0]));
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 500049a504..af324c07ff 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1999,16 +1999,27 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
return target->mapFromGlobal(source->mapToGlobal(point));
}
-- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL)isLocal
+- (NSDragOperation)draggingSession:(NSDraggingSession *)session
+ sourceOperationMaskForDraggingContext:(NSDraggingContext)context
{
- Q_UNUSED(isLocal);
+ Q_UNUSED(session);
+ Q_UNUSED(context);
QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag();
return qt_mac_mapDropActions(nativeDrag->currentDrag()->supportedActions());
}
-- (BOOL) ignoreModifierKeysWhileDragging
+- (BOOL)ignoreModifierKeysForDraggingSession:(NSDraggingSession *)session
{
- return NO;
+ Q_UNUSED(session);
+ // According to the "Dragging Sources" chapter on Cocoa DnD Programming
+ // (https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragsource.html),
+ // if the control, option, or command key is pressed, the source’s
+ // operation mask is filtered to only contain a reduced set of operations.
+ //
+ // Since Qt already takes care of tracking the keyboard modifiers, we
+ // don't need (or want) Cocoa to filter anything. Instead, we'll let
+ // the application do the actual filtering.
+ return YES;
}
- (BOOL)wantsPeriodicDraggingUpdates
@@ -2165,27 +2176,27 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
return response.isAccepted();
}
-- (void)draggedImage:(NSImage*) img endedAt:(NSPoint) point operation:(NSDragOperation) operation
+- (void)draggingSession:(NSDraggingSession *)session
+ endedAtPoint:(NSPoint)screenPoint
+ operation:(NSDragOperation)operation
{
- Q_UNUSED(img);
+ Q_UNUSED(session);
Q_UNUSED(operation);
QWindow *target = findEventTargetWindow(m_window);
if (!target)
return;
-// keep our state, and QGuiApplication state (buttons member) in-sync,
-// or future mouse events will be processed incorrectly
+ // keep our state, and QGuiApplication state (buttons member) in-sync,
+ // or future mouse events will be processed incorrectly
NSUInteger pmb = [NSEvent pressedMouseButtons];
for (int buttonNumber = 0; buttonNumber < 32; buttonNumber++) { // see cocoaButton2QtButton() for the 32 value
if (!(pmb & (1 << buttonNumber)))
m_buttons &= ~cocoaButton2QtButton(buttonNumber);
}
- NSPoint windowPoint = [self convertPoint: point fromView: nil];
+ NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin;
QPoint qtWindowPoint(windowPoint.x, windowPoint.y);
- NSWindow *window = [self window];
- NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(point.x, point.y, 0, 0)].origin;
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_window, target, qtWindowPoint), qtScreenPoint, m_buttons);
diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro
index 5c81e0283a..de0344ff5c 100644
--- a/src/plugins/platforms/directfb/directfb.pro
+++ b/src/plugins/platforms/directfb/directfb.pro
@@ -2,8 +2,7 @@ TARGET = qdirectfb
QT += core-private gui-private platformsupport-private
-LIBS += $$QMAKE_LIBS_DIRECTFB
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DIRECTFB
+QMAKE_USE += directfb
SOURCES = main.cpp \
qdirectfbintegration.cpp \
@@ -25,7 +24,7 @@ HEADERS = qdirectfbintegration.h \
qdirectfbeglhooks.h
# ### port the GL context
-contains(QT_CONFIG, directfb_egl) {
+qtConfig(directfb_egl) {
HEADERS += qdirectfb_egl.h
SOURCES += qdirectfb_egl.cpp
DEFINES += DIRECTFB_GL_EGL
diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
index 0e706d789a..2a04c0bba3 100644
--- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp
+++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
@@ -49,7 +49,7 @@
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index 7c1f11372a..0040ecd59d 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -59,12 +59,11 @@
QT_BEGIN_NAMESPACE
QEglFSCursor::QEglFSCursor(QPlatformScreen *screen)
- : m_visible(true),
- m_screen(static_cast<QEglFSScreen *>(screen)),
- m_program(0),
- m_textureEntry(0),
- m_deviceListener(0),
- m_updateRequested(false)
+ : m_visible(true),
+ m_screen(static_cast<QEglFSScreen *>(screen)),
+ m_activeScreen(nullptr),
+ m_deviceListener(0),
+ m_updateRequested(false)
{
QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR");
if (!hideCursorVal.isEmpty())
@@ -116,15 +115,14 @@ void QEglFSCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::Device
void QEglFSCursor::resetResources()
{
- if (QOpenGLContext::currentContext()) {
- delete m_program;
- glDeleteTextures(1, &m_cursor.customCursorTexture);
- glDeleteTextures(1, &m_cursorAtlas.texture);
+ if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) {
+ GraphicsContextData &gfx(m_gfx[ctx]);
+ delete gfx.program;
+ glDeleteTextures(1, &gfx.customCursorTexture);
+ glDeleteTextures(1, &gfx.atlasTexture);
+ gfx = GraphicsContextData();
}
- m_program = 0;
- m_cursor.customCursorTexture = 0;
m_cursor.customCursorPending = !m_cursor.customCursorImage.isNull();
- m_cursorAtlas.texture = 0;
}
void QEglFSCursor::createShaderPrograms()
@@ -146,15 +144,16 @@ void QEglFSCursor::createShaderPrograms()
" gl_FragColor = texture2D(texture, textureCoord).bgra;\n"
"}\n";
- m_program = new QOpenGLShaderProgram;
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
- m_program->bindAttributeLocation("vertexCoordEntry", 0);
- m_program->bindAttributeLocation("textureCoordEntry", 1);
- m_program->link();
+ GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]);
+ gfx.program = new QOpenGLShaderProgram;
+ gfx.program->addShaderFromSourceCode(QOpenGLShader::Vertex, textureVertexProgram);
+ gfx.program->addShaderFromSourceCode(QOpenGLShader::Fragment, textureFragmentProgram);
+ gfx.program->bindAttributeLocation("vertexCoordEntry", 0);
+ gfx.program->bindAttributeLocation("textureCoordEntry", 1);
+ gfx.program->link();
- m_textureEntry = m_program->uniformLocation("texture");
- m_matEntry = m_program->uniformLocation("mat");
+ gfx.textureEntry = gfx.program->uniformLocation("texture");
+ gfx.matEntry = gfx.program->uniformLocation("mat");
}
void QEglFSCursor::createCursorTexture(uint *texture, const QImage &image)
@@ -214,7 +213,7 @@ void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window)
Q_UNUSED(window);
const QRect oldCursorRect = cursorRect();
if (setCurrentCursor(cursor))
- update(oldCursorRect | cursorRect());
+ update(oldCursorRect | cursorRect(), false);
}
bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
@@ -238,16 +237,17 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
hs * (m_cursor.shape / m_cursorAtlas.cursorsPerRow),
ws, hs);
m_cursor.hotSpot = m_cursorAtlas.hotSpots[m_cursor.shape];
- m_cursor.texture = m_cursorAtlas.texture;
+ m_cursor.useCustomCursor = false;
m_cursor.size = QSize(m_cursorAtlas.cursorWidth, m_cursorAtlas.cursorHeight);
} else {
QImage image = cursor->pixmap().toImage();
m_cursor.textureRect = QRectF(0, 0, 1, 1);
m_cursor.hotSpot = cursor->hotSpot();
- m_cursor.texture = 0; // will get updated in the next render()
+ m_cursor.useCustomCursor = false; // will get updated in the next render()
m_cursor.size = image.size();
m_cursor.customCursorImage = image;
m_cursor.customCursorPending = true;
+ m_cursor.customCursorKey = m_cursor.customCursorImage.cacheKey();
}
return true;
@@ -257,17 +257,20 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor)
class CursorUpdateEvent : public QEvent
{
public:
- CursorUpdateEvent(const QPoint &pos, const QRegion &rgn)
+ CursorUpdateEvent(const QPoint &pos, const QRect &rect, bool allScreens)
: QEvent(QEvent::Type(QEvent::User + 1)),
m_pos(pos),
- m_region(rgn)
+ m_rect(rect),
+ m_allScreens(allScreens)
{ }
QPoint pos() const { return m_pos; }
- QRegion region() const { return m_region; }
+ QRegion rect() const { return m_rect; }
+ bool allScreens() const { return m_allScreens; }
private:
QPoint m_pos;
- QRegion m_region;
+ QRect m_rect;
+ bool m_allScreens;
};
bool QEglFSCursor::event(QEvent *e)
@@ -275,21 +278,30 @@ bool QEglFSCursor::event(QEvent *e)
if (e->type() == QEvent::User + 1) {
CursorUpdateEvent *ev = static_cast<CursorUpdateEvent *>(e);
m_updateRequested = false;
- QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(ev->pos()), ev->region());
- QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
+ if (!ev->allScreens()) {
+ QWindow *w = m_screen->topLevelAt(ev->pos()); // works for the entire virtual desktop, no need to loop
+ if (w) {
+ QWindowSystemInterface::handleExposeEvent(w, ev->rect());
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
+ }
+ } else {
+ for (QWindow *w : qGuiApp->topLevelWindows())
+ QWindowSystemInterface::handleExposeEvent(w, w->geometry());
+ QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
+ }
return true;
}
return QPlatformCursor::event(e);
}
-void QEglFSCursor::update(const QRegion &rgn)
+void QEglFSCursor::update(const QRect &rect, bool allScreens)
{
if (!m_updateRequested) {
// Must not flush the window system events directly from here since we are likely to
// be a called directly from QGuiApplication's processMouseEvents. Flushing events
// could cause reentering by dispatching more queued mouse events.
m_updateRequested = true;
- QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rgn));
+ QCoreApplication::postEvent(this, new CursorUpdateEvent(m_cursor.pos, rect, allScreens));
}
}
@@ -308,8 +320,9 @@ void QEglFSCursor::setPos(const QPoint &pos)
QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
const QRect oldCursorRect = cursorRect();
m_cursor.pos = pos;
- update(oldCursorRect | cursorRect());
- m_screen->handleCursorMove(m_cursor.pos);
+ update(oldCursorRect | cursorRect(), false);
+ for (QPlatformScreen *screen : m_screen->virtualSiblings())
+ static_cast<QEglFSScreen *>(screen)->handleCursorMove(m_cursor.pos);
}
void QEglFSCursor::pointerEvent(const QMouseEvent &event)
@@ -318,8 +331,9 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event)
return;
const QRect oldCursorRect = cursorRect();
m_cursor.pos = event.screenPos().toPoint();
- update(oldCursorRect | cursorRect());
- m_screen->handleCursorMove(m_cursor.pos);
+ update(oldCursorRect | cursorRect(), false);
+ for (QPlatformScreen *screen : m_screen->virtualSiblings())
+ static_cast<QEglFSScreen *>(screen)->handleCursorMove(m_cursor.pos);
}
void QEglFSCursor::paintOnScreen()
@@ -327,15 +341,35 @@ void QEglFSCursor::paintOnScreen()
if (!m_visible)
return;
- const QRectF cr = cursorRect();
- const QRect screenRect(m_screen->geometry());
- const GLfloat x1 = 2 * (cr.left() / screenRect.width()) - 1;
- const GLfloat x2 = 2 * (cr.right() / screenRect.width()) - 1;
- const GLfloat y1 = 1 - (cr.top() / screenRect.height()) * 2;
- const GLfloat y2 = 1 - (cr.bottom() / screenRect.height()) * 2;
- QRectF r(QPointF(x1, y1), QPointF(x2, y2));
+ QRect cr = cursorRect(); // hotspot included
+
+ // Support virtual desktop too. Backends with multi-screen support (e.g. all
+ // variants of KMS/DRM) will enable this by default. In this case all
+ // screens are siblings of each other. When not enabled, the sibling list
+ // only contains m_screen itself.
+ for (QPlatformScreen *screen : m_screen->virtualSiblings()) {
+ if (screen->geometry().contains(cr.topLeft() + m_cursor.hotSpot)
+ && QOpenGLContext::currentContext()->screen() == screen->screen())
+ {
+ cr.translate(-screen->geometry().topLeft());
+ const QSize screenSize = screen->geometry().size();
+ const GLfloat x1 = 2 * (cr.left() / GLfloat(screenSize.width())) - 1;
+ const GLfloat x2 = 2 * (cr.right() / GLfloat(screenSize.width())) - 1;
+ const GLfloat y1 = 1 - (cr.top() / GLfloat(screenSize.height())) * 2;
+ const GLfloat y2 = 1 - (cr.bottom() / GLfloat(screenSize.height())) * 2;
+ QRectF r(QPointF(x1, y1), QPointF(x2, y2));
+
+ draw(r);
+
+ if (screen != m_activeScreen) {
+ m_activeScreen = screen;
+ // Do not want a leftover cursor on the screen the cursor just left.
+ update(cursorRect(), true);
+ }
- draw(r);
+ break;
+ }
+ }
}
// In order to prevent breaking code doing custom OpenGL rendering while
@@ -437,30 +471,33 @@ void QEglFSCursor::draw(const QRectF &r)
{
StateSaver stateSaver;
- if (!m_program) {
+ GraphicsContextData &gfx(m_gfx[QOpenGLContext::currentContext()]);
+ if (!gfx.program) {
// one time initialization
initializeOpenGLFunctions();
createShaderPrograms();
- if (!m_cursorAtlas.texture) {
- createCursorTexture(&m_cursorAtlas.texture, m_cursorAtlas.image);
+ if (!gfx.atlasTexture) {
+ createCursorTexture(&gfx.atlasTexture, m_cursorAtlas.image);
if (m_cursor.shape != Qt::BitmapCursor)
- m_cursor.texture = m_cursorAtlas.texture;
+ m_cursor.useCustomCursor = false;
}
}
- if (m_cursor.shape == Qt::BitmapCursor && m_cursor.customCursorPending) {
+ if (m_cursor.shape == Qt::BitmapCursor && (m_cursor.customCursorPending || m_cursor.customCursorKey != gfx.customCursorKey)) {
// upload the custom cursor
- createCursorTexture(&m_cursor.customCursorTexture, m_cursor.customCursorImage);
- m_cursor.texture = m_cursor.customCursorTexture;
+ createCursorTexture(&gfx.customCursorTexture, m_cursor.customCursorImage);
+ m_cursor.useCustomCursor = true;
m_cursor.customCursorPending = false;
+ gfx.customCursorKey = m_cursor.customCursorKey;
}
- Q_ASSERT(m_cursor.texture);
+ GLuint cursorTexture = !m_cursor.useCustomCursor ? gfx.atlasTexture : gfx.customCursorTexture;
+ Q_ASSERT(cursorTexture);
- m_program->bind();
+ gfx.program->bind();
const GLfloat x1 = r.left();
const GLfloat x2 = r.right();
@@ -485,20 +522,20 @@ void QEglFSCursor::draw(const QRectF &r)
};
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_cursor.texture);
+ glBindTexture(GL_TEXTURE_2D, cursorTexture);
if (stateSaver.vaoHelper->isValid())
stateSaver.vaoHelper->glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
- m_program->enableAttributeArray(0);
- m_program->enableAttributeArray(1);
- m_program->setAttributeArray(0, cursorCoordinates, 2);
- m_program->setAttributeArray(1, textureCoordinates, 2);
+ gfx.program->enableAttributeArray(0);
+ gfx.program->enableAttributeArray(1);
+ gfx.program->setAttributeArray(0, cursorCoordinates, 2);
+ gfx.program->setAttributeArray(1, textureCoordinates, 2);
- m_program->setUniformValue(m_textureEntry, 0);
- m_program->setUniformValue(m_matEntry, m_rotationMatrix);
+ gfx.program->setUniformValue(gfx.textureEntry, 0);
+ gfx.program->setUniformValue(gfx.matEntry, m_rotationMatrix);
glDisable(GL_CULL_FACE);
glFrontFace(GL_CCW);
@@ -508,9 +545,9 @@ void QEglFSCursor::draw(const QRectF &r)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
- m_program->disableAttributeArray(0);
- m_program->disableAttributeArray(1);
- m_program->release();
+ gfx.program->disableAttributeArray(0);
+ gfx.program->disableAttributeArray(1);
+ gfx.program->release();
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
index f72e4c0374..8ccbe4493c 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
@@ -105,30 +105,29 @@ private:
bool setCurrentCursor(QCursor *cursor);
#endif
void draw(const QRectF &rect);
- void update(const QRegion &region);
+ void update(const QRect &rect, bool allScreens);
void createShaderPrograms();
void createCursorTexture(uint *texture, const QImage &image);
void initCursorAtlas();
// current cursor information
struct Cursor {
- Cursor() : texture(0), shape(Qt::BlankCursor), customCursorTexture(0), customCursorPending(false) { }
- uint texture; // a texture from 'image' or the atlas
+ Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { }
Qt::CursorShape shape;
QRectF textureRect; // normalized rect inside texture
QSize size; // size of the cursor
QPoint hotSpot;
QImage customCursorImage;
QPoint pos; // current cursor position
- uint customCursorTexture;
bool customCursorPending;
+ qint64 customCursorKey;
+ bool useCustomCursor;
} m_cursor;
// cursor atlas information
struct CursorAtlas {
- CursorAtlas() : cursorsPerRow(0), texture(0), cursorWidth(0), cursorHeight(0) { }
+ CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { }
int cursorsPerRow;
- uint texture;
int width, height; // width and height of the atlas
int cursorWidth, cursorHeight; // width and height of cursors inside the atlas
QList<QPoint> hotSpots;
@@ -137,12 +136,22 @@ private:
bool m_visible;
QEglFSScreen *m_screen;
- QOpenGLShaderProgram *m_program;
- int m_textureEntry;
- int m_matEntry;
+ QPlatformScreen *m_activeScreen;
QEglFSCursorDeviceListener *m_deviceListener;
bool m_updateRequested;
QMatrix4x4 m_rotationMatrix;
+
+ struct GraphicsContextData {
+ GraphicsContextData() : program(nullptr), textureEntry(0), matEntry(0),
+ customCursorTexture(0), atlasTexture(0), customCursorKey(0) { }
+ QOpenGLShaderProgram *program;
+ int textureEntry;
+ int matEntry;
+ uint customCursorTexture;
+ uint atlasTexture;
+ qint64 customCursorKey;
+ };
+ QHash<QOpenGLContext *, GraphicsContextData> m_gfx;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 3848e99221..6f65929913 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -41,6 +41,7 @@
#include "qeglfsintegration.h"
#include "qeglfscursor_p.h"
#include "qeglfswindow_p.h"
+#include "qeglfsscreen_p.h"
#include "qeglfshooks_p.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
@@ -311,7 +312,7 @@ bool QEglFSDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap
QPlatformCursor *QEglFSDeviceIntegration::createCursor(QPlatformScreen *screen) const
{
- return new QEglFSCursor(screen);
+ return new QEglFSCursor(static_cast<QEglFSScreen *>(screen));
}
void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
diff --git a/src/plugins/platforms/eglfs/api/qeglfsglobal.h b/src/plugins/platforms/eglfs/api/qeglfsglobal.h
index 2b5effc2f1..655ab7eaef 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsglobal.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsglobal.h
@@ -42,7 +42,7 @@
#include <QtCore/qglobal.h>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index 47ef2f64e7..b0c32e5176 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
@@ -65,7 +65,7 @@ QEglFSScreen::~QEglFSScreen()
QRect QEglFSScreen::geometry() const
{
- QRect r = geometryForSurface();
+ QRect r = rawGeometry();
static int rotation = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION");
switch (rotation) {
@@ -88,7 +88,7 @@ QRect QEglFSScreen::geometry() const
return r;
}
-QRect QEglFSScreen::geometryForSurface() const
+QRect QEglFSScreen::rawGeometry() const
{
return QRect(QPoint(0, 0), qt_egl_device_integration()->screenSize());
}
diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
index 232525fae3..daba9fc591 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
@@ -68,7 +68,7 @@ public:
~QEglFSScreen();
QRect geometry() const Q_DECL_OVERRIDE;
- QRect geometryForSurface() const;
+ virtual QRect rawGeometry() const;
int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
index 74723955c6..5ce88e6bd8 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
@@ -142,7 +142,7 @@ void QEglFSWindow::create()
context->setScreen(window()->screen());
if (Q_UNLIKELY(!context->create()))
qFatal("EGLFS: Failed to create compositing context");
- compositor->setTarget(context, window(), screen->geometryForSurface());
+ compositor->setTarget(context, window(), screen->rawGeometry());
compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION"));
// If there is a "root" window into which raster and QOpenGLWidget content is
// composited, all other contexts must share with its context.
@@ -190,7 +190,7 @@ void QEglFSWindow::resetSurface()
m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
m_format = q_glFormatFromConfig(display, m_config, platformFormat);
- const QSize surfaceSize = screen()->geometryForSurface().size();
+ const QSize surfaceSize = screen()->rawGeometry().size();
m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format);
m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL);
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
index 769c248d0d..b46b04d149 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
@@ -1,12 +1,12 @@
TEMPLATE = subdirs
-contains(QT_CONFIG, egl_x11): SUBDIRS += eglfs_x11
-contains(QT_CONFIG, eglfs_gbm): SUBDIRS += eglfs_kms_support eglfs_kms
-contains(QT_CONFIG, eglfs_egldevice): SUBDIRS += eglfs_kms_support eglfs_kms_egldevice
-contains(QT_CONFIG, eglfs_brcm): SUBDIRS += eglfs_brcm
-contains(QT_CONFIG, eglfs_mali): SUBDIRS += eglfs_mali
-contains(QT_CONFIG, eglfs_viv): SUBDIRS += eglfs_viv
-contains(QT_CONFIG, eglfs_viv_wl): SUBDIRS += eglfs_viv_wl
+qtConfig(egl_x11): SUBDIRS += eglfs_x11
+qtConfig(eglfs_gbm): SUBDIRS += eglfs_kms_support eglfs_kms
+qtConfig(eglfs_egldevice): SUBDIRS += eglfs_kms_support eglfs_kms_egldevice
+qtConfig(eglfs_brcm): SUBDIRS += eglfs_brcm
+qtConfig(eglfs_mali): SUBDIRS += eglfs_mali
+qtConfig(eglfs_viv): SUBDIRS += eglfs_viv
+qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl
eglfs_kms_egldevice.depends = eglfs_kms_support
eglfs_kms.depends = eglfs_kms_support
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
index cd97c2c5a3..d65e136a96 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
@@ -8,8 +8,8 @@ CONFIG += egl
LIBS += -lbcm_host
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
-# Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
SOURCES += $$PWD/qeglfsbrcmmain.cpp \
$$PWD/qeglfsbrcmintegration.cpp
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp
index 363fce2214..4e811a1dfe 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp
@@ -93,9 +93,23 @@ void QEglFSBrcmIntegration::platformInit()
bcm_host_init();
}
+static int getDisplayId()
+{
+ // As defined in vc_dispmanx_types.h
+ // DISPMANX_ID_MAIN_LCD 0
+ // DISPMANX_ID_AUX_LCD 1
+ // DISPMANX_ID_HDMI 2
+ // DISPMANX_ID_SDTV 3
+ // DISPMANX_ID_FORCE_LCD 4
+ // DISPMANX_ID_FORCE_TV 5
+ // DISPMANX_ID_FORCE_OTHER 6 /* non-default display */
+ static const int dispmanxId = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISPMANX_ID");
+ return (dispmanxId >= 0 && dispmanxId <= 6) ? dispmanxId : 0;
+}
+
EGLNativeDisplayType QEglFSBrcmIntegration::platformDisplay() const
{
- dispman_display = vc_dispmanx_display_open(0/* LCD */);
+ dispman_display = vc_dispmanx_display_open(getDisplayId());
return EGL_DEFAULT_DISPLAY;
}
@@ -107,7 +121,7 @@ void QEglFSBrcmIntegration::platformDestroy()
QSize QEglFSBrcmIntegration::screenSize() const
{
uint32_t width, height;
- graphics_get_display_size(0 /* LCD */, &width, &height);
+ graphics_get_display_size(getDisplayId(), &width, &height);
return QSize(width, height);
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
index b0d631a9d1..70ff054172 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
@@ -8,16 +8,10 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
-# Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
-
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm gbm
-} else {
- LIBS += -ldrm -lgbm
-}
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
+QMAKE_USE += gbm drm
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
index 278752bddf..99f6cfb0ca 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
@@ -142,10 +142,10 @@ void QEglFSKmsGbmDevice::handleDrmEvent()
drmHandleEvent(fd(), &drmEvent);
}
-QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
+QEglFSKmsScreen *QEglFSKmsGbmDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output)
{
static bool firstScreen = true;
- QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output, position);
+ QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(integration, device, output);
if (firstScreen && integration->hwCursor()) {
m_globalCursor = new QEglFSKmsGbmCursor(screen);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
index 6a45f9ffa0..7c0af84422 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
@@ -68,8 +68,7 @@ public:
virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position) Q_DECL_OVERRIDE;
+ QEglFSKmsOutput output) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QEglFSKmsGbmDevice)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index 7a17b60a5e..dde386fc57 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -93,10 +93,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject(
}
QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration,
- QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position)
- : QEglFSKmsScreen(integration, device, output, position)
+ QEglFSKmsDevice *device,
+ QEglFSKmsOutput output)
+ : QEglFSKmsScreen(integration, device, output)
, m_gbm_surface(Q_NULLPTR)
, m_gbm_bo_current(Q_NULLPTR)
, m_gbm_bo_next(Q_NULLPTR)
@@ -130,8 +129,8 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface()
if (!m_gbm_surface) {
qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name();
m_gbm_surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice(),
- geometry().width(),
- geometry().height(),
+ rawGeometry().width(),
+ rawGeometry().height(),
GBM_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
index 3381bbfdbb..d7ad348291 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
@@ -55,9 +55,8 @@ class QEglFSKmsGbmScreen : public QEglFSKmsScreen
{
public:
QEglFSKmsGbmScreen(QEglFSKmsIntegration *integration,
- QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsDevice *device,
+ QEglFSKmsOutput output);
~QEglFSKmsGbmScreen();
QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
index 8eabd2d4b7..5f47b98369 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
@@ -4,15 +4,10 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
-DEFINES += MESA_EGL_NO_X11_HEADERS
-
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm
-} else {
- LIBS += -ldrm
-}
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
+QMAKE_USE += drm
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
index 743f714cf0..d30963ff96 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
@@ -40,11 +40,15 @@
#include "qeglfskmsegldevice.h"
#include "qeglfskmsegldevicescreen.h"
#include "qeglfskmsegldeviceintegration.h"
+#include "private/qeglfscursor_p.h"
#include <QtCore/private/qcore_unix_p.h>
+QT_BEGIN_NAMESPACE
+
QEglFSKmsEglDevice::QEglFSKmsEglDevice(QEglFSKmsIntegration *integration, const QString &path)
- : QEglFSKmsDevice(integration, path)
+ : QEglFSKmsDevice(integration, path),
+ m_globalCursor(nullptr)
{
}
@@ -52,6 +56,8 @@ bool QEglFSKmsEglDevice::open()
{
Q_ASSERT(fd() == -1);
+ qCDebug(qLcEglfsKmsDebug, "Opening DRM device %s", qPrintable(devicePath()));
+
int fd = drmOpen(devicePath().toLocal8Bit().constData(), Q_NULLPTR);
if (Q_UNLIKELY(fd < 0))
qFatal("Could not open DRM device");
@@ -63,6 +69,8 @@ bool QEglFSKmsEglDevice::open()
void QEglFSKmsEglDevice::close()
{
+ qCDebug(qLcEglfsKmsDebug, "Closing DRM device");
+
if (qt_safe_close(fd()) == -1)
qErrnoWarning("Could not close DRM device");
@@ -74,7 +82,26 @@ EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const
return static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice();
}
-QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
+QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device,
+ QEglFSKmsOutput output)
{
- return new QEglFSKmsEglDeviceScreen(integration, device, output, position);
+ QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(integration, device, output);
+
+ if (!m_globalCursor && !integration->separateScreens()) {
+ qCDebug(qLcEglfsKmsDebug, "Creating new global mouse cursor");
+ m_globalCursor = new QEglFSCursor(screen);
+ }
+
+ return screen;
}
+
+void QEglFSKmsEglDevice::destroyGlobalCursor()
+{
+ if (m_globalCursor) {
+ qCDebug(qLcEglfsKmsDebug, "Destroying global mouse cursor");
+ delete m_globalCursor;
+ m_globalCursor = nullptr;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
index b1c98f3fe6..8c8f79f70c 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
@@ -42,6 +42,10 @@
#include <qeglfskmsdevice.h>
+QT_BEGIN_NAMESPACE
+
+class QPlatformCursor;
+
class QEglFSKmsEglDevice: public QEglFSKmsDevice
{
public:
@@ -54,8 +58,15 @@ public:
virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position) Q_DECL_OVERRIDE;
+ QEglFSKmsOutput output) Q_DECL_OVERRIDE;
+
+ QPlatformCursor *globalCursor() { return m_globalCursor; }
+ void destroyGlobalCursor();
+
+private:
+ QPlatformCursor *m_globalCursor;
};
+QT_END_NAMESPACE
+
#endif // QEGLFSKMSEGLDEVICE_H
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
index 28967d71ff..ddb2499751 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -41,6 +41,7 @@
#include "qeglfskmsegldeviceintegration.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include "private/qeglfswindow_p.h"
+#include "private/qeglfscursor_p.h"
#include "qeglfskmsegldevice.h"
#include "qeglfskmsscreen.h"
#include <QLoggingCategory>
@@ -193,8 +194,8 @@ void QEglJetsonTK1Window::resetSurface()
m_format = q_glFormatFromConfig(display, m_config);
qCDebug(qLcEglfsKmsDebug) << "Stream producer format is" << m_format;
- const int w = cur_screen->geometry().width();
- const int h = cur_screen->geometry().height();
+ const int w = cur_screen->rawGeometry().width();
+ const int h = cur_screen->rawGeometry().height();
qCDebug(qLcEglfsKmsDebug, "Creating stream producer surface of size %dx%d", w, h);
const EGLint stream_producer_attribs[] = {
@@ -222,11 +223,6 @@ QEglFSWindow *QEglFSKmsEglDeviceIntegration::createWindow(QWindow *window) const
return eglWindow;
}
-bool QEglFSKmsEglDeviceIntegration::separateScreens() const
-{
- return true;
-}
-
QEglFSKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice(const QString &devicePath)
{
Q_UNUSED(devicePath)
@@ -263,4 +259,9 @@ bool QEglFSKmsEglDeviceIntegration::query_egl_device()
return true;
}
+QPlatformCursor *QEglFSKmsEglDeviceIntegration::createCursor(QPlatformScreen *screen) const
+{
+ return separateScreens() ? new QEglFSCursor(screen) : nullptr;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
index f04c42267a..375c388548 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
@@ -61,12 +61,11 @@ public:
bool supportsPBuffers() const Q_DECL_OVERRIDE;
QEglFSWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE;
- virtual bool separateScreens() const Q_DECL_OVERRIDE;
-
EGLDeviceEXT eglDevice() const { return m_egl_device; }
protected:
QEglFSKmsDevice *createDevice(const QString &devicePath) Q_DECL_OVERRIDE;
+ QPlatformCursor *createCursor(QPlatformScreen *screen) const Q_DECL_OVERRIDE;
private:
bool setup_kms();
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
index da1b577801..55d5941e5f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
@@ -39,10 +39,30 @@
#include "qeglfskmsegldevicescreen.h"
#include "qeglfskmsegldevice.h"
+#include <QGuiApplication>
-QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
- : QEglFSKmsScreen(integration, device, output, position)
+QT_BEGIN_NAMESPACE
+
+QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output)
+ : QEglFSKmsScreen(integration, device, output)
+{
+}
+
+QEglFSKmsEglDeviceScreen::~QEglFSKmsEglDeviceScreen()
{
+ const int remainingScreenCount = qGuiApp->screens().count();
+ qCDebug(qLcEglfsKmsDebug, "Screen dtor. Remaining screens: %d", remainingScreenCount);
+ if (!remainingScreenCount && !m_integration->separateScreens())
+ static_cast<QEglFSKmsEglDevice *>(device())->destroyGlobalCursor();
+}
+
+QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const
+{
+ // The base class creates a cursor via integration->createCursor()
+ // in its ctor. With separateScreens just use that. Otherwise
+ // there's a virtual desktop and the device has a global cursor
+ // and the base class has no dedicated cursor at all.
+ return m_integration->separateScreens() ? QEglFSScreen::cursor() : static_cast<QEglFSKmsEglDevice *>(device())->globalCursor();
}
void QEglFSKmsEglDeviceScreen::waitForFlip()
@@ -76,3 +96,5 @@ void QEglFSKmsEglDeviceScreen::waitForFlip()
}
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h
index 0cd46e9f9d..c57f52c6b7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h
@@ -42,15 +42,21 @@
#include <qeglfskmsscreen.h>
+QT_BEGIN_NAMESPACE
+
class QEglFSKmsEglDeviceScreen : public QEglFSKmsScreen
{
public:
QEglFSKmsEglDeviceScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsOutput output);
+ ~QEglFSKmsEglDeviceScreen();
+
+ QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
void waitForFlip() Q_DECL_OVERRIDE;
};
+QT_END_NAMESPACE
+
#endif // QEGLFSKMSEGLDEVICESCREEN_H
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
index 6dd857a4e4..464c64539f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
@@ -6,16 +6,10 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
INCLUDEPATH += $$PWD/../..
-# Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
-
-CONFIG += link_pkgconfig
-!contains(QT_CONFIG, no-pkg-config) {
- PKGCONFIG += libdrm
-} else {
- LIBS += -ldrm
-}
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
+QMAKE_USE += drm
CONFIG += egl
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
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 f4ffee569d..5944e8d51f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -159,7 +159,7 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode)
return true;
}
-QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos)
+QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex)
{
const QByteArray connectorName = nameForConnector(connector);
@@ -173,8 +173,11 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
QSize configurationSize;
drmModeModeInfo configurationModeline;
- const QByteArray mode = m_integration->outputSettings().value(QString::fromUtf8(connectorName))
- .value(QStringLiteral("mode"), QStringLiteral("preferred")).toByteArray().toLower();
+ auto userConfig = m_integration->outputSettings();
+ auto userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName));
+ // default to the preferred mode unless overridden in the config
+ const QByteArray mode = userConnectorConfig.value(QStringLiteral("mode"), QStringLiteral("preferred"))
+ .toByteArray().toLower();
if (mode == "off") {
configuration = OutputConfigOff;
} else if (mode == "preferred") {
@@ -189,6 +192,8 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData());
configuration = OutputConfigPreferred;
}
+ if (virtualIndex)
+ *virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
const uint32_t crtc_id = resources->crtcs[crtc];
@@ -287,18 +292,26 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
qCDebug(qLcEglfsKmsDebug) << "Selected mode" << selected_mode << ":" << width << "x" << height
<< '@' << refresh << "hz for output" << connectorName;
}
+
+ // physical size from connector < config values < env vars
static const int width = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_WIDTH");
static const int height = qEnvironmentVariableIntValue("QT_QPA_EGLFS_PHYSICAL_HEIGHT");
- QSizeF size(width, height);
- if (size.isEmpty()) {
- size.setWidth(connector->mmWidth);
- size.setHeight(connector->mmHeight);
+ QSizeF physSize(width, height);
+ if (physSize.isEmpty()) {
+ physSize = QSize(userConnectorConfig.value(QStringLiteral("physicalWidth")).toInt(),
+ userConnectorConfig.value(QStringLiteral("physicalHeight")).toInt());
+ if (physSize.isEmpty()) {
+ physSize.setWidth(connector->mmWidth);
+ physSize.setHeight(connector->mmHeight);
+ }
}
+ qCDebug(qLcEglfsKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName;
+
QEglFSKmsOutput output = {
QString::fromUtf8(connectorName),
connector->connector_id,
crtc_id,
- size,
+ physSize,
selected_mode,
false,
drmModeGetCrtc(m_dri_fd, crtc_id),
@@ -310,7 +323,7 @@ QEglFSKmsScreen *QEglFSKmsDevice::screenForConnector(drmModeResPtr resources, dr
m_crtc_allocator |= (1 << output.crtc_id);
m_connector_allocator |= (1 << output.connector_id);
- return createScreen(m_integration, this, output, pos);
+ return createScreen(m_integration, this, output);
}
drmModePropertyPtr QEglFSKmsDevice::connectorProperty(drmModeConnectorPtr connector, const QByteArray &name)
@@ -342,6 +355,26 @@ QEglFSKmsDevice::~QEglFSKmsDevice()
{
}
+struct OrderedScreen
+{
+ OrderedScreen() : screen(nullptr), index(-1) { }
+ OrderedScreen(QEglFSKmsScreen *screen, int index) : screen(screen), index(index) { }
+ QEglFSKmsScreen *screen;
+ int index;
+};
+
+QDebug operator<<(QDebug dbg, const OrderedScreen &s)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.index << ")";
+ return dbg;
+}
+
+static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b)
+{
+ return a.index < b.index;
+}
+
void QEglFSKmsDevice::createScreens()
{
drmModeResPtr resources = drmModeGetResources(m_dri_fd);
@@ -350,32 +383,49 @@ void QEglFSKmsDevice::createScreens()
return;
}
- QEglFSKmsScreen *primaryScreen = Q_NULLPTR;
- QList<QPlatformScreen *> siblings;
- QPoint pos(0, 0);
- QEglFSIntegration *integration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
+ QVector<OrderedScreen> screens;
for (int i = 0; i < resources->count_connectors; i++) {
drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]);
if (!connector)
continue;
- QEglFSKmsScreen *screen = screenForConnector(resources, connector, pos);
- if (screen) {
- integration->addScreen(screen);
- pos.rx() += screen->geometry().width();
- siblings << screen;
-
- if (!primaryScreen)
- primaryScreen = screen;
- }
+ int virtualIndex;
+ QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &virtualIndex);
+ if (screen)
+ screens.append(OrderedScreen(screen, virtualIndex));
drmModeFreeConnector(connector);
}
drmModeFreeResources(resources);
+ // Use stable sort to preserve the original order for outputs with unspecified indices.
+ std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan);
+ qCDebug(qLcEglfsKmsDebug) << "Sorted screen list:" << screens;
+
+ QPoint pos(0, 0);
+ QList<QPlatformScreen *> siblings;
+ QEglFSIntegration *qpaIntegration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
+
+ for (const OrderedScreen &orderedScreen : screens) {
+ QEglFSKmsScreen *s = orderedScreen.screen;
+ // set up a horizontal or vertical virtual desktop
+ s->setVirtualPosition(pos);
+ if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical)
+ pos.ry() += s->geometry().height();
+ else
+ pos.rx() += s->geometry().width();
+ qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry();
+ // The order in qguiapp's screens list will match the order set by
+ // virtualIndex. This is not only handy but also required since for instance
+ // evdevtouch relies on it when performing touch device - screen mapping.
+ qpaIntegration->addScreen(s);
+ siblings << s;
+ }
+
if (!m_integration->separateScreens()) {
+ // enable the virtual desktop
Q_FOREACH (QPlatformScreen *screen, siblings)
static_cast<QEglFSKmsScreen *>(screen)->setVirtualSiblings(siblings);
}
@@ -391,9 +441,9 @@ QString QEglFSKmsDevice::devicePath() const
return m_path;
}
-QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output, QPoint position)
+QEglFSKmsScreen *QEglFSKmsDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, QEglFSKmsOutput output)
{
- return new QEglFSKmsScreen(integration, device, output, position);
+ return new QEglFSKmsScreen(integration, device, output);
}
void QEglFSKmsDevice::setFd(int fd)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
index 041c063695..4aad2e0143 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h
@@ -68,8 +68,7 @@ public:
protected:
virtual QEglFSKmsScreen *createScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsOutput output);
void setFd(int fd);
QEglFSKmsIntegration *m_integration;
@@ -80,7 +79,7 @@ protected:
quint32 m_connector_allocator;
int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector);
- QEglFSKmsScreen *screenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, QPoint pos);
+ QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex);
drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name);
static void pageFlipHandler(int fd,
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
index 7389050efc..6c30e8f930 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
@@ -65,6 +65,7 @@ QEglFSKmsIntegration::QEglFSKmsIntegration()
, m_hwCursor(false)
, m_pbuffers(false)
, m_separateScreens(false)
+ , m_virtualDesktopLayout(VirtualDesktopLayoutHorizontal)
{}
void QEglFSKmsIntegration::platformInit()
@@ -149,6 +150,11 @@ bool QEglFSKmsIntegration::separateScreens() const
return m_separateScreens;
}
+QEglFSKmsIntegration::VirtualDesktopLayout QEglFSKmsIntegration::virtualDesktopLayout() const
+{
+ return m_virtualDesktopLayout;
+}
+
QMap<QString, QVariantMap> QEglFSKmsIntegration::outputSettings() const
{
return m_outputSettings;
@@ -169,15 +175,15 @@ void QEglFSKmsIntegration::loadConfig()
QFile file(QString::fromUtf8(json));
if (!file.open(QFile::ReadOnly)) {
- qCDebug(qLcEglfsKmsDebug) << "Could not open config file"
- << json << "for reading";
+ qCWarning(qLcEglfsKmsDebug) << "Could not open config file"
+ << json << "for reading";
return;
}
const QJsonDocument doc = QJsonDocument::fromJson(file.readAll());
if (!doc.isObject()) {
- qCDebug(qLcEglfsKmsDebug) << "Invalid config file" << json
- << "- no top-level JSON object";
+ qCWarning(qLcEglfsKmsDebug) << "Invalid config file" << json
+ << "- no top-level JSON object";
return;
}
@@ -188,6 +194,16 @@ void QEglFSKmsIntegration::loadConfig()
m_devicePath = object.value(QLatin1String("device")).toString();
m_separateScreens = object.value(QLatin1String("separateScreens")).toBool(m_separateScreens);
+ const QString vdOriString = object.value(QLatin1String("virtualDesktopLayout")).toString();
+ if (!vdOriString.isEmpty()) {
+ if (vdOriString == QLatin1String("horizontal"))
+ m_virtualDesktopLayout = VirtualDesktopLayoutHorizontal;
+ else if (vdOriString == QLatin1String("vertical"))
+ m_virtualDesktopLayout = VirtualDesktopLayoutVertical;
+ else
+ qCWarning(qLcEglfsKmsDebug) << "Unknown virtualDesktopOrientation value" << vdOriString;
+ }
+
const QJsonArray outputs = object.value(QLatin1String("outputs")).toArray();
for (int i = 0; i < outputs.size(); i++) {
const QVariantMap outputSettings = outputs.at(i).toObject().toVariantMap();
@@ -207,6 +223,7 @@ void QEglFSKmsIntegration::loadConfig()
<< "\thwcursor:" << m_hwCursor << "\n"
<< "\tpbuffers:" << m_pbuffers << "\n"
<< "\tseparateScreens:" << m_separateScreens << "\n"
+ << "\tvirtualDesktopLayout:" << m_virtualDesktopLayout << "\n"
<< "\toutputs:" << m_outputSettings;
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
index 81386881ff..ba49945715 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
@@ -56,6 +56,11 @@ Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration
{
public:
+ enum VirtualDesktopLayout {
+ VirtualDesktopLayoutHorizontal,
+ VirtualDesktopLayoutVertical
+ };
+
QEglFSKmsIntegration();
void platformInit() Q_DECL_OVERRIDE;
@@ -70,6 +75,7 @@ public:
virtual bool hwCursor() const;
virtual bool separateScreens() const;
+ virtual VirtualDesktopLayout virtualDesktopLayout() const;
QMap<QString, QVariantMap> outputSettings() const;
QEglFSKmsDevice *device() const;
@@ -83,6 +89,7 @@ protected:
bool m_hwCursor;
bool m_pbuffers;
bool m_separateScreens;
+ VirtualDesktopLayout m_virtualDesktopLayout;
QString m_devicePath;
QMap<QString, QVariantMap> m_outputSettings;
};
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
index e6b256f6b2..f690cd668e 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -71,17 +71,15 @@ private:
QEglFSKmsScreen::QEglFSKmsScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position)
+ QEglFSKmsOutput output)
: QEglFSScreen(eglGetDisplay(device->nativeDisplay()))
, m_integration(integration)
, m_device(device)
, m_output(output)
- , m_pos(position)
, m_powerState(PowerStateOn)
, m_interruptHandler(new QEglFSKmsInterruptHandler(this))
{
- m_siblings << this;
+ m_siblings << this; // gets overridden by QEglFSKmsDevice later if !separateScreens
}
QEglFSKmsScreen::~QEglFSKmsScreen()
@@ -98,7 +96,14 @@ QEglFSKmsScreen::~QEglFSKmsScreen()
delete m_interruptHandler;
}
-QRect QEglFSKmsScreen::geometry() const
+void QEglFSKmsScreen::setVirtualPosition(const QPoint &pos)
+{
+ m_pos = pos;
+}
+
+// Reimplement rawGeometry(), not geometry(). The base class implementation of
+// geometry() calls rawGeometry() and may apply additional transforms.
+QRect QEglFSKmsScreen::rawGeometry() const
{
const int mode = m_output.mode;
return QRect(m_pos.x(), m_pos.y(),
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
index 9679f70260..2b6a0ffe6c 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
@@ -74,11 +74,13 @@ class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen
public:
QEglFSKmsScreen(QEglFSKmsIntegration *integration,
QEglFSKmsDevice *device,
- QEglFSKmsOutput output,
- QPoint position);
+ QEglFSKmsOutput output);
~QEglFSKmsScreen();
- QRect geometry() const Q_DECL_OVERRIDE;
+ void setVirtualPosition(const QPoint &pos);
+
+ QRect rawGeometry() const Q_DECL_OVERRIDE;
+
int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
index 1e58b5fdcd..6e32ca26d0 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
@@ -2,8 +2,8 @@ TARGET = qeglfs-mali-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
-# Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
INCLUDEPATH += $$PWD/../..
CONFIG += egl
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
index a53aac2041..16880535e3 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
@@ -5,7 +5,6 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
INCLUDEPATH += $$PWD/../..
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
-LIBS += -lGAL
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsvivmain.cpp \
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
index 38259f4a5d..374c5bba6b 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
@@ -5,7 +5,6 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr
INCLUDEPATH += $$PWD/../..
CONFIG += egl
DEFINES += LINUX=1 EGL_API_FB=1
-LIBS += -lGAL
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsvivwlmain.cpp \
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
index 21af6eb736..10af57e487 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
@@ -2,13 +2,13 @@ TARGET = qeglfs-x11-integration
QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
-# Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
INCLUDEPATH += $$PWD/../..
CONFIG += egl
-LIBS += -lX11 -lX11-xcb -lxcb
+QMAKE_USE += xcb_xlib
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
SOURCES += $$PWD/qeglfsx11main.cpp \
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp
index 74a687b382..f9924fe5ce 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp
@@ -281,12 +281,12 @@ EGLNativeWindowType QEglFSX11Integration::createNativeWindow(QPlatformWindow *pl
xcb_flush(m_connection);
- return m_window;
+ return qt_egl_cast<EGLNativeWindowType>(m_window);
}
void QEglFSX11Integration::destroyNativeWindow(EGLNativeWindowType window)
{
- xcb_destroy_window(m_connection, window);
+ xcb_destroy_window(m_connection, qt_egl_cast<xcb_window_t>(window));
}
bool QEglFSX11Integration::hasCapability(QPlatformIntegration::Capability cap) const
diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
index 05f4196728..eb0ce73118 100644
--- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
+++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
@@ -10,8 +10,8 @@ MODULE = eglfsdeviceintegration
QT += core-private gui-private platformsupport-private
LIBS += $$QMAKE_LIBS_DYNLOAD
-# Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
DEFINES += QT_BUILD_EGL_DEVICE_LIB
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 8c8ef99bc2..418ff6119b 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -70,17 +70,17 @@
#include <QtPlatformHeaders/QEGLNativeContext>
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
#endif
-#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(tslib)
#include <QtPlatformSupport/private/qtslib_p.h>
#endif
@@ -386,7 +386,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na
QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const
{
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
if (function == QEglFSFunctions::loadKeymapTypeIdentifier())
return QFunctionPointer(loadKeymapStatic);
#else
@@ -398,7 +398,7 @@ QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function)
void QEglFSIntegration::loadKeymapStatic(const QString &filename)
{
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
if (self->m_kbdMgr)
self->m_kbdMgr->loadKeymap(filename);
@@ -411,22 +411,22 @@ void QEglFSIntegration::loadKeymapStatic(const QString &filename)
void QEglFSIntegration::createInputHandlers()
{
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString());
return;
}
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev)
m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
-#ifndef QT_NO_TSLIB
+#if QT_CONFIG(tslib)
const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB");
if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */);
else
-#endif // QT_NO_TSLIB
+#endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this);
#endif
}
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 685f231756..707301487d 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -52,17 +52,17 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
#endif
-#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID)
#include <QtPlatformSupport/private/qtslib_p.h>
#endif
@@ -140,22 +140,22 @@ QPlatformServices *QLinuxFbIntegration::services() const
void QLinuxFbIntegration::createInputHandlers()
{
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) {
new QLibInputHandler(QLatin1String("libinput"), QString());
return;
}
#endif
-#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
+#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this);
new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this);
-#ifndef QT_NO_TSLIB
+#if QT_CONFIG(tslib)
const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
if (useTslib)
new QTsLibMouseHandler(QLatin1String("TsLib"), QString());
else
-#endif // QT_NO_TSLIB
+#endif
new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this);
#endif
}
diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro
index 3aca27b555..0d31d6605b 100644
--- a/src/plugins/platforms/minimal/minimal.pro
+++ b/src/plugins/platforms/minimal/minimal.pro
@@ -11,7 +11,6 @@ HEADERS = qminimalintegration.h \
OTHER_FILES += minimal.json
CONFIG += qpa/genericunixfontdatabase
-win32|darwin: DEFINES += QT_NO_FONTCONFIG
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 7224f4114c..984d4456a0 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -46,10 +46,10 @@
#if defined(Q_OS_WIN)
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
-#elif defined(QT_NO_FONTCONFIG)
-#include <qpa/qplatformfontdatabase.h>
-#else
+#elif QT_CONFIG(fontconfig)
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
+#else
+#include <qpa/qplatformfontdatabase.h>
#endif
#if !defined(Q_OS_WIN)
@@ -118,7 +118,7 @@ public:
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
{
if (m_options & EnableFonts) {
-#ifndef QT_NO_FONTCONFIG
+#if QT_CONFIG(fontconfig)
if (!m_fontDatabase)
m_fontDatabase = new QGenericUnixFontDatabase;
#else
diff --git a/src/plugins/platforms/minimalegl/minimalegl.pro b/src/plugins/platforms/minimalegl/minimalegl.pro
index ac67249591..b8a91729fd 100644
--- a/src/plugins/platforms/minimalegl/minimalegl.pro
+++ b/src/plugins/platforms/minimalegl/minimalegl.pro
@@ -6,8 +6,8 @@ QT += core-private gui-private platformsupport-private
#DEFINES += Q_OPENKODE
-#Avoid X11 header collision
-DEFINES += MESA_EGL_NO_X11_HEADERS
+# Avoid X11 header collision, use generic EGL native types
+DEFINES += QT_EGL_NO_X11
SOURCES = main.cpp \
qminimaleglintegration.cpp \
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
index cf31eec75f..b1d3691a10 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
@@ -58,7 +58,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.h b/src/plugins/platforms/minimalegl/qminimaleglscreen.h
index 825d5e8541..4b53bbd39a 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglscreen.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.h
@@ -44,7 +44,7 @@
#include <QtCore/QTextStream>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/offscreen/offscreen.pro b/src/plugins/platforms/offscreen/offscreen.pro
index 999550a7e1..cc65449b04 100644
--- a/src/plugins/platforms/offscreen/offscreen.pro
+++ b/src/plugins/platforms/offscreen/offscreen.pro
@@ -13,7 +13,7 @@ HEADERS = qoffscreenintegration.h \
OTHER_FILES += offscreen.json
-contains(QT_CONFIG, xlib):contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2) {
+qtConfig(xlib):qtConfig(opengl):!qtConfig(opengles2) {
SOURCES += qoffscreenintegration_x11.cpp
HEADERS += qoffscreenintegration_x11.h
system(echo "Using X11 offscreen integration with GLX")
diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro
index 152e4f57d7..79f349f472 100644
--- a/src/plugins/platforms/openwfd/openwf.pro
+++ b/src/plugins/platforms/openwfd/openwf.pro
@@ -31,7 +31,8 @@ SOURCES += \
qopenwfdportmode.cpp \
qopenwfdwindow.cpp
-LIBS += -lWFD -lgbm -lGLESv2 -lEGL
+LIBS += -lWFD
+QMAKE_USE += gbm opengl_es2 egl
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index 4bed5312ec..fcfebf6e94 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -4,19 +4,19 @@ android: SUBDIRS += android
!android: SUBDIRS += minimal
-!android:if(!win32|contains(QT_CONFIG, freetype)): SUBDIRS += offscreen
+!android:if(!win32|qtConfig(freetype)): SUBDIRS += offscreen
-contains(QT_CONFIG, xcb) {
+qtConfig(xcb) {
SUBDIRS += xcb
}
-uikit: SUBDIRS += ios
+uikit:!watchos: SUBDIRS += ios
osx: SUBDIRS += cocoa
win32:!winrt: SUBDIRS += windows
winrt: SUBDIRS += winrt
-contains(QT_CONFIG, direct2d) {
+qtConfig(direct2d) {
SUBDIRS += direct2d
}
@@ -24,16 +24,16 @@ qnx {
SUBDIRS += qnx
}
-contains(QT_CONFIG, eglfs) {
+qtConfig(eglfs) {
SUBDIRS += eglfs
SUBDIRS += minimalegl
}
-contains(QT_CONFIG, directfb) {
+qtConfig(directfb) {
SUBDIRS += directfb
}
-contains(QT_CONFIG, linuxfb): SUBDIRS += linuxfb
+qtConfig(linuxfb): SUBDIRS += linuxfb
unix:!android:!darwin: SUBDIRS += vnc
@@ -45,6 +45,6 @@ haiku {
SUBDIRS += haiku
}
-contains(QT_CONFIG, mirclient): SUBDIRS += mirclient
+qtConfig(mirclient): SUBDIRS += mirclient
-contains(QT_CONFIG, integrityfb): SUBDIRS += integrity
+qtConfig(integrityfb): SUBDIRS += integrity
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 5a0f4f5c98..e47731476f 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -75,14 +75,14 @@ CONFIG(qqnx_screeneventthread) {
LIBS += -lscreen
-contains(QT_CONFIG, opengles2) {
+qtConfig(opengles2) {
SOURCES += qqnxglcontext.cpp \
qqnxeglwindow.cpp
HEADERS += qqnxglcontext.h \
qqnxeglwindow.h
- LIBS += -lEGL
+ QMAKE_USE += egl
}
CONFIG(qqnx_pps) {
@@ -100,7 +100,7 @@ CONFIG(qqnx_pps) {
qqnxnavigatoreventnotifier.h \
qqnxvirtualkeyboardpps.h
- LIBS += -lpps
+ QMAKE_USE += pps
!contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard
CONFIG(qqnx_imf) {
@@ -116,7 +116,7 @@ CONFIG(qqnx_pps) {
lgmon {
DEFINES += QQNX_LGMON
SOURCES += qqnxlgmon.cpp
- LIBS += -llgmon
+ QMAKE_USE += lgmon
}
OTHER_FILES += qnx.json
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 678e83cd57..f8ae5121d1 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -385,10 +385,8 @@ Qt::ScreenOrientation QQnxScreen::orientation() const
QWindow *QQnxScreen::topLevelAt(const QPoint &point) const
{
- QListIterator<QQnxWindow*> it(m_childWindows);
- it.toBack();
- while (it.hasPrevious()) {
- QWindow *win = it.previous()->window();
+ for (auto it = m_childWindows.rbegin(), end = m_childWindows.rend(); it != end; ++it) {
+ QWindow *win = (*it)->window();
if (win->geometry().contains(point))
return win;
}
diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp
index 810c5d2a90..3227478ebe 100644
--- a/src/plugins/platforms/vnc/qvncintegration.cpp
+++ b/src/plugins/platforms/vnc/qvncintegration.cpp
@@ -49,7 +49,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#include <private/qinputdevicemanager_p_p.h>
-#ifndef QT_NO_LIBINPUT
+#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 6f236aa588..e87064e385 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -40,6 +40,7 @@
#include "qwindowsfontdatabase.h"
#include "qwindowsfontdatabase_ft.h" // for default font
#include "qwindowscontext.h"
+#include "qwindowsintegration.h"
#include "qwindowsfontengine.h"
#include "qwindowsfontenginedirectwrite.h"
#include <QtCore/qt_windows.h>
@@ -108,6 +109,18 @@ static void createDirectWriteFactory(IDWriteFactory **factory)
*factory = static_cast<IDWriteFactory *>(result);
}
+
+static inline bool useDirectWrite(QFont::HintingPreference hintingPreference, bool isColorFont = false)
+{
+ const unsigned options = QWindowsIntegration::instance()->options();
+ if (Q_UNLIKELY(options & QWindowsIntegration::DontUseDirectWriteFonts))
+ return false;
+ if (isColorFont)
+ return (options & QWindowsIntegration::DontUseColorFonts) == 0;
+ return hintingPreference == QFont::PreferNoHinting
+ || hintingPreference == QFont::PreferVerticalHinting
+ || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting);
+}
#endif // !QT_NO_DIRECTWRITE
// Helper classes for creating font engines directly from font data
@@ -1200,11 +1213,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal
QFontEngine *fontEngine = 0;
#if !defined(QT_NO_DIRECTWRITE)
- bool useDirectWrite = (hintingPreference == QFont::PreferNoHinting)
- || (hintingPreference == QFont::PreferVerticalHinting)
- || (QHighDpiScaling::isActive() && hintingPreference == QFont::PreferDefaultHinting);
-
- if (!useDirectWrite)
+ if (!useDirectWrite(hintingPreference))
#endif
{
GUID guid;
@@ -1840,15 +1849,16 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request,
if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
reinterpret_cast<void **>(&directWriteFontFace2)))) {
if (directWriteFontFace2->IsColorFont())
- isColorFont = true;
+ isColorFont = directWriteFontFace2->GetPaletteEntryCount() > 0;
}
#endif
-
- bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting)
- || (request.hintingPreference == QFont::PreferVerticalHinting)
- || (QHighDpiScaling::isActive() && request.hintingPreference == QFont::PreferDefaultHinting)
- || isColorFont;
- if (useDirectWrite) {
+ const QFont::HintingPreference hintingPreference =
+ static_cast<QFont::HintingPreference>(request.hintingPreference);
+ const bool useDw = useDirectWrite(hintingPreference, isColorFont);
+ qCDebug(lcQpaFonts) << __FUNCTION__ << request.family << request.pointSize
+ << "pt" << "hintingPreference=" << hintingPreference << "color=" << isColorFont
+ << dpi << "dpi" << "useDirectWrite=" << useDw;
+ if (useDw) {
QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
request.pixelSize,
data);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 90aa3fef16..b9a63c7a89 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -192,6 +192,10 @@ static inline unsigned parseOptions(const QStringList &paramList,
}
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
+ } else if (param == QLatin1String("nodirectwrite")) {
+ options |= QWindowsIntegration::DontUseDirectWriteFonts;
+ } else if (param == QLatin1String("nocolorfonts")) {
+ options |= QWindowsIntegration::DontUseColorFonts;
} else if (param == QLatin1String("nomousefromtouch")) {
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
} else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose)
@@ -304,7 +308,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
if (window->type() == Qt::ForeignWindow) {
const HWND hwnd = reinterpret_cast<HWND>(window->winId());
if (!IsWindow(hwnd)) {
- qWarning("Windows QPA: Invalid foreign window ID %p.");
+ qWarning("Windows QPA: Invalid foreign window ID %p.", hwnd);
return nullptr;
}
QWindowsForeignWindow *result = new QWindowsForeignWindow(window, hwnd);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 437253cedc..4258f908e7 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -60,7 +60,9 @@ public:
DisableArb = 0x4,
NoNativeDialogs = 0x8,
XpNativeDialogs = 0x10,
- DontPassOsMouseEventsSynthesizedFromTouch = 0x20 // Do not pass OS-generated mouse events from touch.
+ DontPassOsMouseEventsSynthesizedFromTouch = 0x20, // Do not pass OS-generated mouse events from touch.
+ DontUseDirectWriteFonts = 0x40,
+ DontUseColorFonts = 0x80
};
explicit QWindowsIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 8d6e83298e..79b5bbae41 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -43,6 +43,7 @@
#include "qwindowswindow.h"
#include "qwindowsinputcontext.h"
+#include <QtGui/QGuiApplication>
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
#include <private/qguiapplication_p.h>
@@ -1048,6 +1049,21 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
// Found a ?_CHAR
uch = QChar(ushort(wm_char.wParam));
+ if (uch.isHighSurrogate()) {
+ m_lastHighSurrogate = uch;
+ return true;
+ } else if (uch.isLowSurrogate() && !m_lastHighSurrogate.isNull()) {
+ if (QObject *focusObject = QGuiApplication::focusObject()) {
+ const QChar chars[2] = {m_lastHighSurrogate, uch};
+ QInputMethodEvent event;
+ event.setCommitString(QString(chars, 2));
+ QCoreApplication::sendEvent(focusObject, &event);
+ }
+ m_lastHighSurrogate = QChar();
+ return true;
+ } else {
+ m_lastHighSurrogate = QChar();
+ }
if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN))
uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter
if (!code && !uch.row())
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index 069f78197e..2657644780 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -103,6 +103,7 @@ private:
void deleteLayouts();
QWindow *m_keyGrabber;
+ QChar m_lastHighSurrogate;
static const size_t NumKeyboardLayoutItems = 256;
KeyboardLayoutItem keyLayout[NumKeyboardLayoutItems];
};
diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
index 1cadcd1954..6929f7365f 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -1,7 +1,7 @@
# Note: OpenGL32 must precede Gdi32 as it overwrites some functions.
LIBS += -lole32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32
-contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32
+qtConfig(opengl):!qtConfig(opengles2):!qtConfig(dynamicgl): LIBS *= -lopengl32
mingw: LIBS *= -luuid
# For the dialog helpers:
@@ -9,8 +9,8 @@ LIBS += -lshlwapi -lshell32 -ladvapi32
DEFINES *= QT_NO_CAST_FROM_ASCII
-contains(QT_CONFIG, directwrite) {
- contains(QT_CONFIG, directwrite2): \
+qtConfig(directwrite) {
+ qtConfig(directwrite2): \
DEFINES *= QT_USE_DIRECTWRITE2
SOURCES += $$PWD/qwindowsfontenginedirectwrite.cpp
@@ -65,18 +65,18 @@ HEADERS += \
INCLUDEPATH += $$PWD
-contains(QT_CONFIG,opengl): HEADERS += $$PWD/qwindowsopenglcontext.h
+qtConfig(opengl): HEADERS += $$PWD/qwindowsopenglcontext.h
-contains(QT_CONFIG, opengles2) {
+qtConfig(opengles2) {
SOURCES += $$PWD/qwindowseglcontext.cpp
HEADERS += $$PWD/qwindowseglcontext.h
-} else: contains(QT_CONFIG,opengl) {
+} else: qtConfig(opengl) {
SOURCES += $$PWD/qwindowsglcontext.cpp
HEADERS += $$PWD/qwindowsglcontext.h
}
# Dynamic GL needs both WGL and EGL
-contains(QT_CONFIG,dynamicgl) {
+qtConfig(dynamicgl) {
SOURCES += $$PWD/qwindowseglcontext.cpp
HEADERS += $$PWD/qwindowseglcontext.h
}
@@ -111,18 +111,17 @@ contains(QT_CONFIG,dynamicgl) {
RESOURCES += $$PWD/openglblacklists.qrc
-contains(QT_CONFIG, freetype) {
+qtConfig(freetype) {
HEADERS += $$PWD/qwindowsfontdatabase_ft.h
SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp
- contains(QT_CONFIG, system-freetype) {
+ qtConfig(system-freetype) {
include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri)
} else {
- DEFINES *= QT_NO_FONTCONFIG
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
}
}
-contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri)
+qtConfig(accessibility): include($$PWD/accessible/accessible.pri)
DEFINES *= LIBEGL_NAME=$${LIBEGL_NAME}
DEFINES *= LIBGLESV2_NAME=$${LIBGLESV2_NAME}
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp
index a910967f87..606ca22bcd 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.cpp
+++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp
@@ -322,10 +322,59 @@ void QWinRTWindow::setWindowState(Qt::WindowState state)
if (d->state == state)
return;
+#if _MSC_VER >= 1900
+ if (state == Qt::WindowFullScreen) {
+ HRESULT hr;
+ boolean success;
+ hr = QEventDispatcherWinRT::runOnXamlThread([&hr, &success]() {
+ ComPtr<IApplicationViewStatics2> applicationViewStatics;
+ hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(),
+ IID_PPV_ARGS(&applicationViewStatics));
+ RETURN_HR_IF_FAILED("Could not access application view statics.");
+ ComPtr<IApplicationView> view;
+ hr = applicationViewStatics->GetForCurrentView(&view);
+ RETURN_HR_IF_FAILED("Could not access application view.");
+ ComPtr<IApplicationView3> view3;
+ hr = view.As(&view3);
+ Q_ASSERT_SUCCEEDED(hr);
+ hr = view3->TryEnterFullScreenMode(&success);
+ return hr;
+ });
+ if (FAILED(hr) || !success) {
+ qCDebug(lcQpaWindows) << "Failed to enter full screen mode.";
+ return;
+ }
+ d->state = state;
+ return;
+ }
+
+ if (d->state == Qt::WindowFullScreen) {
+ HRESULT hr;
+ hr = QEventDispatcherWinRT::runOnXamlThread([&hr]() {
+ ComPtr<IApplicationViewStatics2> applicationViewStatics;
+ hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_ApplicationView).Get(),
+ IID_PPV_ARGS(&applicationViewStatics));
+ RETURN_HR_IF_FAILED("Could not access application view statics.");
+ ComPtr<IApplicationView> view;
+ hr = applicationViewStatics->GetForCurrentView(&view);
+ RETURN_HR_IF_FAILED("Could not access application view.");
+ ComPtr<IApplicationView3> view3;
+ hr = view.As(&view3);
+ Q_ASSERT_SUCCEEDED(hr);
+ hr = view3->ExitFullScreenMode();
+ return hr;
+ });
+ if (FAILED(hr)) {
+ qCDebug(lcQpaWindows) << "Failed to exit full screen mode.";
+ return;
+ }
+ }
+#endif // _MSC_VER >= 1900
+
if (state == Qt::WindowMinimized)
setUIElementVisibility(d->uiElement.Get(), false);
- if (d->state == Qt::WindowMinimized)
+ if (d->state == Qt::WindowMinimized || state == Qt::WindowNoState || state == Qt::WindowActive)
setUIElementVisibility(d->uiElement.Get(), true);
d->state = state;
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro
index 9de0476810..0cdee03f62 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro
@@ -1,9 +1,9 @@
TEMPLATE = subdirs
-contains(QT_CONFIG, egl): contains(QT_CONFIG, egl_x11): contains(QT_CONFIG, opengl) {
+qtConfig(egl):qtConfig(egl_x11):qtConfig(opengl) {
SUBDIRS += xcb_egl
}
-contains(QT_CONFIG, xcb-xlib): contains(QT_CONFIG, opengl): !contains(QT_CONFIG, opengles2) {
+qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) {
SUBDIRS += xcb_glx
}
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
index c2d3849d8e..57c8f27d9c 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
@@ -4,35 +4,31 @@ INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/../
# needed by Xcursor ...
-contains(QT_CONFIG, xcb-xlib) {
+qtConfig(xcb-xlib) {
DEFINES += XCB_USE_XLIB
- contains(QT_CONFIG, xinput2) {
+ qtConfig(xinput2) {
DEFINES += XCB_USE_XINPUT2
}
}
-# to support custom cursors with depth > 1
-contains(QT_CONFIG, xcb-render) {
- DEFINES += XCB_USE_RENDER
-}
-
# build with session management support
-contains(QT_CONFIG, xcb-sm) {
+qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
}
-DEFINES += $$QMAKE_DEFINES_XCB
-LIBS += $$QMAKE_LIBS_XCB
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
-
CONFIG += qpa/genericunixfontdatabase
-contains(QT_CONFIG, xcb-qt) {
+!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb)
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
- LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ QMAKE_USE += xcb
} else {
- LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms
- !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
+ qtConfig(xkb): QMAKE_USE += xcb_xkb
+ # to support custom cursors with depth > 1
+ qtConfig(xcb-render) {
+ DEFINES += XCB_USE_RENDER
+ }
+ QMAKE_USE += xcb_syslibs
}
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h
index 9729f610b6..7c6524c8ee 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h
@@ -46,7 +46,7 @@
#include <QtGui/private/qcssparser_p.h>
#include <QtGui/private/qtextengine_p.h>
-#include <EGL/egl.h>
+#include <QtPlatformSupport/private/qt_egl_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
index 6d52332bad..92e6c18fbe 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
@@ -4,7 +4,7 @@ include(../gl_integrations_plugin_base.pri)
CONFIG += egl
-contains(QT_CONFIG, xcb-xlib): DEFINES += XCB_USE_XLIB
+qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB
HEADERS += \
qxcbeglcontext.h \
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 67fd68765a..88c4144fd9 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
@@ -5,12 +5,11 @@ include(../gl_integrations_plugin_base.pri)
#should be removed from the sources
DEFINES += XCB_USE_GLX XCB_USE_XLIB
-LIBS += -lxcb
-
-contains(QT_CONFIG, xcb-glx) {
+qtConfig(xcb-glx) {
DEFINES += XCB_HAS_XCB_GLX
- LIBS += -lxcb-glx
+ QMAKE_USE += xcb_glx
}
+QMAKE_USE += xcb
LIBS += $$QMAKE_LIBS_DYNLOAD
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 7065bb0ffb..2d959688b3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -599,7 +599,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
xcb_extension_t *extensions[] = {
&xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id,
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
&xcb_xkb_id,
#endif
#ifdef XCB_USE_RENDER
@@ -1069,7 +1069,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s)
}
}
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
namespace {
typedef union {
/* All XKB events share these fields. */
@@ -1252,7 +1252,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
s->handleScreenChange(change_event);
}
handled = true;
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
} else if (response_type == xkb_first_event) { // https://bugs.freedesktop.org/show_bug.cgi?id=51295
_xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event);
if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) {
@@ -2174,7 +2174,7 @@ void QXcbConnection::initializeXShape()
void QXcbConnection::initializeXKB()
{
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id);
if (!reply || !reply->present) {
qWarning("Qt: XKEYBOARD extension not present on the X server.");
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 34866e5c89..4d903ec8d3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -53,10 +53,11 @@
#include <QVarLengthArray>
#include <qpa/qwindowsysteminterface.h>
#include <QtCore/QLoggingCategory>
+#include <QtCore/private/qglobal_p.h>
// This is needed to make Qt compile together with XKB. xkb.h is using a variable
// which is called 'explicit', this is a reserved keyword in c++
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
#define explicit dont_use_cxx_explicit
#include <xcb/xkb.h>
#undef explicit
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 5b7f45fb6c..bda167bce9 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -697,7 +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 LIBXI_MAJOR
+#ifndef XCB_USE_XINPUT2
static bool allowTouchWarningShown = false;
if (!allowTouchWarningShown) {
allowTouchWarningShown = true;
@@ -705,13 +705,16 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
" Minimum libXi version required is 1.7.4."
" Expect issues with touch behavior.");
}
-#elif LIBXI_MAJOR == 1 && (LIBXI_MINOR < 7 || (LIBXI_MINOR == 7 && LIBXI_PATCH < 4))
+#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.", LIBXI_MAJOR, LIBXI_MINOR, LIBXI_PATCH);
+ " Expect issues with touch behavior.",
+ QT_LIBRARY_VERSION_MAJOR(xinput2),
+ QT_LIBRARY_VERSION_MINOR(xinput2),
+ QT_LIBRARY_VERSION_PATCH(xinput2));
}
#else
XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid,
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index cdbf9b295e..5a89113a4f 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -65,7 +65,7 @@
#include <QtGui/private/qguiapplication_p.h>
#ifdef XCB_USE_EGL
-#include <EGL/egl.h>
+# include <QtPlatformSupport/private/qt_egl_p.h>
#endif
#ifdef XCB_USE_XLIB
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index 811ef4251a..07932ceeb8 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -711,7 +711,7 @@ void QXcbKeyboard::updateKeymap()
xkb_keymap = 0;
struct xkb_state *new_state = 0;
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
if (connection()->hasXKB()) {
xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0);
if (xkb_keymap) {
@@ -754,7 +754,7 @@ void QXcbKeyboard::updateKeymap()
checkForLatinLayout();
}
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state)
{
if (m_config && connection()->hasXKB()) {
@@ -1140,7 +1140,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)
, m_hasLatinLayout(false)
{
memset(&xkb_names, 0, sizeof(xkb_names));
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
core_device_id = 0;
if (connection->hasXKB()) {
updateVModMapping();
@@ -1154,7 +1154,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection)
#endif
m_key_symbols = xcb_key_symbols_alloc(xcb_connection());
updateModifiers();
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
}
#endif
updateKeymap();
@@ -1173,7 +1173,7 @@ QXcbKeyboard::~QXcbKeyboard()
void QXcbKeyboard::updateVModMapping()
{
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
xcb_xkb_get_names_cookie_t names_cookie;
xcb_xkb_get_names_reply_t *name_reply;
xcb_xkb_get_names_value_list_t names_list;
@@ -1242,7 +1242,7 @@ void QXcbKeyboard::updateVModMapping()
void QXcbKeyboard::updateVModToRModMapping()
{
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
xcb_xkb_get_map_cookie_t map_cookie;
xcb_xkb_get_map_reply_t *map_reply;
xcb_xkb_get_map_map_t map;
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 75e6d2ec82..817b57ff5b 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -45,7 +45,7 @@
#include <xcb/xcb_keysyms.h>
#include <xkbcommon/xkbcommon.h>
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
#include <xkbcommon/xkbcommon-x11.h>
#endif
@@ -77,7 +77,7 @@ public:
#ifdef XCB_USE_XINPUT22
void updateXKBStateFromXI(void *modInfo, void *groupInfo);
#endif
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
// when XKEYBOARD is present on the X server
int coreDeviceId() const { return core_device_id; }
void updateXKBState(xcb_xkb_state_notify_event_t *state);
@@ -136,7 +136,7 @@ private:
xkb_mod_index_t mod5;
};
_xkb_mods xkb_mods;
-#ifndef QT_NO_XKB
+#if QT_CONFIG(xkb)
// when XKEYBOARD is present on the X server
_mod_masks vmod_masks;
int core_device_id;
diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro
index 5915a59c0b..7840a4583f 100644
--- a/src/plugins/platforms/xcb/xcb.pro
+++ b/src/plugins/platforms/xcb/xcb.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
CONFIG += ordered
-contains(QT_CONFIG, xcb-qt):SUBDIRS+=xcb-static
+!qtConfig(system-xcb): SUBDIRS += xcb-static
SUBDIRS += xcb_qpa_lib.pro
SUBDIRS += xcb-plugin.pro
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index 7967aee3ab..942183877d 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -41,67 +41,54 @@ HEADERS = \
DEFINES += QT_BUILD_XCB_PLUGIN
# needed by Xcursor ...
-contains(QT_CONFIG, xcb-xlib) {
+qtConfig(xcb-xlib) {
DEFINES += XCB_USE_XLIB
- LIBS += -lX11 -lX11-xcb
+ QMAKE_USE += xcb_xlib
- contains(QT_CONFIG, xinput2) {
+ qtConfig(xinput2) {
DEFINES += XCB_USE_XINPUT2
SOURCES += qxcbconnection_xi2.cpp
- LIBS += -lXi
- !isEmpty(QMAKE_XINPUT2_VERSION_MAJOR) {
- DEFINES += LIBXI_MAJOR=$$QMAKE_XINPUT2_VERSION_MAJOR \
- LIBXI_MINOR=$$QMAKE_XINPUT2_VERSION_MINOR \
- LIBXI_PATCH=$$QMAKE_XINPUT2_VERSION_PATCH
- }
+ QMAKE_USE += xinput2
}
}
-# to support custom cursors with depth > 1
-contains(QT_CONFIG, xcb-render) {
- DEFINES += XCB_USE_RENDER
- LIBS += -lxcb-render -lxcb-render-util
-}
-
# build with session management support
-contains(QT_CONFIG, xcb-sm) {
+qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
- LIBS += -lSM -lICE
+ QMAKE_USE += x11sm
SOURCES += qxcbsessionmanager.cpp
HEADERS += qxcbsessionmanager.h
}
include(gl_integrations/gl_integrations.pri)
-DEFINES += $$QMAKE_DEFINES_XCB
-LIBS += $$QMAKE_LIBS_XCB
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
-QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
-
CONFIG += qpa/genericunixfontdatabase
-contains(QT_CONFIG, dbus-linked) {
+qtConfig(dbus-linked): \
QT += dbus
- LIBS += $$QMAKE_LIBS_DBUS
-}
-contains(QT_CONFIG, xcb-qt) {
+!qtConfig(system-xcb) {
DEFINES += XCB_USE_RENDER
XCB_DIR = ../../../3rdparty/xcb
INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
- LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix()
+ QMAKE_USE += xcb
} else {
- LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xinerama
- !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb
+ LIBS += -lxcb-xinerama ### there is no configure test for this!
+ qtConfig(xkb): QMAKE_USE += xcb_xkb
+ # to support custom cursors with depth > 1
+ qtConfig(xcb-render) {
+ DEFINES += XCB_USE_RENDER
+ QMAKE_USE += xcb_render
+ }
+ QMAKE_USE += xcb_syslibs
}
# libxkbcommon
-contains(QT_CONFIG, xkbcommon-qt) {
- QT_CONFIG += use-xkbcommon-x11support
- include(../../../3rdparty/xkbcommon.pri)
+!qtConfig(xkbcommon-system) {
+ include(../../../3rdparty/xkbcommon-x11.pri)
} else {
- LIBS += $$QMAKE_LIBS_XKBCOMMON
- QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+ QMAKE_USE += xkbcommon
}
load(qt_module)
diff --git a/src/plugins/platformthemes/gtk3/gtk3.pro b/src/plugins/platformthemes/gtk3/gtk3.pro
index 72a33efeac..12364b0b57 100644
--- a/src/plugins/platformthemes/gtk3/gtk3.pro
+++ b/src/plugins/platformthemes/gtk3/gtk3.pro
@@ -8,8 +8,7 @@ load(qt_plugin)
QT += core-private gui-private platformsupport-private
CONFIG += X11
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GTK3
-LIBS += $$QMAKE_LIBS_GTK3
+QMAKE_USE += gtk3
HEADERS += \
qgtk3dialoghelpers.h \
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
index eb581f5138..308eee5404 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
@@ -117,8 +117,10 @@ void QGtk3Dialog::exec()
bool QGtk3Dialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
{
- connect(parent, &QWindow::destroyed, this, &QGtk3Dialog::onParentWindowDestroyed,
- Qt::UniqueConnection);
+ if (parent) {
+ connect(parent, &QWindow::destroyed, this, &QGtk3Dialog::onParentWindowDestroyed,
+ Qt::UniqueConnection);
+ }
setParent(parent);
setFlags(flags);
setModality(modality);
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
index 288978ae84..52757587b4 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
@@ -371,7 +371,7 @@ void QGtk3Menu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *befor
void QGtk3Menu::removeMenuItem(QPlatformMenuItem *item)
{
QGtk3MenuItem *gitem = static_cast<QGtk3MenuItem *>(item);
- if (!gitem && !m_items.removeOne(gitem))
+ if (!gitem || !m_items.removeOne(gitem))
return;
GtkWidget *handle = gitem->handle();
diff --git a/src/plugins/platformthemes/platformthemes.pro b/src/plugins/platformthemes/platformthemes.pro
index f5f54068a2..166b39ce8c 100644
--- a/src/plugins/platformthemes/platformthemes.pro
+++ b/src/plugins/platformthemes/platformthemes.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-contains(QT_CONFIG, gtk3): SUBDIRS += gtk3
+qtConfig(gtk3): SUBDIRS += gtk3
diff --git a/src/plugins/printsupport/cups/cups.pro b/src/plugins/printsupport/cups/cups.pro
index 757408e7f7..58bc11606b 100644
--- a/src/plugins/printsupport/cups/cups.pro
+++ b/src/plugins/printsupport/cups/cups.pro
@@ -3,7 +3,7 @@ MODULE = cupsprintersupport
QT += core-private gui-private printsupport printsupport-private
-LIBS_PRIVATE += -lcups
+QMAKE_USE_PRIVATE += cups
INCLUDEPATH += ../../../printsupport/kernel
diff --git a/src/plugins/printsupport/printsupport.pro b/src/plugins/printsupport/printsupport.pro
index bd6681f53c..55feaba40c 100644
--- a/src/plugins/printsupport/printsupport.pro
+++ b/src/plugins/printsupport/printsupport.pro
@@ -1,8 +1,6 @@
+QT += printsupport
TEMPLATE = subdirs
osx: SUBDIRS += cocoa
win32: SUBDIRS += windows
-unix:!mac:contains(QT_CONFIG, cups) {
- load(qfeatures)
- !contains(QT_DISABLED_FEATURES, cups): SUBDIRS += cups
-}
+unix:!darwin:qtConfig(cups): SUBDIRS += cups
diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro
index 31822ef8dc..eef65fac66 100644
--- a/src/plugins/sqldrivers/db2/db2.pro
+++ b/src/plugins/sqldrivers/db2/db2.pro
@@ -3,11 +3,7 @@ TARGET = qsqldb2
HEADERS += $$PWD/qsql_db2_p.h
SOURCES += $$PWD/qsql_db2.cpp $$PWD/main.cpp
-unix {
- !contains(LIBS, .*db2.*):LIBS += -ldb2
-} else {
- !contains(LIBS, .*db2.*):LIBS += -ldb2cli
-}
+QMAKE_USE += db2
OTHER_FILES += db2.json
diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro
index 8237245183..e5709207d1 100644
--- a/src/plugins/sqldrivers/ibase/ibase.pro
+++ b/src/plugins/sqldrivers/ibase/ibase.pro
@@ -3,13 +3,8 @@ TARGET = qsqlibase
HEADERS += $$PWD/qsql_ibase_p.h
SOURCES += $$PWD/qsql_ibase.cpp $$PWD/main.cpp
-unix {
- !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds
-} else {
- !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) {
- LIBS += -lgds32_ms
- }
-}
+# FIXME: ignores libfb (unix)/fbclient (win32) - but that's for the test anyway
+QMAKE_USE += ibase
OTHER_FILES += ibase.json
diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro
index 3bd8cd0040..56dd5f598c 100644
--- a/src/plugins/sqldrivers/mysql/mysql.pro
+++ b/src/plugins/sqldrivers/mysql/mysql.pro
@@ -3,19 +3,7 @@ TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
-QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_MYSQL
-LIBS += $$QMAKE_LIBS_MYSQL
-
-unix {
- isEmpty(QMAKE_LIBS_MYSQL) {
- !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
- use_libmysqlclient_r:LIBS += -lmysqlclient_r
- else:LIBS += -lmysqlclient
- }
- }
-} else {
- !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql
-}
+QMAKE_USE += mysql
OTHER_FILES += mysql.json
diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro
index a22d1181bf..e6ef71f20f 100644
--- a/src/plugins/sqldrivers/oci/oci.pro
+++ b/src/plugins/sqldrivers/oci/oci.pro
@@ -3,11 +3,8 @@ TARGET = qsqloci
HEADERS += $$PWD/qsql_oci_p.h
SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
-unix {
- !contains(LIBS, .*clnts.*):LIBS += -lclntsh
-} else {
- LIBS *= -loci
-}
+QMAKE_USE += oci
+
darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
OTHER_FILES += oci.json
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index 0e49f1ac66..17844f27d2 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -3,15 +3,8 @@ TARGET = qsqlodbc
HEADERS += $$PWD/qsql_odbc_p.h
SOURCES += $$PWD/qsql_odbc.cpp $$PWD/main.cpp
-unix {
- DEFINES += UNICODE
- !contains(LIBS, .*odbc.*) {
- osx:LIBS += -liodbc
- else:LIBS += $$QMAKE_LIBS_ODBC
- }
-} else {
- LIBS *= -lodbc32
-}
+QMAKE_USE += odbc
+unix: DEFINES += UNICODE
OTHER_FILES += odbc.json
diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
index 4a05266120..c44a6319c3 100644
--- a/src/plugins/sqldrivers/psql/psql.pro
+++ b/src/plugins/sqldrivers/psql/psql.pro
@@ -3,13 +3,7 @@ TARGET = qsqlpsql
HEADERS += $$PWD/qsql_psql_p.h
SOURCES += $$PWD/qsql_psql.cpp $$PWD/main.cpp
-unix|mingw {
- LIBS += $$QMAKE_LIBS_PSQL
- !contains(LIBS, .*pq.*):LIBS += -lpq
- QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_PSQL
-} else {
- !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32
-}
+QMAKE_USE += psql
OTHER_FILES += psql.json
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro
index c98655f85c..bcdf7d36f3 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -3,11 +3,10 @@ TARGET = qsqlite
HEADERS += $$PWD/qsql_sqlite_p.h
SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp
-!system-sqlite:!contains(LIBS, .*sqlite3.*) {
+!system-sqlite {
include($$PWD/../../../3rdparty/sqlite.pri)
} else {
- LIBS += $$QMAKE_LIBS_SQLITE
- QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_SQLITE
+ QMAKE_USE += sqlite
}
OTHER_FILES += sqlite.json
diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
index d0ab0eef41..721facb5b8 100644
--- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro
+++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
@@ -3,7 +3,7 @@ TARGET = qsqlite2
HEADERS += $$PWD/qsql_sqlite2_p.h
SOURCES += $$PWD/qsql_sqlite2.cpp $$PWD/smain.cpp
-!contains(LIBS, .*sqlite.*):LIBS += -lsqlite
+QMAKE_USE += sqlite2
OTHER_FILES += sqlite2.json
diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
index b5d32ae5a8..67bc0f5c48 100644
--- a/src/plugins/sqldrivers/tds/tds.pro
+++ b/src/plugins/sqldrivers/tds/tds.pro
@@ -3,13 +3,7 @@ TARGET = qsqltds
HEADERS += $$PWD/qsql_tds_p.h
SOURCES += $$PWD/qsql_tds.cpp $$PWD/main.cpp
-unix|mingw: {
- LIBS += $$QMAKE_LIBS_TDS
- !contains(LIBS, .*sybdb.*):LIBS += -lsybdb
- QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_TDS
-} else {
- LIBS *= -lNTWDBLIB
-}
+QMAKE_USE += tds
OTHER_FILES += tds.json
diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp
index 7547e31a9e..3c5f882f2e 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.cpp
+++ b/src/printsupport/dialogs/qabstractprintdialog.cpp
@@ -393,13 +393,13 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter)
settings for each available printer can be modified via the dialog's
\uicontrol{Properties} push button.
- On Windows and OS X, the native print dialog is used, which means that
+ On Windows and \macos, the native print dialog is used, which means that
some QWidget and QDialog properties set on the dialog won't be respected.
- The native print dialog on OS X does not support setting printer options,
+ The native print dialog on \macos does not support setting printer options,
i.e. setOptions() and setOption() have no effect.
In Qt 4.4, it was possible to use the static functions to show a sheet on
- OS X. This is no longer supported in Qt 4.5. If you want this
+ \macos. This is no longer supported in Qt 4.5. If you want this
functionality, use QPrintDialog::open().
\sa QPageSetupDialog, QPrinter
@@ -459,7 +459,7 @@ void QAbstractPrintDialog::setOptionTabs(const QList<QWidget*> &tabs)
and exec() to return \a result.
\note This function does not apply to the Native Print Dialog on the Mac
- OS X and Windows platforms, because the dialog is required to be modal
+ \macos and Windows platforms, because the dialog is required to be modal
and only the user can close it.
\sa QDialog::done()
diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp
index cfc391ef43..81cbf87777 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog.cpp
@@ -56,12 +56,12 @@ QT_BEGIN_NAMESPACE
\ingroup printing
\inmodule QtPrintSupport
- On Windows and OS X the page setup dialog is implemented using
+ On Windows and \macos the page setup dialog is implemented using
the native page setup dialogs.
- Note that on Windows and OS X custom paper sizes won't be
+ Note that on Windows and \macos custom paper sizes won't be
reflected in the native page setup dialogs. Additionally, custom
- page margins set on a QPrinter won't show in the native OS X
+ page margins set on a QPrinter won't show in the native \macos
page setup dialog.
\sa QPrinter, QPrintDialog
diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri
index bf95d9e8f6..22d12e4cc3 100644
--- a/src/printsupport/kernel/kernel.pri
+++ b/src/printsupport/kernel/kernel.pri
@@ -33,7 +33,7 @@ win32 {
LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32
}
-unix:!mac:contains(QT_CONFIG, cups): {
+unix:!darwin:qtConfig(cups) {
SOURCES += $$PWD/qcups.cpp
HEADERS += $$PWD/qcups_p.h
}
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 584be11199..6d6d61b343 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -318,7 +318,7 @@ public:
features, such as orientation and resolution, and to step through
the pages in a document as it is generated.
- When printing directly to a printer on Windows or OS X, QPrinter uses
+ When printing directly to a printer on Windows or \macos, QPrinter uses
the built-in printer drivers. On X11, QPrinter uses the
\l{Common Unix Printing System (CUPS)}
to send PDF output to the printer. As an alternative,
@@ -916,7 +916,7 @@ QString QPrinter::outputFileName() const
QPrinter uses Qt's cross-platform PDF print engines
respectively. If you can produce this format natively, for example
- OS X can generate PDF's from its print engine, set the output format
+ \macos can generate PDF's from its print engine, set the output format
back to NativeFormat.
\sa outputFileName(), setOutputFormat()
@@ -1386,7 +1386,7 @@ QPrinter::ColorMode QPrinter::colorMode() const
\obsolete
Returns the number of copies to be printed. The default value is 1.
- On Windows, OS X and X11 systems that support CUPS, this will always
+ On Windows, \macos and X11 systems that support CUPS, this will always
return 1 as these operating systems can internally handle the number
of copies.
diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri
index 8e5cb12a6d..8a98da1718 100644
--- a/src/printsupport/widgets/widgets.pri
+++ b/src/printsupport/widgets/widgets.pri
@@ -1,7 +1,7 @@
HEADERS += widgets/qprintpreviewwidget.h
SOURCES += widgets/qprintpreviewwidget.cpp
-unix:!mac:contains(QT_CONFIG, cups): {
+unix:!darwin:qtConfig(cups) {
HEADERS += widgets/qcupsjobwidget_p.h
SOURCES += widgets/qcupsjobwidget.cpp
FORMS += widgets/qcupsjobwidget.ui
diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc
index 9d3a8fbfed..56d714becf 100644
--- a/src/sql/doc/src/qtsql.qdoc
+++ b/src/sql/doc/src/qtsql.qdoc
@@ -51,6 +51,19 @@
QT += sql
\endcode
+ \section1 Licenses and Attributions
+
+ Qt SQL is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt SQL potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtsql}
+
\section1 Related Information
These are links to the API reference materials and related pages.
diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc
index ddf6e74618..a33f60b561 100644
--- a/src/sql/doc/src/sql-driver.qdoc
+++ b/src/sql/doc/src/sql-driver.qdoc
@@ -77,7 +77,7 @@
\target building
\section1 Building the Drivers Using Configure
- On Unix and OS X, the Qt \c configure script tries to
+ On Unix and \macos, the Qt \c configure script tries to
automatically detect the available client libraries on your
machine. Run \c{configure -help} to see what drivers can be
built. You should get an output similar to this:
@@ -139,7 +139,7 @@
Please refer to the MySQL documentation, chapter "libmysqld, the Embedded
MySQL Server Library" for more information about the MySQL embedded server.
- \section3 How to Build the QMYSQL Plugin on Unix and OS X
+ \section3 How to Build the QMYSQL Plugin on Unix and \macos
You need the MySQL header files and as well as the shared library
\c{libmysqlclient.so}. Depending on your Linux distribution you may
@@ -208,7 +208,7 @@
BLOBs are bound to placeholders or QSqlTableModel, which uses a prepared
query to do this internally.
- \section3 How to Build the OCI Plugin on Unix and OS X
+ \section3 How to Build the OCI Plugin on Unix and \macos
For Oracle 10g, all you need is the "Instant Client Package - Basic" and
"Instant Client Package - SDK". For Oracle prior to 10g, you require
@@ -343,7 +343,7 @@
"SQL_WCHAR support" in the ODBC driver manager otherwise Oracle
will convert all Unicode strings to local 8-bit.
- \section3 How to Build the ODBC Plugin on Unix and OS X
+ \section3 How to Build the ODBC Plugin on Unix and \macos
It is recommended that you use unixODBC. You can find the latest
version and ODBC drivers at \l http://www.unixodbc.org.
@@ -400,7 +400,7 @@
Binary Large Objects are supported through the \c BYTEA field type in
PostgreSQL server versions >= 7.1.
- \section3 How to Build the QPSQL Plugin on Unix and OS X
+ \section3 How to Build the QPSQL Plugin on Unix and \macos
You need the PostgreSQL client library and headers installed.
@@ -440,7 +440,7 @@
Sybase client library. Refer to the Sybase documentation for information on how to set up
a Sybase client configuration file to enable connections to databases on non-default ports.
- \section3 How to Build the QTDS Plugin on Unix and OS X
+ \section3 How to Build the QTDS Plugin on Unix and \macos
Under Unix, two libraries are available which support the TDS protocol:
@@ -493,7 +493,7 @@
We suggest using a forward-only query when calling stored procedures
in DB2 (see QSqlQuery::setForwardOnly()).
- \section3 How to Build the QDB2 Plugin on Unix and OS X
+ \section3 How to Build the QDB2 Plugin on Unix and \macos
\snippet code/doc_src_sql-driver.qdoc 18
@@ -643,7 +643,7 @@
\snippet code/doc_src_sql-driver.cpp 26
- \section3 How to Build the QIBASE Plugin on Unix and OS X
+ \section3 How to Build the QIBASE Plugin on Unix and \macos
The following assumes InterBase or Firebird is installed in
\c{/opt/interbase}:
diff --git a/src/src.pro b/src/src.pro
index c4da871abe..ec656e483c 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,7 +1,5 @@
TEMPLATE = subdirs
-load(qfeatures)
-
src_qtzlib.file = $$PWD/corelib/qtzlib.pro
src_qtzlib.target = sub-zlib
@@ -132,9 +130,9 @@ src_plugins.depends = src_sql src_xml src_network
src_android.subdir = $$PWD/android
# this order is important
-!contains(QT_CONFIG, system-zlib)|cross_compile {
+!qtConfig(system-zlib)|cross_compile {
SUBDIRS += src_qtzlib
- !contains(QT_CONFIG, system-zlib) {
+ !qtConfig(system-zlib) {
src_3rdparty_libpng.depends += src_corelib
src_3rdparty_freetype.depends += src_corelib
}
@@ -148,44 +146,44 @@ SUBDIRS += src_corelib src_tools_qlalr
TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr
win32:SUBDIRS += src_winmain
SUBDIRS += src_network src_sql src_xml src_testlib
-contains(QT_CONFIG, dbus) {
- force_bootstrap|contains(QT_CONFIG, private_tests): \
+qtConfig(dbus) {
+ force_bootstrap|qtConfig(private_tests): \
SUBDIRS += src_tools_bootstrap_dbus
SUBDIRS += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
TOOLS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
- contains(QT_CONFIG, accessibility-atspi-bridge): \
+ qtConfig(accessibility-atspi-bridge): \
src_platformsupport.depends += src_dbus src_tools_qdbusxml2cpp
src_plugins.depends += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
}
-contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
-!contains(QT_CONFIG, no-gui) {
- contains(QT_CONFIG, harfbuzz):!contains(QT_CONFIG, system-harfbuzz) {
+qtConfig(concurrent): SUBDIRS += src_concurrent
+qtConfig(gui) {
+ qtConfig(harfbuzz):!qtConfig(system-harfbuzz) {
SUBDIRS += src_3rdparty_harfbuzzng
src_gui.depends += src_3rdparty_harfbuzzng
}
- contains(QT_CONFIG, angle) {
+ qtConfig(angle) {
SUBDIRS += src_angle
src_gui.depends += src_angle
}
- contains(QT_CONFIG, png) {
+ qtConfig(png) {
SUBDIRS += src_3rdparty_libpng
src_3rdparty_freetype.depends += src_3rdparty_libpng
src_gui.depends += src_3rdparty_libpng
}
- contains(QT_CONFIG, freetype):!contains(QT_CONFIG, system-freetype) {
+ qtConfig(freetype):!qtConfig(system-freetype) {
SUBDIRS += src_3rdparty_freetype
src_platformsupport.depends += src_3rdparty_freetype
}
SUBDIRS += src_gui src_platformsupport src_platformheaders
- contains(QT_CONFIG, opengl(es2)?):SUBDIRS += src_openglextensions
+ qtConfig(opengl(es2)?): SUBDIRS += src_openglextensions
src_plugins.depends += src_gui src_platformsupport src_platformheaders
src_testlib.depends += src_gui # if QtGui is enabled, QtTest requires QtGui's headers
- !contains(QT_CONFIG, no-widgets) {
+ qtConfig(widgets) {
SUBDIRS += src_tools_uic src_widgets
TOOLS += src_tools_uic
src_plugins.depends += src_widgets
src_testlib.depends += src_widgets # if QtWidgets is enabled, QtTest requires QtWidgets's headers
- contains(QT_CONFIG, opengl(es2)?) {
+ qtConfig(opengl(es2)?) {
SUBDIRS += src_opengl
src_plugins.depends += src_opengl
}
diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc
index 624c314f6c..a420ec4761 100644
--- a/src/testlib/doc/src/qttestlib-manual.qdoc
+++ b/src/testlib/doc/src/qttestlib-manual.qdoc
@@ -317,7 +317,7 @@
\li All platforms
\row \li CPU tick counter
\li -tickcounter
- \li Windows, OS X, Linux, many UNIX-like systems.
+ \li Windows, \macos, Linux, many UNIX-like systems.
\row \li Event Counter
\li -eventcounter
\li All platforms
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp
index 1fa76a692a..3fec0ad98a 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -106,6 +106,9 @@ static QSet<QByteArray> keywords()
#ifdef Q_OS_TVOS
<< "tvos"
#endif
+#ifdef Q_OS_WATCHOS
+ << "watchos"
+#endif
#ifdef Q_OS_ANDROID
<< "android"
#endif
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 05d1592a60..1fc5a36d66 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1294,8 +1294,13 @@ void TestMethods::invokeTests(QObject *testObject) const
m_initTestCaseDataMethod.invoke(testObject, Qt::DirectConnection);
QScopedPointer<WatchDog> watchDog;
- if (!debuggerPresent())
+ if (!debuggerPresent()
+#ifdef QTESTLIB_USE_VALGRIND
+ && QBenchmarkGlobalData::current->mode() != QBenchmarkGlobalData::CallgrindChildProcess
+#endif
+ ) {
watchDog.reset(new WatchDog);
+ }
if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) {
if (m_initTestCaseMethod.isValid())
@@ -1383,7 +1388,7 @@ FatalSignalHandler::FatalSignalHandler()
// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as
// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h)
-#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS)
+#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS) && !defined(Q_OS_WATCHOS)
// Let the signal handlers use an alternate stack
// This is necessary if SIGSEGV is to catch a stack overflow
# if defined(Q_CC_GNU) && defined(Q_OF_ELF)
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 11aa14c268..bda185bfee 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -130,6 +130,7 @@ namespace QTest
void commit(bool processEvents = true)
{
if (!points.isEmpty()) {
+ qSleep(1);
if (targetWindow)
{
qt_handleTouchEvent(targetWindow, device, points.values());
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index f763d0c8fe..d544288031 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -6,6 +6,10 @@ CONFIG += minimal_syncqt internal_module force_bootstrap
MODULE_INCNAME = QtCore QtXml
MODULE_DEFINES = \
+ QT_VERSION_STR=$$shell_quote(\"$$QT_VERSION\") \
+ QT_VERSION_MAJOR=$$QT_MAJOR_VERSION \
+ QT_VERSION_MINOR=$$QT_MINOR_VERSION \
+ QT_VERSION_PATCH=$$QT_PATCH_VERSION \
QT_BOOTSTRAPPED \
QT_LITE_UNICODE \
QT_NO_CAST_TO_ASCII \
@@ -134,7 +138,7 @@ macx {
../../corelib/io/qstandardpaths_win.cpp
}
-!contains(QT_CONFIG, system-zlib)|cross_compile {
+!qtConfig(system-zlib)|cross_compile {
include(../../3rdparty/zlib.pri)
} else {
CONFIG += no_core_dep
diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp
index 4f1d16d2c5..07c59d155f 100644
--- a/src/tools/moc/keywords.cpp
+++ b/src/tools/moc/keywords.cpp
@@ -30,12 +30,12 @@
// DO NOT EDIT.
static const short keyword_trans[][128] = {
- {0,0,0,0,0,0,0,0,0,546,543,0,0,0,0,0,
+ {0,0,0,0,0,0,0,0,0,561,558,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 546,252,544,547,8,38,239,545,25,26,236,234,30,235,27,237,
+ 561,252,559,562,8,38,239,560,25,26,236,234,30,235,27,237,
22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,21,8,8,8,8,8,8,8,8,8,31,549,32,238,8,
+ 8,21,8,8,8,8,8,8,8,8,8,31,564,32,238,8,
0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13,
14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -116,7 +116,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,290,222,0,0,475,0,0,0,
+ 0,0,0,0,0,0,0,0,290,222,0,0,490,0,0,0,
0,0,0,0,55,0,0,330,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -155,7 +155,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,499,0,0,0,0,0,0,0,0,0,0,357,
+ 0,0,0,0,514,0,0,0,0,0,0,0,0,0,0,357,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -177,7 +177,7 @@ static const short keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0,
- 552,552,552,552,552,552,552,552,552,552,0,0,0,0,0,0,
+ 567,567,567,567,567,567,567,567,567,567,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -336,7 +336,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,551,0,0,0,0,550,
+ 0,0,0,0,0,0,0,0,0,0,566,0,0,0,0,565,
0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -372,29 +372,29 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,472,0,0,0,300,0,0,0,0,0,0,0,0,0,0,
+ 0,487,0,0,0,300,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,453,402,392,397,364,0,462,0,0,0,0,0,358,
- 370,0,535,450,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,468,417,401,409,373,0,477,0,0,0,0,364,358,
+ 379,0,550,465,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,378,0,0,0,
- 0,0,371,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,387,0,0,0,
+ 0,0,380,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,489,0,0,0,0,0,372,
+ 0,0,0,0,0,0,0,0,0,504,0,0,0,0,0,381,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -402,32 +402,48 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,432,410,0,0,415,0,0,0,424,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,405,0,0,0,0,0,0,0,0,0,0,0,406,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,518,0,451,0,0,0,479,0,0,485,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,413,0,0,0,0,0,0,0,0,0,0,0,414,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,447,425,0,0,430,0,0,0,439,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,464,0,511,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,533,0,466,0,0,0,494,0,0,500,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 527,0,0,495,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,479,0,526,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 542,0,0,510,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
@@ -805,189 +821,204 @@ static const struct
{CHARACTER, 0, 84, 363, CHARACTER},
{Q_OBJECT_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 0, 65, 365, CHARACTER},
- {CHARACTER, 0, 68, 366, CHARACTER},
- {CHARACTER, 0, 71, 367, CHARACTER},
- {CHARACTER, 0, 69, 368, CHARACTER},
- {CHARACTER, 0, 84, 369, CHARACTER},
+ {CHARACTER, 0, 77, 366, CHARACTER},
+ {CHARACTER, 0, 69, 367, CHARACTER},
+ {CHARACTER, 0, 83, 368, CHARACTER},
+ {CHARACTER, 0, 80, 369, CHARACTER},
+ {CHARACTER, 0, 65, 370, CHARACTER},
+ {CHARACTER, 0, 67, 371, CHARACTER},
+ {CHARACTER, 0, 69, 372, CHARACTER},
+ {Q_NAMESPACE_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 65, 374, CHARACTER},
+ {CHARACTER, 0, 68, 375, CHARACTER},
+ {CHARACTER, 0, 71, 376, CHARACTER},
+ {CHARACTER, 0, 69, 377, CHARACTER},
+ {CHARACTER, 0, 84, 378, CHARACTER},
{Q_GADGET_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 44, 0, 0, CHARACTER},
{CHARACTER, 45, 0, 0, CHARACTER},
- {CHARACTER, 0, 80, 373, CHARACTER},
- {CHARACTER, 0, 69, 374, CHARACTER},
- {CHARACTER, 0, 82, 375, CHARACTER},
- {CHARACTER, 0, 84, 376, CHARACTER},
- {CHARACTER, 0, 89, 377, CHARACTER},
+ {CHARACTER, 0, 80, 382, CHARACTER},
+ {CHARACTER, 0, 69, 383, CHARACTER},
+ {CHARACTER, 0, 82, 384, CHARACTER},
+ {CHARACTER, 0, 84, 385, CHARACTER},
+ {CHARACTER, 0, 89, 386, CHARACTER},
{Q_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 85, 379, CHARACTER},
- {CHARACTER, 0, 71, 380, CHARACTER},
- {CHARACTER, 0, 73, 381, CHARACTER},
- {CHARACTER, 0, 78, 382, CHARACTER},
- {CHARACTER, 0, 95, 383, CHARACTER},
- {CHARACTER, 0, 77, 384, CHARACTER},
- {CHARACTER, 0, 69, 385, CHARACTER},
- {CHARACTER, 0, 84, 386, CHARACTER},
- {CHARACTER, 0, 65, 387, CHARACTER},
- {CHARACTER, 0, 68, 388, CHARACTER},
- {CHARACTER, 0, 65, 389, CHARACTER},
- {CHARACTER, 0, 84, 390, CHARACTER},
- {CHARACTER, 0, 65, 391, CHARACTER},
+ {CHARACTER, 0, 85, 388, CHARACTER},
+ {CHARACTER, 0, 71, 389, CHARACTER},
+ {CHARACTER, 0, 73, 390, CHARACTER},
+ {CHARACTER, 0, 78, 391, CHARACTER},
+ {CHARACTER, 0, 95, 392, CHARACTER},
+ {CHARACTER, 0, 77, 393, CHARACTER},
+ {CHARACTER, 0, 69, 394, CHARACTER},
+ {CHARACTER, 0, 84, 395, CHARACTER},
+ {CHARACTER, 0, 65, 396, CHARACTER},
+ {CHARACTER, 0, 68, 397, CHARACTER},
+ {CHARACTER, 0, 65, 398, CHARACTER},
+ {CHARACTER, 0, 84, 399, CHARACTER},
+ {CHARACTER, 0, 65, 400, CHARACTER},
{Q_PLUGIN_METADATA_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 393, CHARACTER},
- {CHARACTER, 0, 85, 394, CHARACTER},
- {CHARACTER, 0, 77, 395, CHARACTER},
- {Q_ENUM_TOKEN, 0, 83, 396, CHARACTER},
+ {CHARACTER, 0, 78, 402, CHARACTER},
+ {CHARACTER, 0, 85, 403, CHARACTER},
+ {CHARACTER, 0, 77, 404, CHARACTER},
+ {Q_ENUM_TOKEN, 46, 0, 0, CHARACTER},
{Q_ENUMS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 398, CHARACTER},
- {CHARACTER, 0, 65, 399, CHARACTER},
- {CHARACTER, 0, 71, 400, CHARACTER},
- {Q_FLAG_TOKEN, 0, 83, 401, CHARACTER},
+ {CHARACTER, 0, 78, 407, CHARACTER},
+ {CHARACTER, 0, 83, 408, CHARACTER},
+ {Q_ENUM_NS_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 76, 410, CHARACTER},
+ {CHARACTER, 0, 65, 411, CHARACTER},
+ {CHARACTER, 0, 71, 412, CHARACTER},
+ {Q_FLAG_TOKEN, 47, 0, 0, CHARACTER},
{Q_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 403, CHARACTER},
- {CHARACTER, 0, 67, 404, CHARACTER},
- {CHARACTER, 0, 76, 405, CHARACTER},
- {CHARACTER, 0, 65, 406, CHARACTER},
- {CHARACTER, 0, 82, 407, CHARACTER},
- {CHARACTER, 0, 69, 408, CHARACTER},
- {CHARACTER, 0, 95, 409, CHARACTER},
- {CHARACTER, 46, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 411, CHARACTER},
- {CHARACTER, 0, 65, 412, CHARACTER},
- {CHARACTER, 0, 71, 413, CHARACTER},
- {CHARACTER, 0, 83, 414, CHARACTER},
- {Q_DECLARE_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 416, CHARACTER},
- {CHARACTER, 0, 84, 417, CHARACTER},
+ {CHARACTER, 0, 78, 415, CHARACTER},
+ {CHARACTER, 0, 83, 416, CHARACTER},
+ {Q_FLAG_NS_TOKEN, 0, 0, 0, CHARACTER},
{CHARACTER, 0, 69, 418, CHARACTER},
- {CHARACTER, 0, 82, 419, CHARACTER},
- {CHARACTER, 0, 70, 420, CHARACTER},
+ {CHARACTER, 0, 67, 419, CHARACTER},
+ {CHARACTER, 0, 76, 420, CHARACTER},
{CHARACTER, 0, 65, 421, CHARACTER},
- {CHARACTER, 0, 67, 422, CHARACTER},
+ {CHARACTER, 0, 82, 422, CHARACTER},
{CHARACTER, 0, 69, 423, CHARACTER},
- {Q_DECLARE_INTERFACE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 425, CHARACTER},
- {CHARACTER, 0, 84, 426, CHARACTER},
+ {CHARACTER, 0, 95, 424, CHARACTER},
+ {CHARACTER, 48, 0, 0, CHARACTER},
+ {CHARACTER, 0, 76, 426, CHARACTER},
{CHARACTER, 0, 65, 427, CHARACTER},
- {CHARACTER, 0, 84, 428, CHARACTER},
- {CHARACTER, 0, 89, 429, CHARACTER},
- {CHARACTER, 0, 80, 430, CHARACTER},
- {CHARACTER, 0, 69, 431, CHARACTER},
+ {CHARACTER, 0, 71, 428, CHARACTER},
+ {CHARACTER, 0, 83, 429, CHARACTER},
+ {Q_DECLARE_FLAGS_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 78, 431, CHARACTER},
+ {CHARACTER, 0, 84, 432, CHARACTER},
+ {CHARACTER, 0, 69, 433, CHARACTER},
+ {CHARACTER, 0, 82, 434, CHARACTER},
+ {CHARACTER, 0, 70, 435, CHARACTER},
+ {CHARACTER, 0, 65, 436, CHARACTER},
+ {CHARACTER, 0, 67, 437, CHARACTER},
+ {CHARACTER, 0, 69, 438, CHARACTER},
+ {Q_DECLARE_INTERFACE_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 69, 440, CHARACTER},
+ {CHARACTER, 0, 84, 441, CHARACTER},
+ {CHARACTER, 0, 65, 442, CHARACTER},
+ {CHARACTER, 0, 84, 443, CHARACTER},
+ {CHARACTER, 0, 89, 444, CHARACTER},
+ {CHARACTER, 0, 80, 445, CHARACTER},
+ {CHARACTER, 0, 69, 446, CHARACTER},
{Q_DECLARE_METATYPE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 88, 433, CHARACTER},
- {CHARACTER, 0, 84, 434, CHARACTER},
- {CHARACTER, 0, 69, 435, CHARACTER},
- {CHARACTER, 0, 78, 436, CHARACTER},
- {CHARACTER, 0, 83, 437, CHARACTER},
- {CHARACTER, 0, 73, 438, CHARACTER},
- {CHARACTER, 0, 79, 439, CHARACTER},
- {CHARACTER, 0, 78, 440, CHARACTER},
- {CHARACTER, 0, 95, 441, CHARACTER},
- {CHARACTER, 0, 73, 442, CHARACTER},
- {CHARACTER, 0, 78, 443, CHARACTER},
- {CHARACTER, 0, 84, 444, CHARACTER},
- {CHARACTER, 0, 69, 445, CHARACTER},
- {CHARACTER, 0, 82, 446, CHARACTER},
- {CHARACTER, 0, 70, 447, CHARACTER},
- {CHARACTER, 0, 65, 448, CHARACTER},
- {CHARACTER, 0, 67, 449, CHARACTER},
- {CHARACTER, 0, 69, 423, CHARACTER},
- {CHARACTER, 47, 0, 0, CHARACTER},
- {CHARACTER, 0, 84, 452, CHARACTER},
- {CHARACTER, 0, 83, 401, CHARACTER},
- {CHARACTER, 0, 76, 454, CHARACTER},
- {CHARACTER, 0, 65, 455, CHARACTER},
- {CHARACTER, 0, 83, 456, CHARACTER},
- {CHARACTER, 0, 83, 457, CHARACTER},
- {CHARACTER, 0, 73, 458, CHARACTER},
- {CHARACTER, 0, 78, 459, CHARACTER},
- {CHARACTER, 0, 70, 460, CHARACTER},
- {CHARACTER, 0, 79, 461, CHARACTER},
- {Q_CLASSINFO_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 78, 463, CHARACTER},
- {CHARACTER, 48, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 465, CHARACTER},
- {CHARACTER, 0, 82, 466, CHARACTER},
- {CHARACTER, 0, 70, 467, CHARACTER},
- {CHARACTER, 0, 65, 468, CHARACTER},
- {CHARACTER, 0, 67, 469, CHARACTER},
- {CHARACTER, 0, 69, 470, CHARACTER},
+ {CHARACTER, 0, 88, 448, CHARACTER},
+ {CHARACTER, 0, 84, 449, CHARACTER},
+ {CHARACTER, 0, 69, 450, CHARACTER},
+ {CHARACTER, 0, 78, 451, CHARACTER},
+ {CHARACTER, 0, 83, 452, CHARACTER},
+ {CHARACTER, 0, 73, 453, CHARACTER},
+ {CHARACTER, 0, 79, 454, CHARACTER},
+ {CHARACTER, 0, 78, 455, CHARACTER},
+ {CHARACTER, 0, 95, 456, CHARACTER},
+ {CHARACTER, 0, 73, 457, CHARACTER},
+ {CHARACTER, 0, 78, 458, CHARACTER},
+ {CHARACTER, 0, 84, 459, CHARACTER},
+ {CHARACTER, 0, 69, 460, CHARACTER},
+ {CHARACTER, 0, 82, 461, CHARACTER},
+ {CHARACTER, 0, 70, 462, CHARACTER},
+ {CHARACTER, 0, 65, 463, CHARACTER},
+ {CHARACTER, 0, 67, 464, CHARACTER},
+ {CHARACTER, 0, 69, 438, CHARACTER},
+ {CHARACTER, 49, 0, 0, CHARACTER},
+ {CHARACTER, 0, 84, 467, CHARACTER},
+ {CHARACTER, 0, 83, 413, CHARACTER},
+ {CHARACTER, 0, 76, 469, CHARACTER},
+ {CHARACTER, 0, 65, 470, CHARACTER},
{CHARACTER, 0, 83, 471, CHARACTER},
+ {CHARACTER, 0, 83, 472, CHARACTER},
+ {CHARACTER, 0, 73, 473, CHARACTER},
+ {CHARACTER, 0, 78, 474, CHARACTER},
+ {CHARACTER, 0, 70, 475, CHARACTER},
+ {CHARACTER, 0, 79, 476, CHARACTER},
+ {Q_CLASSINFO_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 78, 478, CHARACTER},
+ {CHARACTER, 50, 0, 0, CHARACTER},
+ {CHARACTER, 0, 69, 480, CHARACTER},
+ {CHARACTER, 0, 82, 481, CHARACTER},
+ {CHARACTER, 0, 70, 482, CHARACTER},
+ {CHARACTER, 0, 65, 483, CHARACTER},
+ {CHARACTER, 0, 67, 484, CHARACTER},
+ {CHARACTER, 0, 69, 485, CHARACTER},
+ {CHARACTER, 0, 83, 486, CHARACTER},
{Q_INTERFACES_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 108, 473, CHARACTER},
- {CHARACTER, 0, 115, 474, CHARACTER},
+ {CHARACTER, 0, 108, 488, CHARACTER},
+ {CHARACTER, 0, 115, 489, CHARACTER},
{SIGNALS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 111, 476, CHARACTER},
- {CHARACTER, 0, 116, 477, CHARACTER},
- {CHARACTER, 0, 115, 478, CHARACTER},
+ {CHARACTER, 0, 111, 491, CHARACTER},
+ {CHARACTER, 0, 116, 492, CHARACTER},
+ {CHARACTER, 0, 115, 493, CHARACTER},
{SLOTS, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 71, 480, CHARACTER},
- {CHARACTER, 0, 78, 481, CHARACTER},
- {CHARACTER, 0, 65, 482, CHARACTER},
- {CHARACTER, 0, 76, 483, CHARACTER},
- {Q_SIGNAL_TOKEN, 0, 83, 484, CHARACTER},
+ {CHARACTER, 0, 71, 495, CHARACTER},
+ {CHARACTER, 0, 78, 496, CHARACTER},
+ {CHARACTER, 0, 65, 497, CHARACTER},
+ {CHARACTER, 0, 76, 498, CHARACTER},
+ {Q_SIGNAL_TOKEN, 0, 83, 499, CHARACTER},
{Q_SIGNALS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 486, CHARACTER},
- {CHARACTER, 0, 84, 487, CHARACTER},
- {Q_SLOT_TOKEN, 0, 83, 488, CHARACTER},
+ {CHARACTER, 0, 79, 501, CHARACTER},
+ {CHARACTER, 0, 84, 502, CHARACTER},
+ {Q_SLOT_TOKEN, 0, 83, 503, CHARACTER},
{Q_SLOTS_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 86, 490, CHARACTER},
- {CHARACTER, 0, 65, 491, CHARACTER},
- {CHARACTER, 0, 84, 492, CHARACTER},
- {CHARACTER, 0, 69, 493, CHARACTER},
- {CHARACTER, 0, 95, 494, CHARACTER},
- {CHARACTER, 49, 0, 0, CHARACTER},
- {CHARACTER, 0, 76, 496, CHARACTER},
- {CHARACTER, 0, 79, 497, CHARACTER},
- {CHARACTER, 0, 84, 498, CHARACTER},
+ {CHARACTER, 0, 86, 505, CHARACTER},
+ {CHARACTER, 0, 65, 506, CHARACTER},
+ {CHARACTER, 0, 84, 507, CHARACTER},
+ {CHARACTER, 0, 69, 508, CHARACTER},
+ {CHARACTER, 0, 95, 509, CHARACTER},
+ {CHARACTER, 51, 0, 0, CHARACTER},
+ {CHARACTER, 0, 76, 511, CHARACTER},
+ {CHARACTER, 0, 79, 512, CHARACTER},
+ {CHARACTER, 0, 84, 513, CHARACTER},
{Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 95, 500, CHARACTER},
- {CHARACTER, 0, 77, 501, CHARACTER},
- {CHARACTER, 0, 79, 502, CHARACTER},
- {CHARACTER, 0, 67, 503, CHARACTER},
- {CHARACTER, 0, 95, 504, CHARACTER},
- {CHARACTER, 0, 67, 505, CHARACTER},
- {CHARACTER, 0, 79, 506, CHARACTER},
- {CHARACTER, 0, 77, 507, CHARACTER},
- {CHARACTER, 0, 80, 508, CHARACTER},
- {CHARACTER, 0, 65, 509, CHARACTER},
- {CHARACTER, 0, 84, 510, CHARACTER},
+ {CHARACTER, 0, 95, 515, CHARACTER},
+ {CHARACTER, 0, 77, 516, CHARACTER},
+ {CHARACTER, 0, 79, 517, CHARACTER},
+ {CHARACTER, 0, 67, 518, CHARACTER},
+ {CHARACTER, 0, 95, 519, CHARACTER},
+ {CHARACTER, 0, 67, 520, CHARACTER},
+ {CHARACTER, 0, 79, 521, CHARACTER},
+ {CHARACTER, 0, 77, 522, CHARACTER},
+ {CHARACTER, 0, 80, 523, CHARACTER},
+ {CHARACTER, 0, 65, 524, CHARACTER},
+ {CHARACTER, 0, 84, 525, CHARACTER},
{Q_MOC_COMPAT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 79, 512, CHARACTER},
- {CHARACTER, 0, 75, 513, CHARACTER},
- {CHARACTER, 0, 65, 514, CHARACTER},
- {CHARACTER, 0, 66, 515, CHARACTER},
- {CHARACTER, 0, 76, 516, CHARACTER},
- {CHARACTER, 0, 69, 517, CHARACTER},
+ {CHARACTER, 0, 79, 527, CHARACTER},
+ {CHARACTER, 0, 75, 528, CHARACTER},
+ {CHARACTER, 0, 65, 529, CHARACTER},
+ {CHARACTER, 0, 66, 530, CHARACTER},
+ {CHARACTER, 0, 76, 531, CHARACTER},
+ {CHARACTER, 0, 69, 532, CHARACTER},
{Q_INVOKABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 519, CHARACTER},
- {CHARACTER, 0, 73, 520, CHARACTER},
- {CHARACTER, 0, 80, 521, CHARACTER},
- {CHARACTER, 0, 84, 522, CHARACTER},
- {CHARACTER, 0, 65, 523, CHARACTER},
- {CHARACTER, 0, 66, 524, CHARACTER},
- {CHARACTER, 0, 76, 525, CHARACTER},
- {CHARACTER, 0, 69, 526, CHARACTER},
+ {CHARACTER, 0, 82, 534, CHARACTER},
+ {CHARACTER, 0, 73, 535, CHARACTER},
+ {CHARACTER, 0, 80, 536, CHARACTER},
+ {CHARACTER, 0, 84, 537, CHARACTER},
+ {CHARACTER, 0, 65, 538, CHARACTER},
+ {CHARACTER, 0, 66, 539, CHARACTER},
+ {CHARACTER, 0, 76, 540, CHARACTER},
+ {CHARACTER, 0, 69, 541, CHARACTER},
{Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 82, 528, CHARACTER},
- {CHARACTER, 0, 79, 529, CHARACTER},
- {CHARACTER, 0, 80, 530, CHARACTER},
- {CHARACTER, 0, 69, 531, CHARACTER},
- {CHARACTER, 0, 82, 532, CHARACTER},
- {CHARACTER, 0, 84, 533, CHARACTER},
- {CHARACTER, 0, 89, 534, CHARACTER},
+ {CHARACTER, 0, 82, 543, CHARACTER},
+ {CHARACTER, 0, 79, 544, CHARACTER},
+ {CHARACTER, 0, 80, 545, CHARACTER},
+ {CHARACTER, 0, 69, 546, CHARACTER},
+ {CHARACTER, 0, 82, 547, CHARACTER},
+ {CHARACTER, 0, 84, 548, CHARACTER},
+ {CHARACTER, 0, 89, 549, CHARACTER},
{Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 0, 69, 536, CHARACTER},
- {CHARACTER, 0, 86, 537, CHARACTER},
- {CHARACTER, 0, 73, 538, CHARACTER},
- {CHARACTER, 0, 83, 539, CHARACTER},
- {CHARACTER, 0, 73, 540, CHARACTER},
- {CHARACTER, 0, 79, 541, CHARACTER},
- {CHARACTER, 0, 78, 542, CHARACTER},
+ {CHARACTER, 0, 69, 551, CHARACTER},
+ {CHARACTER, 0, 86, 552, CHARACTER},
+ {CHARACTER, 0, 73, 553, CHARACTER},
+ {CHARACTER, 0, 83, 554, CHARACTER},
+ {CHARACTER, 0, 73, 555, CHARACTER},
+ {CHARACTER, 0, 79, 556, CHARACTER},
+ {CHARACTER, 0, 78, 557, CHARACTER},
{Q_REVISION_TOKEN, 0, 0, 0, CHARACTER},
{NEWLINE, 0, 0, 0, NOTOKEN},
{QUOTE, 0, 0, 0, NOTOKEN},
{SINGLEQUOTE, 0, 0, 0, NOTOKEN},
{WHITESPACE, 0, 0, 0, NOTOKEN},
- {HASH, 0, 35, 548, HASH},
+ {HASH, 0, 35, 563, HASH},
{PP_HASHHASH, 0, 0, 0, NOTOKEN},
{BACKSLASH, 0, 0, 0, NOTOKEN},
{CPP_COMMENT, 0, 0, 0, NOTOKEN},
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index afe64bb889..22207a9030 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -554,14 +554,51 @@ void Moc::parse()
until(SEMIC);
} else if (!test(SEMIC)) {
NamespaceDef def;
- def.name = lexem();
+ def.classname = lexem();
next(LBRACE);
def.begin = index - 1;
until(RBRACE);
def.end = index;
index = def.begin + 1;
+ while (inNamespace(&def) && hasNext()) {
+ switch (next()) {
+ case Q_NAMESPACE_TOKEN:
+ def.hasQNamespace = true;
+ break;
+ case Q_ENUMS_TOKEN:
+ case Q_ENUM_NS_TOKEN:
+ parseEnumOrFlag(&def, false);
+ break;
+ case Q_FLAGS_TOKEN:
+ case Q_FLAG_NS_TOKEN:
+ parseEnumOrFlag(&def, true);
+ break;
+ case Q_DECLARE_FLAGS_TOKEN:
+ parseFlag(&def);
+ break;
+ case Q_CLASSINFO_TOKEN:
+ parseClassInfo(&def);
+ break;
+ case ENUM: {
+ EnumDef enumDef;
+ if (parseEnum(&enumDef))
+ def.enumList += enumDef;
+ } break;
+ case CLASS:
+ case STRUCT: {
+ ClassDef classdef;
+ if (!parseClassHead(&classdef))
+ continue;
+ while (inClass(&classdef) && hasNext())
+ next(); // consume all Q_XXXX macros from this class
+ } break;
+ default: break;
+ }
+ }
namespaceList += def;
index = rewind;
+ if (!def.hasQNamespace && (!def.classInfoList.isEmpty() || !def.enumDeclarations.isEmpty()))
+ error("Namespace declaration lacks Q_NAMESPACE macro.");
}
}
break;
@@ -618,7 +655,7 @@ void Moc::parse()
for (int i = namespaceList.size() - 1; i >= 0; --i)
if (inNamespace(&namespaceList.at(i)))
- def.qualified.prepend(namespaceList.at(i).name + "::");
+ def.qualified.prepend(namespaceList.at(i).classname + "::");
QHash<QByteArray, QByteArray> &classHash = def.hasQObject ? knownQObjectClasses : knownGadgets;
classHash.insert(def.classname, def.qualified);
@@ -634,7 +671,7 @@ void Moc::parse()
FunctionDef::Access access = FunctionDef::Private;
for (int i = namespaceList.size() - 1; i >= 0; --i)
if (inNamespace(&namespaceList.at(i)))
- def.qualified.prepend(namespaceList.at(i).name + "::");
+ def.qualified.prepend(namespaceList.at(i).classname + "::");
while (inClass(&def) && hasNext()) {
switch ((t = next())) {
case PRIVATE:
@@ -802,6 +839,19 @@ void Moc::parse()
classHash.insert(def.qualified, def.qualified);
}
}
+ for (const auto &n : qAsConst(namespaceList)) {
+ if (!n.hasQNamespace)
+ continue;
+ ClassDef def;
+ static_cast<BaseDef &>(def) = static_cast<BaseDef>(n);
+ if (!def.qualified.isEmpty())
+ def.qualified += "::";
+ def.qualified += def.classname;
+ def.hasQGadget = true;
+ classList += def;
+ knownGadgets.insert(def.classname, def.qualified);
+ knownGadgets.insert(def.qualified, def.qualified);
+ }
}
static bool any_type_contains(const QVector<PropertyDef> &properties, const QByteArray &pattern)
@@ -1248,7 +1298,7 @@ void Moc::parsePrivateProperty(ClassDef *def)
def->propertyList += propDef;
}
-void Moc::parseEnumOrFlag(ClassDef *def, bool isFlag)
+void Moc::parseEnumOrFlag(BaseDef *def, bool isFlag)
{
next(LPAREN);
QByteArray identifier;
@@ -1263,7 +1313,7 @@ void Moc::parseEnumOrFlag(ClassDef *def, bool isFlag)
next(RPAREN);
}
-void Moc::parseFlag(ClassDef *def)
+void Moc::parseFlag(BaseDef *def)
{
next(LPAREN);
QByteArray flagName, enumName;
@@ -1287,7 +1337,7 @@ void Moc::parseFlag(ClassDef *def)
next(RPAREN);
}
-void Moc::parseClassInfo(ClassDef *def)
+void Moc::parseClassInfo(BaseDef *def)
{
next(LPAREN);
ClassInfoDef infoDef;
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 843bdeb794..6040f944f3 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -144,12 +144,18 @@ struct ClassInfoDef
};
Q_DECLARE_TYPEINFO(ClassInfoDef, Q_MOVABLE_TYPE);
-struct ClassDef {
- ClassDef():
- hasQObject(false), hasQGadget(false), notifyableProperties(0)
- , revisionedMethods(0), revisionedProperties(0), begin(0), end(0){}
+struct BaseDef {
QByteArray classname;
QByteArray qualified;
+ QVector<ClassInfoDef> classInfoList;
+ QMap<QByteArray, bool> enumDeclarations;
+ QVector<EnumDef> enumList;
+ QMap<QByteArray, QByteArray> flagAliases;
+ int begin = 0;
+ int end = 0;
+};
+
+struct ClassDef : BaseDef {
QVector<QPair<QByteArray, FunctionDef::Access> > superclassList;
struct Interface
@@ -162,8 +168,8 @@ struct ClassDef {
};
QVector<QVector<Interface> >interfaceList;
- bool hasQObject;
- bool hasQGadget;
+ bool hasQObject = false;
+ bool hasQGadget = false;
struct PluginData {
QByteArray iid;
@@ -173,25 +179,17 @@ struct ClassDef {
QVector<FunctionDef> constructorList;
QVector<FunctionDef> signalList, slotList, methodList, publicList;
- int notifyableProperties;
+ int notifyableProperties = 0;
QVector<PropertyDef> propertyList;
- QVector<ClassInfoDef> classInfoList;
- QMap<QByteArray, bool> enumDeclarations;
- QVector<EnumDef> enumList;
- QMap<QByteArray, QByteArray> flagAliases;
- int revisionedMethods;
- int revisionedProperties;
+ int revisionedMethods = 0;
+ int revisionedProperties = 0;
- int begin;
- int end;
};
Q_DECLARE_TYPEINFO(ClassDef, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(ClassDef::Interface, Q_MOVABLE_TYPE);
-struct NamespaceDef {
- QByteArray name;
- int begin;
- int end;
+struct NamespaceDef : BaseDef {
+ bool hasQNamespace = false;
};
Q_DECLARE_TYPEINFO(NamespaceDef, Q_MOVABLE_TYPE);
@@ -240,9 +238,9 @@ public:
void parseProperty(ClassDef *def);
void parsePluginData(ClassDef *def);
void createPropertyDef(PropertyDef &def);
- void parseEnumOrFlag(ClassDef *def, bool isFlag);
- void parseFlag(ClassDef *def);
- void parseClassInfo(ClassDef *def);
+ void parseEnumOrFlag(BaseDef *def, bool isFlag);
+ void parseFlag(BaseDef *def);
+ void parseClassInfo(BaseDef *def);
void parseInterfaces(ClassDef *def);
void parseDeclareInterface();
void parseDeclareMetatype();
diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h
index 3557da8aa8..db9d319b78 100644
--- a/src/tools/moc/token.h
+++ b/src/tools/moc/token.h
@@ -154,12 +154,15 @@ QT_BEGIN_NAMESPACE
F(RETURN) \
F(Q_OBJECT_TOKEN) \
F(Q_GADGET_TOKEN) \
+ F(Q_NAMESPACE_TOKEN) \
F(Q_PROPERTY_TOKEN) \
F(Q_PLUGIN_METADATA_TOKEN) \
F(Q_ENUMS_TOKEN) \
F(Q_ENUM_TOKEN) \
+ F(Q_ENUM_NS_TOKEN) \
F(Q_FLAGS_TOKEN) \
F(Q_FLAG_TOKEN) \
+ F(Q_FLAG_NS_TOKEN) \
F(Q_DECLARE_FLAGS_TOKEN) \
F(Q_DECLARE_INTERFACE_TOKEN) \
F(Q_DECLARE_METATYPE_TOKEN) \
diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp
index d0f76a4c45..df850c1bdc 100644
--- a/src/tools/moc/util/generate_keywords.cpp
+++ b/src/tools/moc/util/generate_keywords.cpp
@@ -213,13 +213,16 @@ static const Keyword keywords[] = {
{ "goto", "GOTO" },
{ "return", "RETURN" },
{ "Q_OBJECT", "Q_OBJECT_TOKEN" },
+ { "Q_NAMESPACE", "Q_NAMESPACE_TOKEN" },
{ "Q_GADGET", "Q_GADGET_TOKEN" },
{ "Q_PROPERTY", "Q_PROPERTY_TOKEN" },
{ "Q_PLUGIN_METADATA", "Q_PLUGIN_METADATA_TOKEN" },
{ "Q_ENUMS", "Q_ENUMS_TOKEN" },
{ "Q_ENUM", "Q_ENUM_TOKEN" },
+ { "Q_ENUM_NS", "Q_ENUM_NS_TOKEN" },
{ "Q_FLAGS", "Q_FLAGS_TOKEN" },
{ "Q_FLAG", "Q_FLAG_TOKEN" },
+ { "Q_FLAG_NS", "Q_FLAG_NS_TOKEN" },
{ "Q_DECLARE_FLAGS", "Q_DECLARE_FLAGS_TOKEN" },
{ "Q_DECLARE_INTERFACE", "Q_DECLARE_INTERFACE_TOKEN" },
{ "Q_DECLARE_METATYPE", "Q_DECLARE_METATYPE_TOKEN" },
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index 8fc54794bc..e58f194b72 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -27,6 +27,8 @@
****************************************************************************/
#include <qbytearray.h>
+#include <qcommandlineparser.h>
+#include <qcoreapplication.h>
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -59,30 +61,6 @@ static QString commandLine;
static QStringList includes;
static QStringList wantedInterfaces;
-static const char help[] =
- "Usage: " PROGRAMNAME " [options...] [xml-or-xml-file] [interfaces...]\n"
- "Produces the C++ code to implement the interfaces defined in the input file.\n"
- "\n"
- "Options:\n"
- " -a <filename> Write the adaptor code to <filename>\n"
- " -c <classname> Use <classname> as the class name for the generated classes\n"
- " -h Show this information\n"
- " -i <filename> Add #include to the output\n"
- " -l <classname> When generating an adaptor, use <classname> as the parent class\n"
- " -m Generate #include \"filename.moc\" statements in the .cpp files\n"
- " -N Don't use namespaces\n"
- " -p <filename> Write the proxy code to <filename>\n"
- " -v Be verbose.\n"
- " -V Show the program version and quit.\n"
- "\n"
- "If the file name given to the options -a and -p does not end in .cpp or .h, the\n"
- "program will automatically append the suffixes and produce both files.\n"
- "You can also use a colon (:) to separate the header name from the source file\n"
- "name, as in '-a filename_p.h:filename.cpp'.\n"
- "\n"
- "If you pass a dash (-) as the argument to either -p or -a, the output is written\n"
- "to the standard output\n";
-
static const char includeList[] =
"#include <QtCore/QByteArray>\n"
"#include <QtCore/QList>\n"
@@ -101,105 +79,6 @@ static const char forwardDeclarations[] =
"class QVariant;\n"
"QT_END_NAMESPACE\n";
-static void showHelp()
-{
- printf("%s", help);
- exit(0);
-}
-
-static void showVersion()
-{
- printf("%s version %s\n", PROGRAMNAME, PROGRAMVERSION);
- printf("D-Bus binding tool for Qt\n");
- exit(0);
-}
-
-static QString nextArg(QStringList &args, int i, char opt)
-{
- QString arg = args.value(i);
- if (arg.isEmpty()) {
- printf("-%c needs at least one argument\n", opt);
- exit(1);
- }
- return args.takeAt(i);
-}
-
-static void parseCmdLine(QStringList args)
-{
- args.takeFirst();
-
- commandLine = QLatin1String(PROGRAMNAME " ");
- commandLine += args.join(QLatin1Char(' '));
-
- int i = 0;
- while (i < args.count()) {
-
- if (!args.at(i).startsWith(QLatin1Char('-'))) {
- ++i;
- continue;
- }
- QString arg = args.takeAt(i);
-
- char c = '\0';
- if (arg.length() == 2)
- c = arg.at(1).toLatin1();
- else if (arg == QLatin1String("--help"))
- c = 'h';
-
- switch (c) {
- case 'a':
- adaptorFile = nextArg(args, i, 'a');
- break;
-
- case 'c':
- globalClassName = nextArg(args, i, 'c');
- break;
-
- case 'v':
- verbose = true;
- break;
-
- case 'i':
- includes << nextArg(args, i, 'i');
- break;
-
- case 'l':
- parentClassName = nextArg(args, i, 'l');
- break;
-
- case 'm':
- includeMocs = true;
- break;
-
- case 'N':
- skipNamespaces = true;
- break;
-
- case '?':
- case 'h':
- showHelp();
- break;
-
- case 'V':
- showVersion();
- break;
-
- case 'p':
- proxyFile = nextArg(args, i, 'p');
- break;
-
- default:
- printf("unknown option: '%s'\n", qPrintable(arg));
- exit(1);
- }
- }
-
- if (!args.isEmpty())
- inputFile = args.takeFirst();
-
- wantedInterfaces << args;
-}
-
static QDBusIntrospection::Interfaces readInput()
{
QFile input(inputFile);
@@ -1139,13 +1018,79 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
int main(int argc, char **argv)
{
- QStringList arguments;
- arguments.reserve(argc);
- for (int i = 0; i < argc; ++i) {
- arguments.append(QString::fromLocal8Bit(argv[i]));
- }
+ QCoreApplication app(argc, argv);
+ QCoreApplication::setApplicationName(QStringLiteral(PROGRAMNAME));
+ QCoreApplication::setApplicationVersion(QStringLiteral(PROGRAMVERSION));
+
+ QCommandLineParser parser;
+ parser.setApplicationDescription(QLatin1String(
+ "Produces the C++ code to implement the interfaces defined in the input file.\n\n"
+ "If the file name given to the options -a and -p does not end in .cpp or .h, the\n"
+ "program will automatically append the suffixes and produce both files.\n"
+ "You can also use a colon (:) to separate the header name from the source file\n"
+ "name, as in '-a filename_p.h:filename.cpp'.\n\n"
+ "If you pass a dash (-) as the argument to either -p or -a, the output is written\n"
+ "to the standard output."));
+
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument(QStringLiteral("xml-or-xml-file"), QStringLiteral("XML file to use."));
+ parser.addPositionalArgument(QStringLiteral("interfaces"), QStringLiteral("List of interfaces to use."),
+ QStringLiteral("[interfaces ...]"));
+
+ QCommandLineOption adapterCodeOption(QStringList() << QStringLiteral("a") << QStringLiteral("adaptor"),
+ QStringLiteral("Write the adaptor code to <filename>"), QStringLiteral("filename"));
+ parser.addOption(adapterCodeOption);
+
+ QCommandLineOption classNameOption(QStringList() << QStringLiteral("c") << QStringLiteral("classname"),
+ QStringLiteral("Use <classname> as the class name for the generated classes"), QStringLiteral("classname"));
+ parser.addOption(classNameOption);
+
+ QCommandLineOption addIncludeOption(QStringList() << QStringLiteral("i") << QStringLiteral("include"),
+ QStringLiteral("Add #include to the output"), QStringLiteral("filename"));
+ parser.addOption(addIncludeOption);
+
+ QCommandLineOption adapterParentOption(QStringLiteral("l"),
+ QStringLiteral("When generating an adaptor, use <classname> as the parent class"), QStringLiteral("classname"));
+ parser.addOption(adapterParentOption);
+
+ QCommandLineOption mocIncludeOption(QStringList() << QStringLiteral("m") << QStringLiteral("moc"),
+ QStringLiteral("Generate #include \"filename.moc\" statements in the .cpp files"));
+ parser.addOption(mocIncludeOption);
+
+ QCommandLineOption noNamespaceOption(QStringList() << QStringLiteral("N") << QStringLiteral("no-namespaces"),
+ QStringLiteral("Don't use namespaces"));
+ parser.addOption(noNamespaceOption);
+
+ QCommandLineOption proxyCodeOption(QStringList() << QStringLiteral("p") << QStringLiteral("proxy"),
+ QStringLiteral("Write the proxy code to <filename>"), QStringLiteral("filename"));
+ parser.addOption(proxyCodeOption);
+
+ QCommandLineOption verboseOption(QStringList() << QStringLiteral("V") << QStringLiteral("verbose"),
+ QStringLiteral("Be verbose."));
+ parser.addOption(verboseOption);
+
+ parser.process(app);
+
+ adaptorFile = parser.value(adapterCodeOption);
+ globalClassName = parser.value(classNameOption);
+ includes = parser.values(addIncludeOption);
+ parentClassName = parser.value(adapterParentOption);
+ includeMocs = parser.isSet(mocIncludeOption);
+ skipNamespaces = parser.isSet(noNamespaceOption);
+ proxyFile = parser.value(proxyCodeOption);
+ verbose = parser.isSet(verboseOption);
+
+ wantedInterfaces = parser.positionalArguments();
+ if (!wantedInterfaces.isEmpty()) {
+ inputFile = wantedInterfaces.takeFirst();
- parseCmdLine(arguments);
+ QFileInfo inputInfo(inputFile);
+ if (!inputInfo.exists() || !inputInfo.isFile() || !inputInfo.isReadable()) {
+ qCritical("Error: Input %s is not a file or cannot be accessed\n", qPrintable(inputFile));
+ return 1;
+ }
+ }
QDBusIntrospection::Interfaces interfaces = readInput();
cleanInterfaces(interfaces);
diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp
index 4c9d2db6df..3aadc878e3 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.cpp
+++ b/src/tools/uic/cpp/cppwritedeclaration.cpp
@@ -44,27 +44,16 @@ QT_BEGIN_NAMESPACE
namespace {
void openNameSpaces(const QStringList &namespaceList, QTextStream &output) {
- if (namespaceList.empty())
- return;
- const QStringList::const_iterator cend = namespaceList.constEnd();
- for (QStringList::const_iterator it = namespaceList.constBegin(); it != cend; ++it) {
- if (!it->isEmpty()) {
+ for (auto it = namespaceList.begin(), end = namespaceList.end(); it != end; ++it) {
+ if (!it->isEmpty())
output << "namespace " << *it << " {\n";
- }
}
}
void closeNameSpaces(const QStringList &namespaceList, QTextStream &output) {
- if (namespaceList.empty())
- return;
-
- QListIterator<QString> it(namespaceList);
- it.toBack();
- while (it.hasPrevious()) {
- const QString ns = it.previous();
- if (!ns.isEmpty()) {
- output << "} // namespace " << ns << "\n";
- }
+ for (auto it = namespaceList.rbegin(), end = namespaceList.rend(); it != end; ++it) {
+ if (!it->isEmpty())
+ output << "} // namespace " << *it << "\n";
}
}
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 031b34b67e..df55ca29f1 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -84,10 +84,14 @@ namespace {
const QHash<QString, DomProperty *> properties = propertyMap(node->elementProperty());
output << "new QSpacerItem(";
+ int w = 0;
+ int h = 0;
if (properties.contains(QLatin1String("sizeHint"))) {
const DomSize *sizeHint = properties.value(QLatin1String("sizeHint"))->elementSize();
- output << sizeHint->elementWidth() << ", " << sizeHint->elementHeight() << ", ";
+ w = sizeHint->elementWidth();
+ h = sizeHint->elementHeight();
}
+ output << w << ", " << h << ", ";
// size type
QString sizeType = properties.contains(QLatin1String("sizeType")) ?
@@ -1713,9 +1717,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
// new format
const QList<DomColorRole *> colorRoles = colorGroup->elementColorRole();
- QListIterator<DomColorRole *> itRole(colorRoles);
- while (itRole.hasNext()) {
- const DomColorRole *colorRole = itRole.next();
+ for (const DomColorRole *colorRole : colorRoles) {
if (colorRole->hasAttributeRole()) {
const QString brushName = writeBrushInitialization(colorRole->elementBrush());
m_output << m_indent << paletteName << ".setBrush(" << group
@@ -1792,9 +1794,7 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush
}
const QList<DomGradientStop *> stops = gradient->elementGradientStop();
- QListIterator<DomGradientStop *> it(stops);
- while (it.hasNext()) {
- const DomGradientStop *stop = it.next();
+ for (const DomGradientStop *stop : stops) {
const DomColor *color = stop->elementColor();
m_output << m_indent << gradientName << ".setColorAt("
<< stop->attributePosition() << ", "
diff --git a/src/widgets/accessible/accessible.pri b/src/widgets/accessible/accessible.pri
index ac8205b1e3..e63ae28d30 100644
--- a/src/widgets/accessible/accessible.pri
+++ b/src/widgets/accessible/accessible.pri
@@ -1,6 +1,6 @@
# Qt accessibility module
-contains(QT_CONFIG, accessibility) {
+qtConfig(accessibility) {
HEADERS += \
accessible/qaccessiblewidget.h \
accessible/qaccessiblewidgetfactory_p.h \
diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro
index da8607c637..d04d0da3cc 100644
--- a/src/widgets/accessible/widgets.pro
+++ b/src/widgets/accessible/widgets.pro
@@ -2,7 +2,7 @@ TARGET = qtaccessiblewidgets
QT += core-private gui-private widgets-private
-QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)"
+QTDIR_build:REQUIRES += "qtConfig(accessibility)"
SOURCES += main.cpp \
simplewidgets.cpp \
diff --git a/src/widgets/dialogs/images/qtlogo-64.png b/src/widgets/dialogs/images/qtlogo-64.png
index af87e98cf5..39a4a26f39 100644
--- a/src/widgets/dialogs/images/qtlogo-64.png
+++ b/src/widgets/dialogs/images/qtlogo-64.png
Binary files differ
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index f3652c09da..d4764c019e 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -541,8 +541,8 @@ QColor QColorDialog::customColor(int index)
/*!
Sets the custom color at \a index to the QColor \a color value.
- \note This function does not apply to the Native Color Dialog on the Mac
- OS X platform. If you still require this function, use the
+ \note This function does not apply to the Native Color Dialog on the
+ \macos platform. If you still require this function, use the
QColorDialog::DontUseNativeDialog option.
*/
void QColorDialog::setCustomColor(int index, QColor color)
@@ -563,8 +563,8 @@ QColor QColorDialog::standardColor(int index)
/*!
Sets the standard color at \a index to the QColor \a color value.
- \note This function does not apply to the Native Color Dialog on the Mac
- OS X platform. If you still require this function, use the
+ \note This function does not apply to the Native Color Dialog on the
+ \macos platform. If you still require this function, use the
QColorDialog::DontUseNativeDialog option.
*/
void QColorDialog::setStandardColor(int index, QColor color)
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index e5f11e78da..b4ca853c5d 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2068,7 +2068,7 @@ QString QFileDialog::labelText(DialogLabel label) const
The dialog's caption is set to \a caption. If \a caption is not specified
then a default caption will be used.
- On Windows, and OS X, this static function will use the
+ On Windows, and \macos, this static function will use the
native file dialog and not a QFileDialog.
On Windows the dialog will spin a blocking modal event loop that will not
@@ -2179,7 +2179,7 @@ QUrl QFileDialog::getOpenFileUrl(QWidget *parent,
The dialog's caption is set to \a caption. If \a caption is not specified
then a default caption will be used.
- On Windows, and OS X, this static function will use the
+ On Windows, and \macos, this static function will use the
native file dialog and not a QFileDialog.
On Windows the dialog will spin a blocking modal event loop that will not
@@ -2302,12 +2302,12 @@ QList<QUrl> QFileDialog::getOpenFileUrls(QWidget *parent,
The dialog's caption is set to \a caption. If \a caption is not specified,
a default caption will be used.
- On Windows, and OS X, this static function will use the
+ On Windows, and \macos, this static function will use the
native file dialog and not a QFileDialog.
On Windows the dialog will spin a blocking modal event loop that will not
dispatch any QTimers, and if \a parent is not 0 then it will position the
- dialog just below the parent's title bar. On OS X, with its native file
+ dialog just below the parent's title bar. On \macos, with its native file
dialog, the filter argument is ignored.
On Unix/X11, the normal behavior of the file dialog is to resolve and
@@ -2410,7 +2410,7 @@ QUrl QFileDialog::getSaveFileUrl(QWidget *parent,
pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must
be set.
- On Windows and OS X, this static function will use the
+ On Windows and \macos, this static function will use the
native file dialog and not a QFileDialog. However, the native Windows file
dialog does not support displaying files in the directory chooser. You need
to pass \l{QFileDialog::}{DontUseNativeDialog} to display files using a
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 96046b7ff4..57b3f47863 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -550,7 +550,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button
This is the approach recommended in the
\l{http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Windows/Windows.html#//apple_ref/doc/uid/20000961-BABCAJID}
- {OS X Guidelines}. Similar guidelines apply for the other
+ {\macos Guidelines}. Similar guidelines apply for the other
platforms, but note the different ways the
\l{QMessageBox::informativeText} {informative text} is handled for
different platforms.
@@ -667,7 +667,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button
If the \l{QMessageBox::StandardButtons} {standard buttons} are not
flexible enough for your message box, you can use the addButton()
- overload that takes a text and a ButtonRoleto to add custom
+ overload that takes a text and a ButtonRole to add custom
buttons. The ButtonRole is used by QMessageBox to determine the
ordering of the buttons on screen (which varies according to the
platform). You can test the value of clickedButton() after calling
@@ -765,7 +765,7 @@ void QMessageBoxPrivate::_q_clicked(QPlatformDialogHelper::StandardButton button
Constructs a message box with no text and no buttons. \a parent is
passed to the QDialog constructor.
- On OS X, if you want your message box to appear
+ On \macos, if you want your message box to appear
as a Qt::Sheet of its \a parent, set the message box's
\l{setWindowModality()} {window modality} to Qt::WindowModal or use open().
Otherwise, the message box will be a standard dialog.
@@ -787,7 +787,7 @@ QMessageBox::QMessageBox(QWidget *parent)
The message box is an \l{Qt::ApplicationModal} {application modal}
dialog box.
- On OS X, if \a parent is not 0 and you want your message box
+ On \macos, if \a parent is not 0 and you want your message box
to appear as a Qt::Sheet of that parent, set the message box's
\l{setWindowModality()} {window modality} to Qt::WindowModal
(default). Otherwise, the message box will be a standard dialog.
@@ -955,7 +955,7 @@ QAbstractButton *QMessageBox::button(StandardButton which) const
\list 1
\li If there is only one button, it is made the escape button.
\li If there is a \l Cancel button, it is made the escape button.
- \li On OS X only, if there is exactly one button with the role
+ \li On \macos only, if there is exactly one button with the role
QMessageBox::RejectRole, it is made the escape button.
\endlist
@@ -1732,7 +1732,7 @@ QMessageBox::StandardButton QMessageBox::critical(QWidget *parent, const QString
\li As a last resort it uses the Information icon.
\endlist
- The about box has a single button labelled "OK". On OS X, the
+ The about box has a single button labelled "OK". On \macos, the
about box is popped up as a modeless window; on other platforms,
it is currently application modal.
@@ -1786,7 +1786,7 @@ void QMessageBox::about(QWidget *parent, const QString &title, const QString &te
QApplication provides this functionality as a slot.
- On OS X, the about box is popped up as a modeless window; on
+ On \macos, the about box is popped up as a modeless window; on
other platforms, it is currently application modal.
\sa QApplication::aboutQt()
@@ -2545,8 +2545,8 @@ void QMessageBox::setInformativeText(const QString &text)
This function shadows QWidget::setWindowTitle().
- Sets the title of the message box to \a title. On OS X,
- the window title is ignored (as required by the OS X
+ Sets the title of the message box to \a title. On \macos,
+ the window title is ignored (as required by the \macos
Guidelines).
*/
void QMessageBox::setWindowTitle(const QString &title)
@@ -2567,7 +2567,7 @@ void QMessageBox::setWindowTitle(const QString &title)
Sets the modality of the message box to \a windowModality.
- On OS X, if the modality is set to Qt::WindowModal and the message box
+ On \macos, if the modality is set to Qt::WindowModal and the message box
has a parent, then the message box will be a Qt::Sheet, otherwise the
message box will be a standard dialog.
*/
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index f3d27ff77f..bcad069b50 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1819,7 +1819,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
\inmodule QtWidgets
- A wizard (also called an assistant on OS X) is a special type
+ A wizard (also called an assistant on \macos) is a special type
of input dialog that consists of a sequence of pages. A wizard's
purpose is to guide the user through a process step by step.
Wizards are useful for complex or infrequent tasks that users may
@@ -2117,10 +2117,10 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
This enum specifies the buttons in a wizard.
- \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on OS X)
- \value NextButton The \uicontrol Next button (\uicontrol Continue on OS X)
+ \value BackButton The \uicontrol Back button (\uicontrol {Go Back} on \macos)
+ \value NextButton The \uicontrol Next button (\uicontrol Continue on \macos)
\value CommitButton The \uicontrol Commit button
- \value FinishButton The \uicontrol Finish button (\uicontrol Done on OS X)
+ \value FinishButton The \uicontrol Finish button (\uicontrol Done on \macos)
\value CancelButton The \uicontrol Cancel button (see also NoCancelButton)
\value HelpButton The \uicontrol Help button (see also HaveHelpButton)
\value CustomButton1 The first user-defined button (see also HaveCustomButton1)
@@ -2160,7 +2160,7 @@ void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
\value ClassicStyle Classic Windows look
\value ModernStyle Modern Windows look
- \value MacStyle OS X look
+ \value MacStyle \macos look
\value AeroStyle Windows Aero look
\omitvalue NStyles
@@ -2629,7 +2629,7 @@ bool QWizard::testOption(WizardOption option) const
\list
\li Windows: HelpButtonOnRight.
- \li OS X: NoDefaultButton and NoCancelButton.
+ \li \macos: NoDefaultButton and NoCancelButton.
\li X11 and QWS (Qt for Embedded Linux): none.
\endlist
@@ -2673,7 +2673,7 @@ QWizard::WizardOptions QWizard::options() const
Sets the text on button \a which to be \a text.
By default, the text on buttons depends on the wizardStyle. For
- example, on OS X, the \uicontrol Next button is called \uicontrol
+ example, on \macos, the \uicontrol Next button is called \uicontrol
Continue.
To add extra buttons to the wizard (e.g., a \uicontrol Print button),
@@ -2705,7 +2705,7 @@ void QWizard::setButtonText(WizardButton which, const QString &text)
If a text has ben set using setButtonText(), this text is returned.
By default, the text on buttons depends on the wizardStyle. For
- example, on OS X, the \uicontrol Next button is called \uicontrol
+ example, on \macos, the \uicontrol Next button is called \uicontrol
Continue.
\sa button(), setButton(), setButtonText(), QWizardPage::buttonText(),
@@ -2891,7 +2891,7 @@ void QWizard::setPixmap(WizardPixmap which, const QPixmap &pixmap)
Returns the pixmap set for role \a which.
By default, the only pixmap that is set is the BackgroundPixmap on
- OS X.
+ \macos.
\sa QWizardPage::pixmap(), {Elements of a Wizard Page}
*/
@@ -3802,7 +3802,7 @@ void QWizardPage::setButtonText(QWizard::WizardButton which, const QString &text
this text is returned.
By default, the text on buttons depends on the QWizard::wizardStyle.
- For example, on OS X, the \uicontrol Next button is called \uicontrol
+ For example, on \macos, the \uicontrol Next button is called \uicontrol
Continue.
\sa setButtonText(), QWizard::buttonText(), QWizard::setButtonText()
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp
index cb5a74fa15..c40152ff49 100644
--- a/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qtablewidget.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
//! [0]
-setCellWidget(index, new QLineEdit);
+setCellWidget(row, column, new QLineEdit);
...
-setCellWidget(index, new QTextEdit);
+setCellWidget(row, column, new QTextEdit);
//! [0]
diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc
index c49f233001..33f480b0bf 100644
--- a/src/widgets/doc/src/graphicsview.qdoc
+++ b/src/widgets/doc/src/graphicsview.qdoc
@@ -491,7 +491,7 @@
not supported. For example, you can create decorated windows by
passing the Qt::Window window flag to QGraphicsWidget's constructor,
but Graphics View currently doesn't support the Qt::Sheet and
- Qt::Drawer flags that are common on OS X.
+ Qt::Drawer flags that are common on \macos.
\section3 QGraphicsLayout
diff --git a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
index ed56e37c78..9ce3c8472f 100644
--- a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
@@ -162,13 +162,13 @@
\section2 The User Rotates the Mouse Wheel
On Microsoft Windows, mouse wheel usage is always handled by the
- widget that has keyboard focus. On OS X and X11, it's handled by
+ widget that has keyboard focus. On \macos and X11, it's handled by
the widget that gets other mouse events.
The way Qt handles this platform difference is by letting widgets move
the keyboard focus when the wheel is used. With the right focus policy
on each widget, applications can work idiomatically correctly on
- Windows, OS X, and X11.
+ Windows, \macos, and X11.
\section2 The User Moves the Focus to This Window
diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
index 1e0ed66b13..6e697a97df 100644
--- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
@@ -115,7 +115,7 @@
The widget is passed as the last argument in case the style needs
it to perform special effects (such as animated default buttons on
- OS X), but it isn't mandatory.
+ \macos), but it isn't mandatory.
In the course of this section, we will look at the style elements,
the style options, and the functions of QStyle. Finally, we describe
diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
index 6a4e870cb1..61379fb2f0 100644
--- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc
@@ -80,7 +80,7 @@
the QPalette::Button role to red for a QPushButton to obtain a
red push button. However, this wasn't guaranteed to work for all
styles, because style authors are restricted by the different
- platforms' guidelines and (on Windows XP and OS X) by the
+ platforms' guidelines and (on Windows XP and \macos) by the
native theme engine.
Style sheets let you perform all kinds of customizations that are
@@ -121,7 +121,7 @@
\row \li \inlineimage stylesheet-coffee-cleanlooks.png
\li \inlineimage stylesheet-pagefold-mac.png
\row \li Coffee theme running on Ubuntu Linux
- \li Pagefold theme running on OS X
+ \li Pagefold theme running on \macos
\endtable
When a style sheet is active, the QStyle returned by QWidget::style()
@@ -130,7 +130,7 @@
otherwise forwards the drawing operations to the underlying,
platform-specific style (e.g., QWindowsXPStyle on Windows XP).
- Since Qt 4.5, Qt style sheets fully supports OS X.
+ Since Qt 4.5, Qt style sheets fully supports \macos.
*/
@@ -3807,7 +3807,7 @@
\snippet code/doc_src_stylesheet.qdoc 135
If you want the scroll buttons of the scroll bar to be placed together
- (instead of the edges) like on OS X, you can use the following
+ (instead of the edges) like on \macos, you can use the following
stylesheet:
\snippet code/doc_src_stylesheet.qdoc 136
diff --git a/src/widgets/doc/src/widgets-tutorial.qdoc b/src/widgets/doc/src/widgets-tutorial.qdoc
index 693377c972..d7b68a6f67 100644
--- a/src/widgets/doc/src/widgets-tutorial.qdoc
+++ b/src/widgets/doc/src/widgets-tutorial.qdoc
@@ -110,7 +110,7 @@
make sure that the executable is on your path, or enter its
full location.
- \li On Linux/Unix and OS X, type \c make and press
+ \li On Linux/Unix and \macos, type \c make and press
\uicontrol{Return}; on Windows with Visual Studio, type \c nmake and
press \uicontrol{Return}.
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp
index 49f252e49a..763688191d 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp
@@ -149,7 +149,7 @@
platforms, this means the right mouse button was clicked.
\value Keyboard The keyboard caused this event to be sent. On
- Windows and OS X, this means the menu button was pressed.
+ Windows and \macos, this means the menu button was pressed.
\value Other The event was sent by some other means (i.e. not
by the mouse or keyboard).
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 221511f38d..42b35ac644 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -788,8 +788,10 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
QModelIndex oldCurrentIndex;
if (d->selectionModel) {
- oldSelection = d->selectionModel->selection();
- oldCurrentIndex = d->selectionModel->currentIndex();
+ if (d->selectionModel->model() == selectionModel->model()) {
+ oldSelection = d->selectionModel->selection();
+ oldCurrentIndex = d->selectionModel->currentIndex();
+ }
disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
@@ -3871,7 +3873,7 @@ void QAbstractItemView::doAutoScroll()
int horizontalValue = horizontalScroll->value();
QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());
- QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules
+ QRect area = QWidgetPrivate::get(d->viewport)->clipRect();
// do the scrolling if we are in the scroll margins
if (pos.y() - area.top() < margin)
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index b080f84e90..d6c5d58934 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -46,6 +46,9 @@
#include <QtCore/qitemselectionmodel.h>
#include <QtWidgets/qabstractitemdelegate.h>
+class tst_QAbstractItemView;
+class tst_QTreeView;
+
QT_BEGIN_NAMESPACE
@@ -368,6 +371,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_scrollerStateChanged())
#endif
+ friend class ::tst_QAbstractItemView;
+ friend class ::tst_QTreeView;
friend class QTreeViewPrivate; // needed to compile with MSVC
friend class QListModeViewBase;
friend class QListViewPrivate;
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 4bf7406f92..b213a0859c 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -205,20 +205,6 @@ void QDataWidgetMapperPrivate::_q_commitData(QWidget *w)
commit(widgetMap.at(idx));
}
-class QFocusHelper: public QWidget
-{
-public:
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE
- {
- return QWidget::focusNextPrevChild(next);
- }
-
- static inline void focusNextPrevChild(QWidget *w, bool next)
- {
- static_cast<QFocusHelper *>(w)->focusNextPrevChild(next);
- }
-};
-
void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint)
{
int idx = findWidget(w);
@@ -230,10 +216,10 @@ void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate:
populate(widgetMap[idx]);
break; }
case QAbstractItemDelegate::EditNextItem:
- QFocusHelper::focusNextPrevChild(w, true);
+ w->focusNextChild();
break;
case QAbstractItemDelegate::EditPreviousItem:
- QFocusHelper::focusNextPrevChild(w, false);
+ w->focusPreviousChild();
break;
case QAbstractItemDelegate::SubmitModelCache:
case QAbstractItemDelegate::NoHint:
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 6f1e301d4f..85bd3003e1 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3465,6 +3465,7 @@ void QHeaderViewPrivate::clear()
sectionSelected.clear();
hiddenSectionSize.clear();
sectionItems.clear();
+ lastSectionLogicalIdx = -1;
invalidateCachedSizeHint();
}
}
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index b3a88db005..3c7cbddfbb 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -43,6 +43,8 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qabstractitemview.h>
+class tst_QTreeView;
+
QT_BEGIN_NAMESPACE
@@ -220,6 +222,7 @@ protected:
void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
private:
+ friend class ::tst_QTreeView;
friend class QAccessibleTable;
friend class QAccessibleTree;
friend class QAccessibleTableCell;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 5e0f13277c..1338ce4585 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -146,6 +146,7 @@ QTreeModel::QTreeModel(QTreeModelPrivate &dd, QTreeWidget *parent)
QTreeModel::~QTreeModel()
{
clear();
+ headerItem->view = Q_NULLPTR;
delete headerItem;
rootItem->view = 0;
delete rootItem;
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index b40a33b2af..ad2180bbfd 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -80,7 +80,7 @@ wince {
kernel/qwidgetsfunctions_wince.cpp
}
-contains(QT_CONFIG, opengl) {
+qtConfig(opengl) {
HEADERS += kernel/qopenglwidget.h
SOURCES += kernel/qopenglwidget.cpp
}
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 88b29e9147..e5bf606901 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -255,7 +255,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
/*!
\enum QAction::MenuRole
- This enum describes how an action should be moved into the application menu on OS X.
+ This enum describes how an action should be moved into the application menu on \macos.
\value NoRole This action should not be put into the application menu
\value TextHeuristicRole This action should be put in the application menu based on the action's text
@@ -264,7 +264,7 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
\value AboutQtRole This action handles the "About Qt" menu item.
\value AboutRole This action should be placed where the "About" menu item is in the application menu. The text of
the menu item will be set to "About <application name>". The application name is fetched from the
- \c{Info.plist} file in the application's bundle (See \l{Qt for OS X - Deployment}).
+ \c{Info.plist} file in the application's bundle (See \l{Qt for macOS - Deployment}).
\value PreferencesRole This action should be placed where the "Preferences..." menu item is in the application menu.
\value QuitRole This action should be placed where the Quit menu item is in the application menu.
@@ -1226,12 +1226,12 @@ void QAction::activate(ActionEvent event)
\brief the action's menu role
\since 4.2
- This indicates what role the action serves in the application menu on Mac
- OS X. By default all actions have the TextHeuristicRole, which means that
+ This indicates what role the action serves in the application menu on
+ \macos. By default all actions have the TextHeuristicRole, which means that
the action is added based on its text (see QMenuBar for more information).
The menu role can only be changed before the actions are put into the menu
- bar in OS X (usually just before the first application window is
+ bar in \macos (usually just before the first application window is
shown).
*/
void QAction::setMenuRole(MenuRole menuRole)
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index df467505d9..afc1be7458 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1477,7 +1477,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
\note Some styles do not use the palette for all drawing, for instance, if
they make use of native theme engines. This is the case for the Windows XP,
- Windows Vista, and OS X styles.
+ Windows Vista, and \macos styles.
\sa QWidget::setPalette(), palette(), QStyle::polish()
*/
@@ -3958,7 +3958,7 @@ bool QApplication::keypadNavigationEnabled()
Currently this function does nothing on Qt for Embedded Linux.
- On OS X, this works more at the application level and will cause the
+ On \macos, this works more at the application level and will cause the
application icon to bounce in the dock.
On Windows, this causes the window's taskbar entry to flash for a time. If
diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
index c23e942eec..27d05ece8c 100644
--- a/src/widgets/kernel/qdesktopwidget.qdoc
+++ b/src/widgets/kernel/qdesktopwidget.qdoc
@@ -149,7 +149,7 @@
Returns the available geometry of the screen with index \a screen. What
is available will be subrect of screenGeometry() based on what the
platform decides is available (for example excludes the dock and menu bar
- on OS X, or the task bar on Windows). The default screen is used if
+ on \macos, or the task bar on Windows). The default screen is used if
\a screen is -1.
\sa screenNumber(), screenGeometry()
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 0bc1c029fe..73e82c577c 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -1033,7 +1033,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
\li \b{Adherence to the different platform's look and feel guidelines.}
For example, the
- \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{Mac OS X Aqua} and KDE guidelines specify that the
+ \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{\macos Aqua} and KDE guidelines specify that the
labels should be right-aligned, whereas Windows and GNOME
applications normally use left-alignment.
@@ -1076,7 +1076,7 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
corresponds to what we would get using a two-column
QGridLayout.)
\li Style based on the
- \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{Mac OS X Aqua} guidelines. Labels are right-aligned,
+ \l{http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Intro/Intro.html}{\macos Aqua} guidelines. Labels are right-aligned,
the fields don't grow beyond their size hint, and the
form is horizontally centered.
\li Recommended style for
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 124c8c000a..147e0774e7 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -112,7 +112,7 @@ QT_BEGIN_NAMESPACE
\note Calling QSurfaceFormat::setDefaultFormat() before constructing
the QApplication instance is mandatory on some platforms (for example,
- OS X) when an OpenGL core profile context is requested. This is to
+ \macos) when an OpenGL core profile context is requested. This is to
ensure that resource sharing between contexts stays functional as all
internal contexts are created using the correct version and profile.
@@ -467,7 +467,7 @@ QT_BEGIN_NAMESPACE
recommended to limit the usage of this approach to cases where there
is no other choice. Note that this option is not suitable for most
embedded and mobile platforms, and it is known to have issues on
- certain desktop platforms (e.g. OS X) too. The stable,
+ certain desktop platforms (e.g. \macos) too. The stable,
cross-platform solution is always QOpenGLWidget.
\e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp
index 66fa350f81..e902bb522c 100644
--- a/src/widgets/kernel/qsizepolicy.cpp
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -247,7 +247,7 @@ QSizePolicy::ControlType QSizePolicy::controlType() const
The control type specifies the type of the widget for which this
size policy applies. It is used by some styles, notably
QMacStyle, to insert proper spacing between widgets. For example,
- the Mac OS X Aqua guidelines specify that push buttons should be
+ the \macos Aqua guidelines specify that push buttons should be
separated by 12 pixels, whereas vertically stacked radio buttons
only require 6 pixels.
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index e0b8024f9a..d0971443ba 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -2516,7 +2516,7 @@ QWidget *QWidget::find(WId id)
If a widget is non-native (alien) and winId() is invoked on it, that widget
will be provided a native handle.
- On OS X, the type returned depends on which framework Qt was linked
+ On \macos, the type returned depends on which framework Qt was linked
against. If Qt is using Carbon, the {WId} is actually an HIViewRef. If Qt
is using Cocoa, {WId} is a pointer to an NSView.
@@ -2643,7 +2643,7 @@ QWindow *QWidget::windowHandle() const
The style sheet contains a textual description of customizations to the
widget's style, as described in the \l{Qt Style Sheets} document.
- Since Qt 4.5, Qt style sheets fully supports OS X.
+ Since Qt 4.5, Qt style sheets fully supports \macos.
\warning Qt style sheets are currently not supported for custom QStyle
subclasses. We plan to address this in some future release.
@@ -5136,7 +5136,7 @@ void QWidget::render(QPaintDevice *target, const QPoint &targetOffset,
Transformations and settings applied to the \a painter will be used
when rendering.
- \note The \a painter must be active. On OS X the widget will be
+ \note The \a painter must be active. On \macos the widget will be
rendered into a QPixmap and then drawn by the \a painter.
\sa QPainter::device()
@@ -6280,7 +6280,7 @@ QString QWidget::windowIconText() const
If the window title is set at any point, then the window title takes precedence and
will be shown instead of the file path string.
- Additionally, on OS X, this has an added benefit that it sets the
+ Additionally, on \macos, this has an added benefit that it sets the
\l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon}
for the window, assuming that the file path exists.
@@ -11319,7 +11319,7 @@ bool QWidget::testAttribute_helper(Qt::WidgetAttribute attribute) const
By default the value of this property is 1.0.
- This feature is available on Embedded Linux, OS X, Windows,
+ This feature is available on Embedded Linux, \macos, Windows,
and X11 platforms that support the Composite extension.
This feature is not available on Windows CE.
@@ -11382,7 +11382,7 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level)
A modified window is a window whose content has changed but has
not been saved to disk. This flag will have different effects
- varied by the platform. On OS X the close button will have a
+ varied by the platform. On \macos the close button will have a
modified look; on other platforms, the window title will have an
'*' (asterisk).
@@ -12531,7 +12531,7 @@ static void releaseMouseGrabOfWidget(QWidget *widget)
\note On Windows, grabMouse() only works when the mouse is inside a window
owned by the process.
- On OS X, grabMouse() only works when the mouse is inside the frame of that widget.
+ On \macos, grabMouse() only works when the mouse is inside the frame of that widget.
\sa releaseMouse(), grabKeyboard(), releaseKeyboard()
*/
@@ -13003,7 +13003,7 @@ QDebug operator<<(QDebug debug, const QWidget *widget)
This function will return 0 if no painter context can be established, or if the handle
could not be created.
- \warning This function is only available on OS X.
+ \warning This function is only available on \macos.
*/
/*! \fn Qt::HANDLE QWidget::macQDHandle() const
\internal
@@ -13012,7 +13012,7 @@ QDebug operator<<(QDebug debug, const QWidget *widget)
This function will return 0 if QuickDraw is not supported, or if the handle could
not be created.
- \warning This function is only available on OS X.
+ \warning This function is only available on \macos.
*/
/*! \fn const QX11Info &QWidget::x11Info() const
\internal
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 2a71710143..bca89fe2c5 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -676,6 +676,7 @@ protected:
void destroy(bool destroyWindow = true,
bool destroySubWindows = true);
+ friend class QDataWidgetMapperPrivate; // for access to focusNextPrevChild
virtual bool focusNextPrevChild(bool next);
inline bool focusNextChild() { return focusNextPrevChild(true); }
inline bool focusPreviousChild() { return focusNextPrevChild(false); }
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index ce91116c4d..6eebaca42c 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -85,8 +85,8 @@ QT_BEGIN_NAMESPACE
Note that it is up to the widget to activate the action, for example by
reimplementing mouse event handlers and calling QAction::trigger().
- \b {OS X}: If you add a widget to a menu in the application's menu
- bar on OS X, the widget will be added and it will function but with some
+ \b {\macos}: If you add a widget to a menu in the application's menu
+ bar on \macos, the widget will be added and it will function but with some
limitations:
\list 1
\li The widget is reparented away from the QMenu to the native menu
@@ -96,7 +96,7 @@ QT_BEGIN_NAMESPACE
\li Due to Apple's design, mouse tracking on the widget currently does
not work.
\li Connecting the triggered() signal to a slot that opens a modal
- dialog will cause a crash in Mac OS X 10.4 (known bug acknowledged
+ dialog will cause a crash in \macos 10.4 (known bug acknowledged
by Apple), a workaround is to use a QueuedConnection instead of a
DirectConnection.
\endlist
diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc
index 5d597b53a4..f8bd1f57a9 100644
--- a/src/widgets/styles/qmacstyle.qdoc
+++ b/src/widgets/styles/qmacstyle.qdoc
@@ -28,7 +28,7 @@
/*!
\class QMacStyle
- \brief The QMacStyle class provides a OS X style using the Apple Appearance Manager.
+ \brief The QMacStyle class provides a \macos style using the Apple Appearance Manager.
\ingroup appearance
\inmodule QtWidgets
@@ -36,10 +36,10 @@
This class is implemented as a wrapper to the HITheme
APIs, allowing applications to be styled according to the current
- theme in use on OS X. This is done by having primitives
- in QStyle implemented in terms of what OS X would normally theme.
+ theme in use on \macos. This is done by having primitives
+ in QStyle implemented in terms of what \macos would normally theme.
- \warning This style is only available on OS X because it relies on the
+ \warning This style is only available on \macos because it relies on the
HITheme APIs.
There are additional issues that should be taken
@@ -56,7 +56,7 @@
involve horizontal and vertical widget alignment and widget size
(covered below).
- \li Widget size - OS X allows widgets to have specific fixed sizes. Qt
+ \li Widget size - \macos allows widgets to have specific fixed sizes. Qt
does not fully implement this behavior so as to maintain cross-platform
compatibility. As a result some widgets sizes may be inappropriate (and
subsequently not rendered correctly by the HITheme APIs).The
@@ -75,7 +75,7 @@
There are other issues that need to be considered in the feel of
your application (including the general color scheme to match the
Aqua colors). The Guidelines mentioned above will remain current
- with new advances and design suggestions for OS X.
+ with new advances and design suggestions for \macos.
Note that the functions provided by QMacStyle are
reimplementations of QStyle functions; see QStyle for their
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 5b455a4e5c..47a6156662 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -7194,7 +7194,7 @@ static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintD
returned if it can't be obtained. It is the caller's responsibility to
CGContextRelease the context when finished using it.
- \warning This function is only available on OS X.
+ \warning This function is only available on \macos.
\warning This function is duplicated in the Cocoa platform plugin.
*/
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 93bc00f662..01d972af65 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -104,7 +104,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
The style gets all the information it needs to render the
graphical element from the QStyleOption class. The widget is
passed as the last argument in case the style needs it to perform
- special effects (such as animated default buttons on OS X),
+ special effects (such as animated default buttons on \macos),
but it isn't mandatory. In fact, QStyle can be used to draw on any
paint device (not just widgets), in which case the widget argument
is a zero pointer.
@@ -203,7 +203,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
QStyle gets all the information it needs to render the graphical
element from QStyleOption. The widget is passed as the last
argument in case the style needs it to perform special effects
- (such as animated default buttons on OS X), but it isn't
+ (such as animated default buttons on \macos), but it isn't
mandatory. In fact, you can use QStyle to draw on any paint
device, not just widgets, by setting the QPainter properly.
@@ -1736,7 +1736,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
desktop platforms.
\value SH_Menu_SubMenuUniDirection Since Qt 5.5. If the cursor has
- to move towards the submenu (like it is on OS X), or if the
+ to move towards the submenu (like it is on \macos), or if the
cursor can move in any direction as long as it reaches the
submenu before the sloppy timeout.
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 73e6f69041..71cf2fb267 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1750,7 +1750,7 @@ QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
\value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction().
\value Separator A menu separator.
\value SubMenu Indicates the menu item points to a sub-menu.
- \value Scroller A popup menu scroller (currently only used on OS X).
+ \value Scroller A popup menu scroller (currently only used on \macos).
\value TearOff A tear-off handle for the menu.
\value Margin The margin of the menu.
\value EmptyArea The empty area of the menu.
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 1805e4a8af..7b9497172c 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -35,12 +35,6 @@ SOURCES += \
RESOURCES += styles/qstyle.qrc
-contains( styles, all ) {
- styles = fusion mac windows windowsxp windowsvista
-}
-
-!macx:styles -= mac
-
contains( styles, mac ) {
HEADERS += \
styles/qmacstyle_mac_p.h \
@@ -55,10 +49,6 @@ contains( styles, windowsvista ) {
HEADERS += styles/qwindowsvistastyle_p.h
HEADERS += styles/qwindowsvistastyle_p_p.h
SOURCES += styles/qwindowsvistastyle.cpp
- !contains( styles, windowsxp ) {
- message( windowsvista requires windowsxp )
- styles += windowsxp
- }
} else {
DEFINES += QT_NO_STYLE_WINDOWSVISTA
}
@@ -67,10 +57,6 @@ contains( styles, windowsxp ) {
HEADERS += styles/qwindowsxpstyle_p.h
HEADERS += styles/qwindowsxpstyle_p_p.h
SOURCES += styles/qwindowsxpstyle.cpp
- !contains( styles, windows ) {
- message( windowsxp requires windows )
- styles += windows
- }
} else {
DEFINES += QT_NO_STYLE_WINDOWSXP
}
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index f3b442928a..9973940c16 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -564,7 +564,7 @@ void QScroller::stop()
\note Please note that this value should be physically correct. The actual DPI settings
that Qt returns for the display may be reported wrongly on purpose by the underlying
- windowing system, for example on OS X.
+ windowing system, for example on \macos.
*/
QPointF QScroller::pixelPerMeter() const
{
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 7b0ecc6972..2a418167f1 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -82,9 +82,9 @@ QT_BEGIN_NAMESPACE
\li All X11 desktop environments that implement the D-Bus
\l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem}
specification, including recent versions of KDE and Unity.
- \li All supported versions of OS X. Note that the Growl
+ \li All supported versions of \macos. Note that the Growl
notification system must be installed for
- QSystemTrayIcon::showMessage() to display messages on Mac OS X prior to 10.8 (Mountain Lion).
+ QSystemTrayIcon::showMessage() to display messages on \macos prior to 10.8 (Mountain Lion).
\endlist
To check whether a system tray is present on the user's desktop,
@@ -163,7 +163,7 @@ QSystemTrayIcon::~QSystemTrayIcon()
The menu will pop up when the user requests the context menu for the system
tray icon by clicking the mouse button.
- On OS X, this is currenly converted to a NSMenu, so the
+ On \macos, this is currenly converted to a NSMenu, so the
aboutToHide() signal is not emitted.
\note The system tray icon does not take ownership of the menu. You must
@@ -323,7 +323,7 @@ bool QSystemTrayIcon::event(QEvent *e)
This signal is emitted when the message displayed using showMessage()
was clicked by the user.
- Currently this signal is not sent on OS X.
+ Currently this signal is not sent on \macos.
\note We follow Microsoft Windows XP/Vista behavior, so the
signal is also emitted when the user clicks on a tray icon with
@@ -374,7 +374,7 @@ bool QSystemTrayIcon::supportsMessages()
On Windows, the \a millisecondsTimeoutHint is usually ignored by the system
when the application has focus.
- On OS X, the Growl notification system must be installed for this function to
+ On \macos, the Growl notification system must be installed for this function to
display messages.
Has been turned into a slot in Qt 5.2.
@@ -731,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
// The recursion depth is the same as menu depth, so should not
// be higher than 3 levels.
- QListIterator<QAction *> it(menu->actions());
- while (it.hasNext()) {
- QAction *action = it.next();
+ const auto actions = menu->actions();
+ for (QAction *action : actions) {
if (action->menu())
addPlatformMenu(action->menu());
}
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 700831771d..cb19c1fc95 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -29,7 +29,7 @@ SOURCES += \
win32:!winrt {
SOURCES += util/qsystemtrayicon_win.cpp
-} else:contains(QT_CONFIG, xcb) {
+} else: qtConfig(xcb) {
SOURCES += util/qsystemtrayicon_x11.cpp
} else {
SOURCES += util/qsystemtrayicon_qpa.cpp
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 0d369eb28c..657eda3c68 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -124,7 +124,7 @@ QT_BEGIN_NAMESPACE
\endtable
Additionally, button boxes that contain only buttons with ActionRole or
- HelpRole can be considered modeless and have an alternate look on OS X:
+ HelpRole can be considered modeless and have an alternate look on \macos:
\table
\row \li modeless horizontal MacLayout
@@ -579,7 +579,7 @@ QDialogButtonBox::~QDialogButtonBox()
contained in the button box.
\value WinLayout Use a policy appropriate for applications on Windows.
- \value MacLayout Use a policy appropriate for applications on OS X.
+ \value MacLayout Use a policy appropriate for applications on \macos.
\value KdeLayout Use a policy appropriate for applications on KDE.
\value GnomeLayout Use a policy appropriate for applications on GNOME.
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 2d19780461..725cc637d6 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -49,7 +49,7 @@
\class QMacCocoaViewContainer
\since 4.5
- \brief The QMacCocoaViewContainer class provides a widget for OS X that can be used to wrap arbitrary
+ \brief The QMacCocoaViewContainer class provides a widget for \macos that can be used to wrap arbitrary
Cocoa views (i.e., NSView subclasses) and insert them into Qt hierarchies.
\ingroup advanced
@@ -64,10 +64,10 @@
of the underlying NSView.
QMacCocoaViewContainer works regardless if Qt is built against Carbon or
- Cocoa. However, QCocoaContainerView requires Mac OS X 10.5 or better to be
+ Cocoa. However, QCocoaContainerView requires \macos 10.5 or better to be
used with Carbon.
- It should be also noted that at the low level on OS X, there is a
+ It should be also noted that at the low level on \macos, there is a
difference between windows (top-levels) and view (widgets that are inside a
window). For this reason, make sure that the NSView that you are wrapping
doesn't end up as a top-level. The best way to ensure this is to make sure
diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
index 44e793f174..84389f16df 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -47,7 +47,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSView);
QT_BEGIN_NAMESPACE
-class QMacNativeWidgetPrivate;
class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget
{
Q_OBJECT
@@ -60,9 +59,6 @@ public:
protected:
bool event(QEvent *ev);
-
-private:
- Q_DECLARE_PRIVATE(QMacNativeWidget)
};
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index b6c5179989..936bd35187 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -48,13 +48,13 @@
/*!
\class QMacNativeWidget
\since 4.5
- \brief The QMacNativeWidget class provides a widget for OS X that provides
+ \brief The QMacNativeWidget class provides a widget for \macos that provides
a way to put Qt widgets into Cocoa hierarchies.
\ingroup advanced
\inmodule QtWidgets
- On OS X, there is a difference between a window and view;
+ On \macos, there is a difference between a window and view;
normally expressed as widgets in Qt. Qt makes assumptions about its
parent-child hierarchy that make it complex to put an arbitrary Qt widget
into a hierarchy of "normal" views from Apple frameworks. QMacNativeWidget
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index c31e9750bf..2477510520 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1559,7 +1559,7 @@ bool QMainWindow::event(QEvent *event)
/*!
\property QMainWindow::unifiedTitleAndToolBarOnMac
- \brief whether the window uses the unified title and toolbar look on OS X
+ \brief whether the window uses the unified title and toolbar look on \macos
Note that the Qt 5 implementation has several limitations compared to Qt 4:
\list
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 2131025c8d..5cea9a9ea2 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1441,7 +1441,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
do not support the signals: aboutToHide (), aboutToShow () and hovered ().
It is not possible to display an icon in a native menu on Windows Mobile.
- \section1 QMenu on OS X with Qt Build Against Cocoa
+ \section1 QMenu on \macos with Qt Build Against Cocoa
QMenu can be inserted only once in a menu/menubar. Subsequent insertions will
have no effect or will result in a disabled menu item.
diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm
index d48041b385..fef1eb2cf4 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -73,7 +73,7 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla
/*!
\since 5.2
- Returns the native NSMenu for this menu. Available on OS X only.
+ Returns the native NSMenu for this menu. Available on \macos only.
\note Qt sets the delegate on the native menu. If you need to set your own
delegate, make sure you save the original one and forward any calls to it.
@@ -94,7 +94,7 @@ NSMenu *QMenu::toNSMenu()
\since 5.2
Set this menu to be the dock menu available by option-clicking
- on the application dock icon. Available on OS X only.
+ on the application dock icon. Available on \macos only.
*/
void QMenu::setAsDockMenu()
{
@@ -112,7 +112,7 @@ void QMenu::setAsDockMenu()
\deprecated
Sets this \a menu to be the dock menu available by option-clicking
- on the application dock icon. Available on OS X only.
+ on the application dock icon. Available on \macos only.
Deprecated; use \l QMenu::setAsDockMenu() instead.
*/
@@ -142,7 +142,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
/*!
\since 5.2
- Returns the native NSMenu for this menu bar. Available on OS X only.
+ Returns the native NSMenu for this menu bar. Available on \macos only.
\note Qt may set the delegate on the native menu bar. If you need to set your
own delegate, make sure you save the original one and forward any calls to it.
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 3a90e14655..45b7b3091a 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -612,15 +612,15 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
for items in the menu bar are only shown when the \uicontrol{Alt} key is
pressed.
- \section1 QMenuBar on OS X
+ \section1 QMenuBar on \macos
- QMenuBar on OS X is a wrapper for using the system-wide menu bar.
+ QMenuBar on \macos is a wrapper for using the system-wide menu bar.
If you have multiple menu bars in one dialog the outermost menu bar
(normally inside a widget with widget flag Qt::Window) will
be used for the system-wide menu bar.
- Qt for OS X also provides a menu bar merging feature to make
- QMenuBar conform more closely to accepted OS X menu bar layout.
+ Qt for \macos also provides a menu bar merging feature to make
+ QMenuBar conform more closely to accepted \macos menu bar layout.
The merging functionality is based on string matching the title of
a QMenu entry. These strings are translated (using QObject::tr())
in the "QMenuBar" context. If an entry is moved its slots will still
@@ -659,7 +659,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
\b{Note:} The text used for the application name in the menu
bar is obtained from the value set in the \c{Info.plist} file in
- the application's bundle. See \l{Qt for OS X - Deployment}
+ the application's bundle. See \l{Qt for macOS - Deployment}
for more information.
\section1 QMenuBar on Windows CE
@@ -889,7 +889,7 @@ void QMenuBar::setActiveAction(QAction *act)
/*!
Removes all the actions from the menu bar.
- \note On OS X, menu items that have been merged to the system
+ \note On \macos, menu items that have been merged to the system
menu bar are not removed by this function. One way to handle this
would be to remove the extra actions yourself. You can set the
\l{QAction::MenuRole}{menu role} on the different menus, so that
@@ -1794,7 +1794,7 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
\since 4.6
This property specifies whether or not the menubar should be used as a native menubar on platforms
- that support it. The currently supported platforms are OS X and Windows CE. On these platforms
+ that support it. The currently supported platforms are \macos and Windows CE. On these platforms
if this property is \c true, the menubar is used in the native menubar and is not in the window of
its parent, if false the menubar remains in the window. On other platforms the value of this
attribute has no effect.
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index 13aa66dec7..123c955684 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -132,7 +132,7 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const
By default a rectangular rubber band (\a s is \c Rectangle) will
use a mask, so that a small border of the rectangle is all
- that is visible. Some styles (e.g., native OS X) will
+ that is visible. Some styles (e.g., native \macos) will
change this and call QWidget::setWindowOpacity() to make a
semi-transparent filled selection rectangle.
*/
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index fe04299b92..d56c6b39d1 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -140,60 +140,59 @@ void QTabBarPrivate::updateMacBorderMetrics()
}
/*!
- Initialize \a option with the values from the tab at \a tabIndex. This method
- is useful for subclasses when they need a QStyleOptionTab,
- but don't want to fill in all the information themselves.
-
- \sa QStyleOption::initFrom(), QTabWidget::initStyleOption()
+ \internal
+ This is basically QTabBar::initStyleOption() but
+ without the expensive QFontMetrics::elidedText() call.
*/
-void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
+
+void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const
{
- Q_D(const QTabBar);
- int totalTabs = d->tabList.size();
+ Q_Q(const QTabBar);
+ const int totalTabs = tabList.size();
if (!option || (tabIndex < 0 || tabIndex >= totalTabs))
return;
- const QTabBarPrivate::Tab &tab = d->tabList.at(tabIndex);
- option->initFrom(this);
+ const QTabBarPrivate::Tab &tab = tabList.at(tabIndex);
+ option->initFrom(q);
option->state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver);
- option->rect = tabRect(tabIndex);
- bool isCurrent = tabIndex == d->currentIndex;
+ option->rect = q->tabRect(tabIndex);
+ const bool isCurrent = tabIndex == currentIndex;
option->row = 0;
- if (tabIndex == d->pressedIndex)
+ if (tabIndex == pressedIndex)
option->state |= QStyle::State_Sunken;
if (isCurrent)
option->state |= QStyle::State_Selected;
- if (isCurrent && hasFocus())
+ if (isCurrent && q->hasFocus())
option->state |= QStyle::State_HasFocus;
if (!tab.enabled)
option->state &= ~QStyle::State_Enabled;
- if (isActiveWindow())
+ if (q->isActiveWindow())
option->state |= QStyle::State_Active;
- if (!d->dragInProgress && option->rect == d->hoverRect)
+ if (!dragInProgress && option->rect == hoverRect)
option->state |= QStyle::State_MouseOver;
- option->shape = d->shape;
+ option->shape = shape;
option->text = tab.text;
if (tab.textColor.isValid())
- option->palette.setColor(foregroundRole(), tab.textColor);
+ option->palette.setColor(q->foregroundRole(), tab.textColor);
option->icon = tab.icon;
- option->iconSize = iconSize(); // Will get the default value then.
+ option->iconSize = q->iconSize(); // Will get the default value then.
option->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize();
option->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize();
- option->documentMode = d->documentMode;
+ option->documentMode = documentMode;
- if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
+ if (tabIndex > 0 && tabIndex - 1 == currentIndex)
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
- else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex)
+ else if (tabIndex + 1 < totalTabs && tabIndex + 1 == currentIndex)
option->selectedPosition = QStyleOptionTab::NextIsSelected;
else
option->selectedPosition = QStyleOptionTab::NotAdjacent;
- bool paintBeginning = (tabIndex == 0) || (d->dragInProgress && tabIndex == d->pressedIndex + 1);
- bool paintEnd = (tabIndex == totalTabs - 1) || (d->dragInProgress && tabIndex == d->pressedIndex - 1);
+ const bool paintBeginning = (tabIndex == 0) || (dragInProgress && tabIndex == pressedIndex + 1);
+ const bool paintEnd = (tabIndex == totalTabs - 1) || (dragInProgress && tabIndex == pressedIndex - 1);
if (paintBeginning) {
if (paintEnd)
option->position = QStyleOptionTab::OnlyOneTab;
@@ -206,7 +205,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
}
#ifndef QT_NO_TABWIDGET
- if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())) {
+ if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(q->parentWidget())) {
option->features |= QStyleOptionTab::HasFrame;
if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner))
option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget;
@@ -214,6 +213,19 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
option->cornerWidgets |= QStyleOptionTab::RightCornerWidget;
}
#endif
+}
+
+/*!
+ Initialize \a option with the values from the tab at \a tabIndex. This method
+ is useful for subclasses when they need a QStyleOptionTab,
+ but don't want to fill in all the information themselves.
+
+ \sa QStyleOption::initFrom(), QTabWidget::initStyleOption()
+*/
+void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
+{
+ Q_D(const QTabBar);
+ d->initBasicStyleOption(option, tabIndex);
QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this);
option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(),
@@ -1094,6 +1106,7 @@ void QTabBar::setTabText(int index, const QString &text)
{
Q_D(QTabBar);
if (QTabBarPrivate::Tab *tab = d->at(index)) {
+ d->textSizes.remove(tab->text);
tab->text = text;
#ifndef QT_NO_SHORTCUT
releaseShortcut(tab->shortcutId);
@@ -1453,7 +1466,7 @@ QSize QTabBar::tabSizeHint(int index) const
Q_D(const QTabBar);
if (const QTabBarPrivate::Tab *tab = d->at(index)) {
QStyleOptionTab opt;
- initStyleOption(&opt, index);
+ d->initBasicStyleOption(&opt, index);
opt.text = d->tabList.at(index).text;
QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize;
int hframe = style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &opt, this);
@@ -1479,13 +1492,16 @@ QSize QTabBar::tabSizeHint(int index) const
if (!opt.icon.isNull())
padding += 4;
+ QHash<QString, QSize>::iterator it = d->textSizes.find(tab->text);
+ if (it == d->textSizes.end())
+ it = d->textSizes.insert(tab->text, fm.size(Qt::TextShowMnemonic, tab->text));
+ const int textWidth = it.value().width();
QSize csz;
if (verticalTabs(d->shape)) {
csz = QSize( qMax(maxWidgetWidth, qMax(fm.height(), iconSize.height())) + vframe,
- fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe + widgetHeight + padding);
+ textWidth + iconSize.width() + hframe + widgetHeight + padding);
} else {
- csz = QSize(fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe
- + widgetWidth + padding,
+ csz = QSize(textWidth + iconSize.width() + hframe + widgetWidth + padding,
qMax(maxWidgetHeight, qMax(fm.height(), iconSize.height())) + vframe);
}
@@ -2157,15 +2173,21 @@ void QTabBarPrivate::setCurrentNextEnabledIndex(int offset)
void QTabBar::changeEvent(QEvent *event)
{
Q_D(QTabBar);
- if (event->type() == QEvent::StyleChange) {
+ switch (event->type()) {
+ case QEvent::StyleChange:
if (!d->elideModeSetByUser)
d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));
if (!d->useScrollButtonsSetByUser)
d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);
+ // fallthrough
+ case QEvent::FontChange:
+ d->textSizes.clear();
d->refresh();
- } else if (event->type() == QEvent::FontChange) {
- d->refresh();
+ break;
+ default:
+ break;
}
+
QWidget::changeEvent(event);
}
@@ -2208,6 +2230,7 @@ void QTabBar::setElideMode(Qt::TextElideMode mode)
Q_D(QTabBar);
d->elideMode = mode;
d->elideModeSetByUser = true;
+ d->textSizes.clear();
d->refresh();
}
@@ -2398,7 +2421,7 @@ void QTabBar::setMovable(bool movable)
\since 4.5
This property is used as a hint for styles to draw the tabs in a different
- way then they would normally look in a tab widget. On OS X this will
+ way then they would normally look in a tab widget. On \macos this will
look similar to the tabs in Safari or Leopard's Terminal.app.
\sa QTabWidget::documentMode
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 04adf96881..0e9dce84b3 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -169,6 +169,7 @@ public:
#endif //QT_NO_ANIMATION
};
QList<Tab> tabList;
+ mutable QHash<QString, QSize> textSizes;
int calculateNewPosition(int from, int to, int index) const;
void slide(int from, int to);
@@ -202,6 +203,8 @@ public:
void autoHideTabs();
QRect normalizedScrollRect(int index = -1);
+ void initBasicStyleOption(QStyleOptionTab *option, int tabIndex) const;
+
void makeVisible(int index);
QSize iconSize;
Qt::TextElideMode elideMode;
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index 3ddf4df624..5dce76056c 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -1322,7 +1322,7 @@ void QTabWidget::setUsesScrollButtons(bool useButtons)
/*!
\property QTabWidget::documentMode
\brief Whether or not the tab widget is rendered in a mode suitable for document
- pages. This is the same as document mode on OS X.
+ pages. This is the same as document mode on \macos.
\since 4.5
When this property is set the tab widget frame is not rendered. This mode is useful
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index b93cefd867..61bc6d19cf 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -405,7 +405,7 @@ void QToolBarPrivate::plug(const QRect &r)
When a toolbar is resized in such a way that it is too small to
show all the items it contains, an extension button will appear as
the last item in the toolbar. Pressing the extension button will
- pop up a menu containing the items that does not currently fit in
+ pop up a menu containing the items that do not currently fit in
the toolbar.
When a QToolBar is not a child of a QMainWindow, it loses the ability
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index aef4634a9a..8b40325a24 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -876,7 +876,7 @@ QToolButton::ToolButtonPopupMode QToolButton::popupMode() const
The default is disabled (i.e. false).
- This property is currently ignored on OS X when using QMacStyle.
+ This property is currently ignored on \macos when using QMacStyle.
*/
void QToolButton::setAutoRaise(bool enable)
{
diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index 2bb7529456..4140ae48de 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -10,7 +10,7 @@ QT = core
DEFINES += QT_NO_FOREACH
-contains(QT_CONFIG, debug_and_release): CONFIG += build_all
+qtConfig(debug_and_release): CONFIG += build_all
win32-msvc*:QMAKE_CFLAGS_DEBUG -= -Zi
win32-msvc*:QMAKE_CXXFLAGS_DEBUG -= -Zi