summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java4
-rw-r--r--src/angle/src/compiler/translator.pro1
-rw-r--r--src/concurrent/qtconcurrentfilterkernel.h28
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.h6
-rw-r--r--src/concurrent/qtconcurrentmapkernel.h22
-rw-r--r--src/concurrent/qtconcurrentreducekernel.h2
-rw-r--r--src/concurrent/qtconcurrentrunbase.h6
-rw-r--r--src/concurrent/qtconcurrentstoredfunctioncall.h148
-rw-r--r--src/corelib/animation/qabstractanimation.cpp2
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp2
-rw-r--r--src/corelib/codecs/qtextcodec.cpp18
-rw-r--r--src/corelib/configure.json16
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.cpp2
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h2
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp2
-rw-r--r--src/corelib/doc/src/filestorage.qdoc2
-rw-r--r--src/corelib/global/global.pri12
-rw-r--r--src/corelib/global/qcompilerdetection.h17
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h13
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp50
-rw-r--r--src/corelib/global/qlibraryinfo.h2
-rw-r--r--src/corelib/global/qlogging.cpp23
-rw-r--r--src/corelib/global/qnamespace.qdoc2
-rw-r--r--src/corelib/io/qdir.cpp126
-rw-r--r--src/corelib/io/qlockfile.cpp3
-rw-r--r--src/corelib/io/qlockfile_unix.cpp13
-rw-r--r--src/corelib/io/qprocess.cpp3
-rw-r--r--src/corelib/io/qsettings.cpp1
-rw-r--r--src/corelib/io/qurl.cpp5
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.cpp18
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp98
-rw-r--r--src/corelib/kernel/kernel.pri3
-rw-r--r--src/corelib/kernel/qcore_unix.cpp14
-rw-r--r--src/corelib/kernel/qcore_unix_p.h4
-rw-r--r--src/corelib/kernel/qmetatype.cpp2
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h55
-rw-r--r--src/corelib/kernel/qsharedmemory_p.h2
-rw-r--r--src/corelib/kernel/qvariant.cpp6
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp27
-rw-r--r--src/corelib/mimetypes/qmimedatabase_p.h2
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern.cpp50
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern_p.h5
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp16
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp15
-rw-r--r--src/corelib/mimetypes/qmimeprovider_p.h7
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp2
-rw-r--r--src/corelib/thread/qthread.h4
-rw-r--r--src/corelib/tools/qalgorithms.h36
-rw-r--r--src/corelib/tools/qcollator_p.h6
-rw-r--r--src/corelib/tools/qcommandlineoption.h2
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp20
-rw-r--r--src/corelib/tools/qlocale.cpp91
-rw-r--r--src/corelib/tools/qlocale_p.h2
-rw-r--r--src/corelib/tools/qmap.cpp4
-rw-r--r--src/corelib/tools/qmap.h11
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/corelib/tools/qtimezone.cpp12
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp2
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h12
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp20
-rw-r--r--src/corelib/tools/qvarlengtharray.h3
-rw-r--r--src/corelib/tools/tools.pri1
-rw-r--r--src/dbus/qdbusconnection.cpp35
-rw-r--r--src/dbus/qdbuspendingreply.h4
-rw-r--r--src/dbus/qdbusreply.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp2
-rw-r--r--src/gui/configure.json17
-rw-r--r--src/gui/doc/src/dnd.qdoc4
-rw-r--r--src/gui/image/qimage_sse2.cpp59
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp1
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/kernel/qsimpledrag.cpp37
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp7
-rw-r--r--src/gui/math3d/qmatrix4x4.h42
-rw-r--r--src/gui/math3d/qquaternion.h5
-rw-r--r--src/gui/opengl/qopengltexture.cpp170
-rw-r--r--src/gui/opengl/qopengltexture.h28
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp18
-rw-r--r--src/gui/painting/qblendfunctions.cpp30
-rw-r--r--src/gui/painting/qcolor.cpp8
-rw-r--r--src/gui/painting/qdatabuffer_p.h12
-rw-r--r--src/gui/painting/qdrawhelper.cpp139
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp8
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_p.h8
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp11
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp18
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp2
-rw-r--r--src/gui/text/qfont.cpp2
-rw-r--r--src/gui/text/qinputcontrol.cpp82
-rw-r--r--src/gui/text/qinputcontrol_p.h76
-rw-r--r--src/gui/text/qtextdocument.cpp5
-rw-r--r--src/gui/text/text.pri6
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp2
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp7
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h2
-rw-r--r--src/network/configure.pri1
-rw-r--r--src/network/kernel/qhostaddress.cpp8
-rw-r--r--src/network/kernel/qnetworkdatagram.cpp2
-rw-r--r--src/network/kernel/qnetworkproxy.cpp8
-rw-r--r--src/network/socket/qabstractsocket_p.h12
-rw-r--r--src/network/socket/qlocalsocket_p.h4
-rw-r--r--src/network/socket/qnativesocketengine.cpp6
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache_p.h4
-rw-r--r--src/opengl/qglpixelbuffer_p.h10
-rw-r--r--src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc2
-rw-r--r--src/platformsupport/eglconvenience/qeglstreamconvenience_p.h4
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm37
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h2
-rw-r--r--src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp22
-rw-r--r--src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h16
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp9
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h2
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp11
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h1
-rw-r--r--src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java13
-rw-r--r--src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp12
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp3
-rw-r--r--src/plugins/bearer/platformdefs_win.h2
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp3
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp8
-rw-r--r--src/plugins/platforms/android/qandroidplatformforeignwindow.h12
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp5
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.h2
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglwindow.h2
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm30
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm14
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm14
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.mm4
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp37
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp42
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp35
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp48
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp2
-rw-r--r--src/plugins/platforms/mirclient/qmirclientplugin.cpp7
-rw-r--r--src/plugins/platforms/mirclient/qmirclientplugin.h1
-rw-r--r--src/plugins/platforms/qnx/main.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxclipboard.cpp6
-rw-r--r--src/plugins/platforms/qnx/qqnxclipboard.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxcursor.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxeglwindow.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxglcontext.h12
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.h24
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_noimf.h18
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h24
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.h12
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.h12
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.h24
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventthread.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxservices.h4
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.h22
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp2
-rw-r--r--src/plugins/platforms/windows/qwin10helpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp21
-rw-r--r--src/plugins/platforms/winrt/main.cpp8
-rw-r--r--src/plugins/platforms/winrt/qwinrtbackingstore.h12
-rw-r--r--src/plugins/platforms/winrt/qwinrtclipboard.h6
-rw-r--r--src/plugins/platforms/winrt/qwinrtcursor.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrtdrag.h10
-rw-r--r--src/plugins/platforms/winrt/qwinrteglcontext.h12
-rw-r--r--src/plugins/platforms/winrt/qwinrteventdispatcher.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrtfiledialoghelper.h24
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.h34
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.h8
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.h34
-rw-r--r--src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h6
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h20
-rw-r--r--src/plugins/platforms/winrt/qwinrtservices.h4
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.h6
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.h22
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp23
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h1
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h10
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h6
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h6
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h18
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h14
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.h18
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.h8
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h14
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp47
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp9
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.h18
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h44
-rw-r--r--src/plugins/platforms/xcb/qxcbmain.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h24
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h28
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.h16
-rw-r--r--src/plugins/platforms/xcb/qxcbsystemtraytracker.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp49
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h94
-rw-r--r--src/plugins/platforms/xcb/qxcbxsettings.h2
-rw-r--r--src/plugins/plugins.pro2
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp9
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp6
-rw-r--r--src/printsupport/dialogs/qabstractprintdialog.h2
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha_p.h16
-rw-r--r--src/printsupport/kernel/qpaintengine_preview_p.h30
-rw-r--r--src/sql/configure.json6
-rw-r--r--src/sql/configure.pri10
-rw-r--r--src/sql/models/qsqlrelationaldelegate.h4
-rw-r--r--src/src.pro12
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp2
-rw-r--r--src/testlib/qbenchmarkevent_p.h18
-rw-r--r--src/testlib/qbenchmarktimemeasurers_p.h32
-rw-r--r--src/testlib/qbenchmarkvalgrind_p.h16
-rw-r--r--src/testlib/qplaintestlogger_p.h14
-rw-r--r--src/testlib/qteamcitylogger_p.h14
-rw-r--r--src/testlib/qtestcase.cpp19
-rw-r--r--src/testlib/qtestcase.h2
-rw-r--r--src/testlib/qtestevent.h16
-rw-r--r--src/testlib/qtesteventloop.h2
-rw-r--r--src/testlib/qtestmouse.h15
-rw-r--r--src/testlib/qxmltestlogger_p.h14
-rw-r--r--src/testlib/qxunittestlogger_p.h14
-rw-r--r--src/testlib/testlib.pro2
-rw-r--r--src/tools/moc/moc.cpp1
-rw-r--r--src/tools/moc/parser.h4
-rw-r--r--src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp39
-rw-r--r--src/widgets/configure.json13
-rw-r--r--src/widgets/dialogs/qdialog.h18
-rw-r--r--src/widgets/dialogs/qwizard.cpp55
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp7
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h4
-rw-r--r--src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp2
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc19
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h14
-rw-r--r--src/widgets/itemviews/qheaderview.cpp14
-rw-r--r--src/widgets/itemviews/qheaderview_p.h2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.h4
-rw-r--r--src/widgets/itemviews/qlistview_p.h94
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h26
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h38
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/itemviews/qtreeview_p.h14
-rw-r--r--src/widgets/kernel/qapplication.cpp4
-rw-r--r--src/widgets/kernel/qapplication_p.h1
-rw-r--r--src/widgets/kernel/qlayoutitem.h48
-rw-r--r--src/widgets/styles/qandroidstyle.cpp13
-rw-r--r--src/widgets/styles/qandroidstyle_p.h4
-rw-r--r--src/widgets/styles/qfusionstyle.cpp18
-rw-r--r--src/widgets/styles/qfusionstyle_p.h4
-rw-r--r--src/widgets/styles/qfusionstyle_p_p.h4
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h2
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp11
-rw-r--r--src/widgets/styles/qstylefactory.cpp34
-rw-r--r--src/widgets/styles/qstyleoption.cpp5
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp8
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h4
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp5
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h4
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h4
-rw-r--r--src/widgets/styles/styles.pri38
-rw-r--r--src/widgets/util/qflickgesture_p.h6
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp5
-rw-r--r--src/widgets/util/qundostack.cpp2
-rw-r--r--src/widgets/widgets/qabstractspinbox.h40
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h4
-rw-r--r--src/widgets/widgets/qcombobox.cpp6
-rw-r--r--src/widgets/widgets/qcombobox_p.h46
-rw-r--r--src/widgets/widgets/qdatetimeedit.h26
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h8
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp10
-rw-r--r--src/widgets/widgets/qdockarealayout_p.h1
-rw-r--r--src/widgets/widgets/qdockwidget.cpp10
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h4
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp58
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h5
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp24
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h2
-rw-r--r--src/widgets/widgets/qmenu.cpp2
-rw-r--r--src/widgets/widgets/qmenubar.h36
-rw-r--r--src/widgets/widgets/qprogressbar.cpp18
-rw-r--r--src/widgets/widgets/qspinbox.h10
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp18
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h6
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp17
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h3
307 files changed, 2759 insertions, 1857 deletions
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java
index ce0ce3abc7..759daf4393 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java
@@ -118,10 +118,12 @@ public class QtActivityLoader extends QtLoader {
public void onCreate(Bundle savedInstanceState) {
try {
m_contextInfo = m_activity.getPackageManager().getActivityInfo(m_activity.getComponentName(), PackageManager.GET_META_DATA);
+ int theme = ((ActivityInfo)m_contextInfo).getThemeResource();
for (Field f : Class.forName("android.R$style").getDeclaredFields()) {
- if (f.getInt(null) == ((ActivityInfo)m_contextInfo).getThemeResource()) {
+ if (f.getInt(null) == theme) {
QT_ANDROID_THEMES = new String[] {f.getName()};
QT_ANDROID_DEFAULT_THEME = f.getName();
+ break;
}
}
} catch (Exception e) {
diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro
index 2e5adaee96..663a8892a7 100644
--- a/src/angle/src/compiler/translator.pro
+++ b/src/angle/src/compiler/translator.pro
@@ -204,6 +204,5 @@ bison_impl.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.cpp
bison_impl.input = BISON_SOURCES
bison_impl.commands = $$MAKEFILE_NOOP_COMMAND
bison_impl.depends = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.h
-bison_impl.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.cpp
bison_impl.variable_out = GENERATED_SOURCES
QMAKE_EXTRA_COMPILERS += bison_impl
diff --git a/src/concurrent/qtconcurrentfilterkernel.h b/src/concurrent/qtconcurrentfilterkernel.h
index 1e875e3d38..bd474fc0c9 100644
--- a/src/concurrent/qtconcurrentfilterkernel.h
+++ b/src/concurrent/qtconcurrentfilterkernel.h
@@ -96,7 +96,7 @@ public:
reducer(OrderedReduce)
{ }
- bool runIteration(typename Sequence::const_iterator it, int index, T *)
+ bool runIteration(typename Sequence::const_iterator it, int index, T *) override
{
IntermediateResults<typename Sequence::value_type> results;
results.begin = index;
@@ -109,7 +109,7 @@ public:
return false;
}
- bool runIterations(typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *)
+ bool runIterations(typename Sequence::const_iterator sequenceBeginIterator, int begin, int end, T *) override
{
IntermediateResults<typename Sequence::value_type> results;
results.begin = begin;
@@ -129,18 +129,18 @@ public:
return false;
}
- void finish()
+ void finish() override
{
reducer.finish(reduce, reducedResult);
sequence = reducedResult;
}
- inline bool shouldThrottleThread()
+ inline bool shouldThrottleThread() override
{
return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle();
}
- inline bool shouldStartThread()
+ inline bool shouldStartThread() override
{
return IterateKernelType::shouldStartThread() && reducer.shouldStartThread();
}
@@ -183,7 +183,7 @@ public:
{ }
#endif
- bool runIteration(Iterator it, int index, ReducedResultType *)
+ bool runIteration(Iterator it, int index, ReducedResultType *) override
{
IntermediateResults<typename qValueType<Iterator>::value_type> results;
results.begin = index;
@@ -196,7 +196,7 @@ public:
return false;
}
- bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *)
+ bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) override
{
IntermediateResults<typename qValueType<Iterator>::value_type> results;
results.begin = begin;
@@ -215,24 +215,24 @@ public:
return false;
}
- void finish()
+ void finish() override
{
reducer.finish(reduce, reducedResult);
}
- inline bool shouldThrottleThread()
+ inline bool shouldThrottleThread() override
{
return IterateKernelType::shouldThrottleThread() || reducer.shouldThrottle();
}
- inline bool shouldStartThread()
+ inline bool shouldStartThread() override
{
return IterateKernelType::shouldStartThread() && reducer.shouldStartThread();
}
typedef ReducedResultType ReturnType;
typedef ReducedResultType ResultType;
- ReducedResultType *result()
+ ReducedResultType *result() override
{
return &reducedResult;
}
@@ -255,14 +255,14 @@ public:
: IterateKernelType(begin, end), keep(_keep)
{ }
- void start()
+ void start() override
{
if (this->futureInterface)
this->futureInterface->setFilterMode(true);
IterateKernelType::start();
}
- bool runIteration(Iterator it, int index, T *)
+ bool runIteration(Iterator it, int index, T *) override
{
if (keep(*it))
this->reportResult(&(*it), index);
@@ -271,7 +271,7 @@ public:
return false;
}
- bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *)
+ bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *) override
{
const int count = end - begin;
IntermediateResults<typename qValueType<Iterator>::value_type> results;
diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h
index b4360abd26..dbd000e8ba 100644
--- a/src/concurrent/qtconcurrentiteratekernel.h
+++ b/src/concurrent/qtconcurrentiteratekernel.h
@@ -197,14 +197,14 @@ public:
virtual bool runIterations(Iterator _begin, int beginIndex, int endIndex, T *results)
{ Q_UNUSED(_begin); Q_UNUSED(beginIndex); Q_UNUSED(endIndex); Q_UNUSED(results); return false; }
- void start()
+ void start() override
{
progressReportingEnabled = this->isProgressReportingEnabled();
if (progressReportingEnabled && iterationCount > 0)
this->setProgressRange(0, iterationCount);
}
- bool shouldStartThread()
+ bool shouldStartThread() override
{
if (forIteration)
return (currentIndex.load() < iterationCount) && !this->shouldThrottleThread();
@@ -212,7 +212,7 @@ public:
return (iteratorThreads.load() == 0);
}
- ThreadFunctionResult threadFunction()
+ ThreadFunctionResult threadFunction() override
{
if (forIteration)
return this->forThreadFunction();
diff --git a/src/concurrent/qtconcurrentmapkernel.h b/src/concurrent/qtconcurrentmapkernel.h
index ad5ef93684..fa162f7c34 100644
--- a/src/concurrent/qtconcurrentmapkernel.h
+++ b/src/concurrent/qtconcurrentmapkernel.h
@@ -64,13 +64,13 @@ public:
: IterateKernel<Iterator, void>(begin, end), map(_map)
{ }
- bool runIteration(Iterator it, int, void *)
+ bool runIteration(Iterator it, int, void *) override
{
map(*it);
return false;
}
- bool runIterations(Iterator sequenceBeginIterator, int beginIndex, int endIndex, void *)
+ bool runIterations(Iterator sequenceBeginIterator, int beginIndex, int endIndex, void *) override
{
Iterator it = sequenceBeginIterator;
std::advance(it, beginIndex);
@@ -108,7 +108,7 @@ public:
: reducedResult(initialValue), map(_map), reduce(_reduce)
{ }
- bool runIteration(Iterator it, int index, ReducedResultType *)
+ bool runIteration(Iterator it, int index, ReducedResultType *) override
{
IntermediateResults<typename MapFunctor::result_type> results;
results.begin = index;
@@ -119,7 +119,7 @@ public:
return false;
}
- bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *)
+ bool runIterations(Iterator sequenceBeginIterator, int begin, int end, ReducedResultType *) override
{
IntermediateResults<typename MapFunctor::result_type> results;
results.begin = begin;
@@ -137,23 +137,23 @@ public:
return false;
}
- void finish()
+ void finish() override
{
reducer.finish(reduce, reducedResult);
}
- bool shouldThrottleThread()
+ bool shouldThrottleThread() override
{
return IterateKernel<Iterator, ReducedResultType>::shouldThrottleThread() || reducer.shouldThrottle();
}
- bool shouldStartThread()
+ bool shouldStartThread() override
{
return IterateKernel<Iterator, ReducedResultType>::shouldStartThread() && reducer.shouldStartThread();
}
typedef ReducedResultType ResultType;
- ReducedResultType *result()
+ ReducedResultType *result() override
{
return &reducedResult;
}
@@ -171,13 +171,13 @@ public:
MappedEachKernel(Iterator begin, Iterator end, MapFunctor _map)
: IterateKernel<Iterator, T>(begin, end), map(_map) { }
- bool runIteration(Iterator it, int, T *result)
+ bool runIteration(Iterator it, int, T *result) override
{
*result = map(*it);
return true;
}
- bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *results)
+ bool runIterations(Iterator sequenceBeginIterator, int begin, int end, T *results) override
{
Iterator it = sequenceBeginIterator;
@@ -216,7 +216,7 @@ struct SequenceHolder1 : public Base
Sequence sequence;
- void finish()
+ void finish() override
{
Base::finish();
// Clear the sequence to make sure all temporaries are destroyed
diff --git a/src/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h
index 2cbf30dffb..c5003a2a0e 100644
--- a/src/concurrent/qtconcurrentreducekernel.h
+++ b/src/concurrent/qtconcurrentreducekernel.h
@@ -230,7 +230,7 @@ struct SequenceHolder2 : public Base
Sequence sequence;
- void finish()
+ void finish() override
{
Base::finish();
// Clear the sequence to make sure all temporaries are destroyed
diff --git a/src/concurrent/qtconcurrentrunbase.h b/src/concurrent/qtconcurrentrunbase.h
index 734fd54f70..303838b73e 100644
--- a/src/concurrent/qtconcurrentrunbase.h
+++ b/src/concurrent/qtconcurrentrunbase.h
@@ -88,7 +88,7 @@ public:
return theFuture;
}
- void run() {}
+ void run() override {}
virtual void runFunctor() = 0;
};
@@ -96,7 +96,7 @@ template <typename T>
class RunFunctionTask : public RunFunctionTaskBase<T>
{
public:
- void run()
+ void run() override
{
if (this->isCanceled()) {
this->reportFinished();
@@ -124,7 +124,7 @@ template <>
class RunFunctionTask<void> : public RunFunctionTaskBase<void>
{
public:
- void run()
+ void run() override
{
if (this->isCanceled()) {
this->reportFinished();
diff --git a/src/concurrent/qtconcurrentstoredfunctioncall.h b/src/concurrent/qtconcurrentstoredfunctioncall.h
index 0afce17f74..750ece1ef1 100644
--- a/src/concurrent/qtconcurrentstoredfunctioncall.h
+++ b/src/concurrent/qtconcurrentstoredfunctioncall.h
@@ -57,7 +57,7 @@ struct StoredFunctorCall0: public RunFunctionTask<T>
{
inline StoredFunctorCall0(FunctionPointer _function)
: function(_function) {}
- void runFunctor() { this->result = function(); }
+ void runFunctor() override { this->result = function(); }
FunctionPointer function;
};
@@ -67,7 +67,7 @@ struct StoredFunctorCall0<void, FunctionPointer>: public RunFunctionTask<void>
{
inline StoredFunctorCall0(FunctionPointer _function)
: function(_function) {}
- void runFunctor() { function(); }
+ void runFunctor() override { function(); }
FunctionPointer function;
};
@@ -77,7 +77,7 @@ struct StoredFunctorPointerCall0: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall0(FunctionPointer * _function)
: function(_function) {}
- void runFunctor() { this->result =(*function)(); }
+ void runFunctor() override { this->result =(*function)(); }
FunctionPointer * function;
};
@@ -87,7 +87,7 @@ struct VoidStoredFunctorPointerCall0: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall0(FunctionPointer * _function)
: function(_function) {}
- void runFunctor() {(*function)(); }
+ void runFunctor() override { (*function)(); }
FunctionPointer * function;
};
@@ -106,7 +106,7 @@ public:
StoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)();
}
@@ -122,7 +122,7 @@ public:
VoidStoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)();
}
@@ -145,7 +145,7 @@ public:
StoredConstMemberFunctionCall0(T (Class::*_fn)() const, const Class &_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)();
}
@@ -161,7 +161,7 @@ public:
VoidStoredConstMemberFunctionCall0(T (Class::*_fn)() const, const Class &_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)();
}
@@ -184,7 +184,7 @@ public:
StoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)();
}
@@ -200,7 +200,7 @@ public:
VoidStoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)();
}
@@ -223,7 +223,7 @@ public:
StoredConstMemberFunctionPointerCall0(T (Class::*_fn)() const, Class const *_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)();
}
@@ -239,7 +239,7 @@ public:
VoidStoredConstMemberFunctionPointerCall0(T (Class::*_fn)() const, Class const *_object)
: fn(_fn), object(_object){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)();
}
@@ -260,7 +260,7 @@ struct StoredFunctorCall1: public RunFunctionTask<T>
{
inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1)
: function(_function), arg1(_arg1) {}
- void runFunctor() { this->result = function(arg1); }
+ void runFunctor() override { this->result = function(arg1); }
FunctionPointer function;
Arg1 arg1;
};
@@ -270,7 +270,7 @@ struct StoredFunctorCall1<void, FunctionPointer, Arg1>: public RunFunctionTask<v
{
inline StoredFunctorCall1(FunctionPointer _function, const Arg1 &_arg1)
: function(_function), arg1(_arg1) {}
- void runFunctor() { function(arg1); }
+ void runFunctor() override { function(arg1); }
FunctionPointer function;
Arg1 arg1;
};
@@ -280,7 +280,7 @@ struct StoredFunctorPointerCall1: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1)
: function(_function), arg1(_arg1) {}
- void runFunctor() { this->result =(*function)(arg1); }
+ void runFunctor() override { this->result =(*function)(arg1); }
FunctionPointer * function;
Arg1 arg1;
};
@@ -290,7 +290,7 @@ struct VoidStoredFunctorPointerCall1: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall1(FunctionPointer * _function, const Arg1 &_arg1)
: function(_function), arg1(_arg1) {}
- void runFunctor() {(*function)(arg1); }
+ void runFunctor() override { (*function)(arg1); }
FunctionPointer * function;
Arg1 arg1;
};
@@ -309,7 +309,7 @@ public:
StoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1);
}
@@ -325,7 +325,7 @@ public:
VoidStoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1);
}
@@ -348,7 +348,7 @@ public:
StoredConstMemberFunctionCall1(T (Class::*_fn)(Param1) const, const Class &_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1);
}
@@ -364,7 +364,7 @@ public:
VoidStoredConstMemberFunctionCall1(T (Class::*_fn)(Param1) const, const Class &_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1);
}
@@ -387,7 +387,7 @@ public:
StoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1);
}
@@ -403,7 +403,7 @@ public:
VoidStoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1);
}
@@ -426,7 +426,7 @@ public:
StoredConstMemberFunctionPointerCall1(T (Class::*_fn)(Param1) const, Class const *_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1);
}
@@ -442,7 +442,7 @@ public:
VoidStoredConstMemberFunctionPointerCall1(T (Class::*_fn)(Param1) const, Class const *_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1);
}
@@ -463,7 +463,7 @@ struct StoredFunctorCall2: public RunFunctionTask<T>
{
inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2)
: function(_function), arg1(_arg1), arg2(_arg2) {}
- void runFunctor() { this->result = function(arg1, arg2); }
+ void runFunctor() override { this->result = function(arg1, arg2); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2;
};
@@ -473,7 +473,7 @@ struct StoredFunctorCall2<void, FunctionPointer, Arg1, Arg2>: public RunFunction
{
inline StoredFunctorCall2(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2)
: function(_function), arg1(_arg1), arg2(_arg2) {}
- void runFunctor() { function(arg1, arg2); }
+ void runFunctor() override { function(arg1, arg2); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2;
};
@@ -483,7 +483,7 @@ struct StoredFunctorPointerCall2: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2)
: function(_function), arg1(_arg1), arg2(_arg2) {}
- void runFunctor() { this->result =(*function)(arg1, arg2); }
+ void runFunctor() override { this->result =(*function)(arg1, arg2); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2;
};
@@ -493,7 +493,7 @@ struct VoidStoredFunctorPointerCall2: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2)
: function(_function), arg1(_arg1), arg2(_arg2) {}
- void runFunctor() {(*function)(arg1, arg2); }
+ void runFunctor() override { (*function)(arg1, arg2); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2;
};
@@ -512,7 +512,7 @@ public:
StoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2);
}
@@ -528,7 +528,7 @@ public:
VoidStoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2);
}
@@ -551,7 +551,7 @@ public:
StoredConstMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2);
}
@@ -567,7 +567,7 @@ public:
VoidStoredConstMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2);
}
@@ -590,7 +590,7 @@ public:
StoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2);
}
@@ -606,7 +606,7 @@ public:
VoidStoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2);
}
@@ -629,7 +629,7 @@ public:
StoredConstMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2);
}
@@ -645,7 +645,7 @@ public:
VoidStoredConstMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2);
}
@@ -666,7 +666,7 @@ struct StoredFunctorCall3: public RunFunctionTask<T>
{
inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {}
- void runFunctor() { this->result = function(arg1, arg2, arg3); }
+ void runFunctor() override { this->result = function(arg1, arg2, arg3); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -676,7 +676,7 @@ struct StoredFunctorCall3<void, FunctionPointer, Arg1, Arg2, Arg3>: public RunFu
{
inline StoredFunctorCall3(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {}
- void runFunctor() { function(arg1, arg2, arg3); }
+ void runFunctor() override { function(arg1, arg2, arg3); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -686,7 +686,7 @@ struct StoredFunctorPointerCall3: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {}
- void runFunctor() { this->result =(*function)(arg1, arg2, arg3); }
+ void runFunctor() override { this->result =(*function)(arg1, arg2, arg3); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -696,7 +696,7 @@ struct VoidStoredFunctorPointerCall3: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall3(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3) {}
- void runFunctor() {(*function)(arg1, arg2, arg3); }
+ void runFunctor() override { (*function)(arg1, arg2, arg3); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -715,7 +715,7 @@ public:
StoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2, arg3);
}
@@ -731,7 +731,7 @@ public:
VoidStoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2, arg3);
}
@@ -754,7 +754,7 @@ public:
StoredConstMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2, arg3);
}
@@ -770,7 +770,7 @@ public:
VoidStoredConstMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2, arg3);
}
@@ -793,7 +793,7 @@ public:
StoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2, arg3);
}
@@ -809,7 +809,7 @@ public:
VoidStoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2, arg3);
}
@@ -832,7 +832,7 @@ public:
StoredConstMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2, arg3);
}
@@ -848,7 +848,7 @@ public:
VoidStoredConstMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2, arg3);
}
@@ -869,7 +869,7 @@ struct StoredFunctorCall4: public RunFunctionTask<T>
{
inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {}
- void runFunctor() { this->result = function(arg1, arg2, arg3, arg4); }
+ void runFunctor() override { this->result = function(arg1, arg2, arg3, arg4); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -879,7 +879,7 @@ struct StoredFunctorCall4<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4>: public
{
inline StoredFunctorCall4(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {}
- void runFunctor() { function(arg1, arg2, arg3, arg4); }
+ void runFunctor() override { function(arg1, arg2, arg3, arg4); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -889,7 +889,7 @@ struct StoredFunctorPointerCall4: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {}
- void runFunctor() { this->result =(*function)(arg1, arg2, arg3, arg4); }
+ void runFunctor() override { this->result =(*function)(arg1, arg2, arg3, arg4); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -899,7 +899,7 @@ struct VoidStoredFunctorPointerCall4: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall4(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4) {}
- void runFunctor() {(*function)(arg1, arg2, arg3, arg4); }
+ void runFunctor() override { (*function)(arg1, arg2, arg3, arg4); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -918,7 +918,7 @@ public:
StoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2, arg3, arg4);
}
@@ -934,7 +934,7 @@ public:
VoidStoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2, arg3, arg4);
}
@@ -957,7 +957,7 @@ public:
StoredConstMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2, arg3, arg4);
}
@@ -973,7 +973,7 @@ public:
VoidStoredConstMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2, arg3, arg4);
}
@@ -996,7 +996,7 @@ public:
StoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2, arg3, arg4);
}
@@ -1012,7 +1012,7 @@ public:
VoidStoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2, arg3, arg4);
}
@@ -1035,7 +1035,7 @@ public:
StoredConstMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2, arg3, arg4);
}
@@ -1051,7 +1051,7 @@ public:
VoidStoredConstMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2, arg3, arg4);
}
@@ -1072,7 +1072,7 @@ struct StoredFunctorCall5: public RunFunctionTask<T>
{
inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
- void runFunctor() { this->result = function(arg1, arg2, arg3, arg4, arg5); }
+ void runFunctor() override { this->result = function(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1082,7 +1082,7 @@ struct StoredFunctorCall5<void, FunctionPointer, Arg1, Arg2, Arg3, Arg4, Arg5>:
{
inline StoredFunctorCall5(FunctionPointer _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
- void runFunctor() { function(arg1, arg2, arg3, arg4, arg5); }
+ void runFunctor() override { function(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1092,7 +1092,7 @@ struct StoredFunctorPointerCall5: public RunFunctionTask<T>
{
inline StoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
- void runFunctor() { this->result =(*function)(arg1, arg2, arg3, arg4, arg5); }
+ void runFunctor() override { this->result =(*function)(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1102,7 +1102,7 @@ struct VoidStoredFunctorPointerCall5: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
- void runFunctor() {(*function)(arg1, arg2, arg3, arg4, arg5); }
+ void runFunctor() override {(*function)(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1121,7 +1121,7 @@ public:
StoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1137,7 +1137,7 @@ public:
VoidStoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1160,7 +1160,7 @@ public:
StoredConstMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1176,7 +1176,7 @@ public:
VoidStoredConstMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
(object.*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1199,7 +1199,7 @@ public:
StoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1215,7 +1215,7 @@ public:
VoidStoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1238,7 +1238,7 @@ public:
StoredConstMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1254,7 +1254,7 @@ public:
VoidStoredConstMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) const, Class const *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
- void runFunctor()
+ void runFunctor() override
{
(object->*fn)(arg1, arg2, arg3, arg4, arg5);
}
@@ -1276,7 +1276,7 @@ class StoredFunctorCall : public RunFunctionTask<T>
{
public:
StoredFunctorCall(const Functor &f) : functor(f) { }
- void runFunctor()
+ void runFunctor() override
{
this->result = functor();
}
@@ -1288,7 +1288,7 @@ class StoredFunctorCall<void, Functor> : public RunFunctionTask<void>
{
public:
StoredFunctorCall(const Functor &f) : functor(f) { }
- void runFunctor()
+ void runFunctor() override
{
functor();
}
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 662774b484..8c189e9288 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -242,6 +242,7 @@ QUnifiedTimer *QUnifiedTimer::instance(bool create)
inst = unifiedTimer() ? unifiedTimer()->localData() : 0;
}
#else
+ Q_UNUSED(create);
static QUnifiedTimer unifiedTimer;
inst = &unifiedTimer;
#endif
@@ -576,6 +577,7 @@ QAnimationTimer *QAnimationTimer::instance(bool create)
inst = animationTimer() ? animationTimer()->localData() : 0;
}
#else
+ Q_UNUSED(create);
static QAnimationTimer animationTimer;
inst = &animationTimer;
#endif
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 6e5b08c295..9fd845bb93 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -269,10 +269,8 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
QPropertyAnimation *animToStop = 0;
{
-#ifndef QT_NO_THREAD
static QBasicMutex mutex;
QMutexLocker locker(&mutex);
-#endif
typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
static QPropertyAnimationHash hash;
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 0c9036aadf..aed3532024 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -58,7 +58,7 @@
#if !defined(QT_BOOTSTRAPPED)
# include "qtsciicodec_p.h"
# include "qisciicodec_p.h"
-#if defined(QT_USE_ICU)
+#if QT_CONFIG(icu)
#include "qicucodec_p.h"
#else
#if QT_CONFIG(iconv)
@@ -79,7 +79,7 @@
# endif // !Q_OS_INTEGRITY
#endif // !QT_NO_BIG_CODECS
-#endif // QT_USE_ICU
+#endif // icu
#endif // QT_BOOTSTRAPPED
#include "qmutex.h"
@@ -99,7 +99,7 @@ typedef QList<QByteArray>::ConstIterator ByteArrayListConstIt;
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive));
QMutex *qTextCodecsMutex() { return textCodecsMutex(); }
-#if !defined(QT_USE_ICU)
+#if !QT_CONFIG(icu)
static char qtolower(char c)
{ if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
static bool qisalnum(char c)
@@ -306,7 +306,7 @@ static void setup()
}
#else
static void setup() {}
-#endif // QT_USE_ICU
+#endif // icu
/*!
\enum QTextCodec::ConversionFlag
@@ -519,7 +519,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
return 0;
setup();
-#ifndef QT_USE_ICU
+#if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec;
if (cache) {
@@ -586,7 +586,7 @@ QTextCodec* QTextCodec::codecForMib(int mib)
}
}
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return QIcuCodec::codecForMibUnlocked(mib);
#else
return 0;
@@ -618,7 +618,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
codecs += (*it)->aliases();
}
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
codecs += QIcuCodec::availableCodecs();
#endif
@@ -634,7 +634,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
*/
QList<int> QTextCodec::availableMibs()
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return QIcuCodec::availableMibs();
#else
QMutexLocker locker(textCodecsMutex());
@@ -688,7 +688,7 @@ QTextCodec* QTextCodec::codecForLocale()
QTextCodec *codec = globalData->codecForLocale.loadAcquire();
if (!codec) {
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
textCodecsMutex()->lock();
codec = QIcuCodec::defaultCodecUnlocked();
textCodecsMutex()->unlock();
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 0d1954c3a8..c170b38977 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -289,7 +289,7 @@
"label": "journald",
"autoDetect": false,
"condition": "libs.journald",
- "output": [ "privateConfig" ]
+ "output": [ "privateFeature" ]
},
"std-atomic64": {
"label": "64 bit atomic operations",
@@ -355,22 +355,16 @@
"condition": "features.statemachine",
"output": [ "publicFeature" ]
},
- "sharedmemory": {
- "label": "Enable QSharedMemory",
- "condition": "config.android || config.win32 || tests.ipc_sysv || tests.ipc_posix",
- "output": [ { "type": "define", "negative": true, "name": "QT_NO_SHAREDMEMORY" } ]
- },
"slog2": {
"label": "slog2",
"condition": "libs.slog2",
- "emitIf": "config.qnx",
- "output": [ "privateConfig" ]
+ "output": [ "privateFeature" ]
},
"syslog": {
"label": "syslog",
"autoDetect": false,
"condition": "tests.syslog",
- "output": [ "privateConfig" ]
+ "output": [ "privateFeature" ]
},
"threadsafe-cloexec": {
"label": "Threadsafe pipe creation",
@@ -396,7 +390,9 @@
"label": "QSharedMemory",
"purpose": "Provides access to a shared memory segment.",
"section": "Kernel",
- "condition": "!config.vxworks",
+ "condition": [
+ "config.android || config.win32 || (!config.vxworks && (tests.ipc_sysv || tests.ipc_posix))"
+ ],
"output": [ "publicFeature", "feature" ]
},
"systemsemaphore": {
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.cpp
index d222ca32a7..b84cf0ae2d 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.cpp
@@ -52,7 +52,7 @@
class MyXcbEventFilter : public QAbstractNativeEventFilter
{
public:
- virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override
{
if (eventType == "xcb_generic_event_t") {
xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
index 6666bc56c5..9734f99d50 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qabstractnativeeventfilter.h
@@ -44,6 +44,6 @@
class MyCocoaEventFilter : public QAbstractNativeEventFilter
{
public:
- bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE;
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override;
};
//! [0]
diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
index a621109c0d..7c687a0430 100644
--- a/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
@@ -55,7 +55,7 @@ class MyObject;
class WorkerThread : public QThread
{
Q_OBJECT
- void run() Q_DECL_OVERRIDE {
+ void run() override {
QString result;
/* ... here is the expensive or blocking operation ... */
emit resultReady(result);
diff --git a/src/corelib/doc/src/filestorage.qdoc b/src/corelib/doc/src/filestorage.qdoc
index c6a4a85646..e291ba1375 100644
--- a/src/corelib/doc/src/filestorage.qdoc
+++ b/src/corelib/doc/src/filestorage.qdoc
@@ -75,7 +75,7 @@ by a Sun SPARC running Solaris. You can also use a data stream to read/write
raw unencoded binary data.
For more details on the datatypes that QDataStream can serialize, see
-{Serializing Qt Data Types}.
+\l{Serializing Qt Data Types}.
The QTextStream class provides a convenient interface for reading and
writing text. QTextStream can operate on a QIODevice, a QByteArray or
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index f74662b464..36655ca1dd 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -47,19 +47,11 @@ if(linux*|hurd*):!cross_compile:!static:!*-armcc* {
DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
}
-slog2 {
+qtConfig(slog2): \
LIBS_PRIVATE += -lslog2
- DEFINES += QT_USE_SLOG2
-}
-journald {
+qtConfig(journald): \
QMAKE_USE_PRIVATE += journald
- DEFINES += QT_USE_JOURNALD
-}
-
-syslog {
- DEFINES += QT_USE_SYSLOG
-}
gcc:ltcg {
versiontagging_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $(INCPATH)
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 4142c17b42..c0f14e0f03 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -995,11 +995,20 @@
#ifdef __cplusplus
# include <utility>
# if defined(Q_OS_QNX)
-// QNX: test if we are using libcpp (Dinkumware-based).
-// Older versions (QNX 650) do not support C++11 features
+// By default, QNX 7.0 uses libc++ (from LLVM) and
+// QNX 6.X uses Dinkumware's libcpp. In all versions,
+// it is also possible to use GNU libstdc++.
+
+// For Dinkumware, some features must be disabled
+// (mostly because of library problems).
+// Dinkumware is assumed when __GLIBCXX__ (GNU libstdc++)
+// and _LIBCPP_VERSION (LLVM libc++) are both absent.
+# if !defined(__GLIBCXX__) && !defined(_LIBCPP_VERSION)
+
+// Older versions of libcpp (QNX 650) do not support C++11 features
// _HAS_* macros are set to 1 by toolchains that actually include
// Dinkum C++11 libcpp.
-# if !defined(__GLIBCXX__)
+
# if !defined(_HAS_CPP0X) || !_HAS_CPP0X
// Disable C++11 features that depend on library support
# undef Q_COMPILER_INITIALIZER_LISTS
@@ -1016,7 +1025,7 @@
// Disable constexpr support on QNX even if the compiler supports it
# undef Q_COMPILER_CONSTEXPR
# endif // !_HAS_CONSTEXPR
-# endif // !__GLIBCXX__
+# endif // !__GLIBCXX__ && !_LIBCPP_VERSION
# endif // Q_OS_QNX
# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \
&& ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index 4629a57485..d7849d4699 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -69,21 +69,28 @@
#define QT_CRYPTOGRAPHICHASH_ONLY_SHA1
#define QT_NO_DATASTREAM
#define QT_FEATURE_iconv -1
+#define QT_FEATURE_icu -1
+#define QT_FEATURE_journald -1
#define QT_NO_LIBRARY
#define QT_FEATURE_library -1
#define QT_NO_QOBJECT
#define QT_NO_SYSTEMLOCALE
+#define QT_FEATURE_slog2 -1
+#define QT_FEATURE_syslog -1
#define QT_NO_THREAD
#define QT_FEATURE_timezone -1
#define QT_FEATURE_topleveldomain -1
#define QT_NO_TRANSLATION
#define QT_FEATURE_translation -1
#define QT_NO_GEOM_VARIANT
+#define QT_FEATURE_sharedmemory -1
+#define QT_FEATURE_systemsemaphore -1
-#if defined(QT_BUILD_QMAKE) || defined(QT_BUILD_CONFIGURE)
+#ifdef QT_BUILD_QMAKE
#define QT_FEATURE_commandlineparser -1
#define QT_NO_COMPRESS
#define QT_JSON_READONLY
+#define QT_NO_STANDARDPATHS
#define QT_NO_TEXTCODEC
#define QT_FEATURE_textcodec -1
#else
@@ -93,8 +100,4 @@
#define QT_FEATURE_textcodec 1
#endif
-#if defined(QT_BUILD_QMAKE)
-#define QT_NO_STANDARDPATHS
-#endif
-
#endif // QT_BOOTSTRAPPED
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 32176913ea..b4245ac8f6 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -81,7 +81,7 @@
1: The feature is available
*/
#define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
-#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not vailable.")
+#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
# define QT_NO_UNSHARABLE_CONTAINERS
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 27fe10a79e..0de8b50900 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -57,7 +57,10 @@ QT_END_NAMESPACE
# include "private/qcore_mac_p.h"
#endif
-#include "qconfig.cpp"
+#ifndef QT_BUILD_QMAKE_BOOTSTRAP
+# include "qconfig.cpp"
+#endif
+
#include "archdetect.cpp"
QT_BEGIN_NAMESPACE
@@ -88,6 +91,11 @@ class QLibraryInfoPrivate
public:
static QSettings *findConfiguration();
#ifdef QT_BUILD_QMAKE
+ static void reload()
+ {
+ if (qt_library_settings.exists())
+ qt_library_settings->load();
+ }
static bool haveGroup(QLibraryInfo::PathGroup group)
{
QLibrarySettings *ls = qt_library_settings();
@@ -415,6 +423,7 @@ static const struct {
{ "Tests", "tests" },
#ifdef QT_BUILD_QMAKE
{ "Sysroot", "" },
+ { "SysrootifyPrefix", "" },
{ "HostBinaries", "bin" },
{ "HostLibraries", "lib" },
{ "HostData", "." },
@@ -424,6 +433,13 @@ static const struct {
#endif
};
+#ifdef QT_BUILD_QMAKE
+void QLibraryInfo::reload()
+{
+ QLibraryInfoPrivate::reload();
+}
+#endif
+
/*!
Returns the location specified by \a loc.
*/
@@ -434,13 +450,17 @@ QLibraryInfo::location(LibraryLocation loc)
QString ret = rawLocation(loc, FinalPaths);
// Automatically prepend the sysroot to target paths
- if ((loc < SysrootPath || loc > LastHostPath) && QT_CONFIGURE_SYSROOTIFY_PREFIX) {
+ if (loc < SysrootPath || loc > LastHostPath) {
QString sysroot = rawLocation(SysrootPath, FinalPaths);
- if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
- && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
- ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
- else
- ret.prepend(sysroot);
+ if (!sysroot.isEmpty()
+ && QVariant::fromValue(rawLocation(SysrootifyPrefixPath, FinalPaths)).toBool()) {
+ if (ret.length() > 2 && ret.at(1) == QLatin1Char(':')
+ && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) {
+ ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
+ } else {
+ ret.prepend(sysroot);
+ }
+ }
}
return ret;
@@ -503,7 +523,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
if (loc == HostPrefixPath)
ret = config->value(QLatin1String(qtConfEntries[PrefixPath].key),
QLatin1String(qtConfEntries[PrefixPath].value)).toString();
- else if (loc == TargetSpecPath || loc == HostSpecPath)
+ else if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
fromConf = false;
// The last case here is SysrootPath, which can be legitimately empty.
// All other keys have non-empty fallbacks to start with.
@@ -527,14 +547,15 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
}
#endif // QT_NO_SETTINGS
+#ifndef QT_BUILD_QMAKE_BOOTSTRAP
if (!fromConf) {
const char * volatile path = 0;
if (loc == PrefixPath) {
path =
-#ifdef QT_BUILD_QMAKE
+# ifdef QT_BUILD_QMAKE
(group != DevicePaths) ?
QT_CONFIGURE_EXT_PREFIX_PATH :
-#endif
+# endif
QT_CONFIGURE_PREFIX_PATH;
} else if (unsigned(loc) <= sizeof(qt_configure_str_offsets)/sizeof(qt_configure_str_offsets[0])) {
path = qt_configure_strs + qt_configure_str_offsets[loc - 1];
@@ -542,19 +563,20 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
} else if (loc == SettingsPath) {
path = QT_CONFIGURE_SETTINGS_PATH;
#endif
-#ifdef QT_BUILD_QMAKE
+# ifdef QT_BUILD_QMAKE
} else if (loc == HostPrefixPath) {
path = QT_CONFIGURE_HOST_PREFIX_PATH;
-#endif
+# endif
}
if (path)
ret = QString::fromLocal8Bit(path);
}
+#endif
#ifdef QT_BUILD_QMAKE
- // The specs need to be returned verbatim.
- if (loc == TargetSpecPath || loc == HostSpecPath)
+ // These values aren't actually paths and thus need to be returned verbatim.
+ if (loc == TargetSpecPath || loc == HostSpecPath || loc == SysrootifyPrefixPath)
return ret;
#endif
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 55be706382..809813d99d 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -91,6 +91,7 @@ public:
#ifdef QT_BUILD_QMAKE
// These are not subject to binary compatibility constraints
SysrootPath,
+ SysrootifyPrefixPath,
HostBinariesPath,
HostLibrariesPath,
HostDataPath,
@@ -105,6 +106,7 @@ public:
#ifdef QT_BUILD_QMAKE
enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
static QString rawLocation(LibraryLocation, PathGroup);
+ static void reload();
#endif
static QStringList platformPluginArguments(const QString &platformName);
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 6984097b70..6b90a47388 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#include "qglobal_p.h"
#include "qlogging.h"
#include "qlist.h"
#include "qbytearray.h"
@@ -59,7 +60,7 @@
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
-#ifdef QT_USE_SLOG2
+#if QT_CONFIG(slog2)
#include <slog2.h>
#endif
@@ -67,12 +68,12 @@
#include <android/log.h>
#endif
-#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
+#if QT_CONFIG(journald)
# define SD_JOURNAL_SUPPRESS_LOCATION
# include <systemd/sd-journal.h>
# include <syslog.h>
#endif
-#if defined(QT_USE_SYSLOG) && !defined(QT_BOOTSTRAPPED)
+#if QT_CONFIG(syslog)
# include <syslog.h>
#endif
#ifdef Q_OS_UNIX
@@ -93,7 +94,7 @@
# endif
#endif
-#if defined(QT_USE_SLOG2)
+#if QT_CONFIG(slog2)
extern char *__progname;
#endif
@@ -1285,7 +1286,7 @@ static QString formatBacktraceForLogMessage(const QMessagePattern::BacktracePara
}
#endif // QLOGGING_HAVE_BACKTRACE && !QT_BOOTSTRAPPED
-#if defined(QT_USE_SLOG2)
+#if QT_CONFIG(slog2)
#ifndef QT_LOG_CODE
#define QT_LOG_CODE 9000
#endif
@@ -1334,7 +1335,7 @@ static void slog2_default_handler(QtMsgType msgType, const char *message)
//writes to the slog2 buffer
slog2c(NULL, QT_LOG_CODE, severity, message);
}
-#endif // QT_USE_SLOG2
+#endif // slog2
Q_GLOBAL_STATIC(QMessagePattern, qMessagePattern)
@@ -1483,7 +1484,7 @@ static QBasicAtomicPointer<void (QtMsgType, const char*)> msgHandler = Q_BASIC_A
// pointer to QtMessageHandler debug handler (with context)
static QBasicAtomicPointer<void (QtMsgType, const QMessageLogContext &, const QString &)> messageHandler = Q_BASIC_ATOMIC_INITIALIZER(qDefaultMessageHandler);
-#if defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
+#if QT_CONFIG(journald)
static void systemd_default_message_handler(QtMsgType type,
const QMessageLogContext &context,
const QString &message)
@@ -1517,7 +1518,7 @@ static void systemd_default_message_handler(QtMsgType type,
}
#endif
-#ifdef QT_USE_SYSLOG
+#if QT_CONFIG(syslog)
static void syslog_default_message_handler(QtMsgType type, const char *message)
{
int priority = LOG_INFO; // Informational
@@ -1581,14 +1582,14 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con
logMessage.append(QLatin1Char('\n'));
OutputDebugString(reinterpret_cast<const wchar_t *>(logMessage.utf16()));
return;
-#elif defined(QT_USE_SLOG2)
+#elif QT_CONFIG(slog2)
logMessage.append(QLatin1Char('\n'));
slog2_default_handler(type, logMessage.toLocal8Bit().constData());
return;
-#elif defined(QT_USE_JOURNALD) && !defined(QT_BOOTSTRAPPED)
+#elif QT_CONFIG(journald)
systemd_default_message_handler(type, context, logMessage);
return;
-#elif defined(QT_USE_SYSLOG) && !defined(QT_BOOTSTRAPPED)
+#elif QT_CONFIG(syslog)
syslog_default_message_handler(type, logMessage.toUtf8().constData());
return;
#elif defined(Q_OS_ANDROID)
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 250195a512..11044cef88 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2651,7 +2651,7 @@
\value FontRole The font used for items rendered with the default
delegate. (QFont)
\value TextAlignmentRole The alignment of the text for items rendered with the
- default delegate. (Qt::AlignmentFlag)
+ default delegate. (Qt::Alignment)
\value BackgroundRole The background brush used for items rendered with
the default delegate. (QBrush)
\value BackgroundColorRole This role is obsolete. Use BackgroundRole instead.
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 91953ebf26..437f774547 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -80,6 +80,40 @@ static QString driveSpec(const QString &path)
}
#endif
+enum {
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+ OSSupportsUncPaths = true
+#else
+ OSSupportsUncPaths = false
+#endif
+};
+
+// Return the length of the root part of an absolute path, for use by cleanPath(), cd().
+static int rootLength(const QString &name, bool allowUncPaths)
+{
+ const int len = name.length();
+ // starts with double slash
+ if (allowUncPaths && name.startsWith(QLatin1String("//"))) {
+ // Server name '//server/path' is part of the prefix.
+ const int nextSlash = name.indexOf(QLatin1Char('/'), 2);
+ return nextSlash >= 0 ? nextSlash + 1 : len;
+ }
+#if defined(Q_OS_WINRT)
+ const QString rootPath = QDir::rootPath(); // rootPath contains the trailing slash
+ if (name.startsWith(rootPath, Qt::CaseInsensitive))
+ return rootPath.size();
+#endif // Q_OS_WINRT
+#if defined(Q_OS_WIN)
+ if (len >= 2 && name.at(1) == QLatin1Char(':')) {
+ // Handle a possible drive letter
+ return len > 2 && name.at(2) == QLatin1Char('/') ? 3 : 2;
+ }
+#endif
+ if (name.at(0) == QLatin1Char('/'))
+ return 1;
+ return 0;
+}
+
//************* QDirPrivate
QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_)
: QSharedData()
@@ -859,6 +893,8 @@ QString QDir::fromNativeSeparators(const QString &pathName)
return pathName;
}
+static QString qt_cleanPath(const QString &path, bool *ok = nullptr);
+
/*!
Changes the QDir's directory to \a dirName.
@@ -879,32 +915,18 @@ bool QDir::cd(const QString &dirName)
return true;
QString newPath;
if (isAbsolutePath(dirName)) {
- newPath = cleanPath(dirName);
+ newPath = qt_cleanPath(dirName);
} else {
- if (isRoot())
- newPath = d->dirEntry.filePath();
- else
- newPath = d->dirEntry.filePath() % QLatin1Char('/');
+ newPath = d->dirEntry.filePath();
+ if (!newPath.endsWith(QLatin1Char('/')))
+ newPath += QLatin1Char('/');
newPath += dirName;
if (dirName.indexOf(QLatin1Char('/')) >= 0
|| dirName == QLatin1String("..")
|| d->dirEntry.filePath() == QLatin1String(".")) {
- newPath = cleanPath(newPath);
-#if defined (Q_OS_UNIX)
- //After cleanPath() if path is "/.." or starts with "/../" it means trying to cd above root.
- if (newPath.startsWith(QLatin1String("/../")) || newPath == QLatin1String("/.."))
-#elif defined (Q_OS_WINRT)
- const QString rootPath = QDir::rootPath();
- if (newPath.size() < rootPath.size() && rootPath.startsWith(newPath))
-#else
- /*
- cleanPath() already took care of replacing '\' with '/'.
- We can't use startsWith here because the letter of the drive is unknown.
- After cleanPath() if path is "[A-Z]:/.." or starts with "[A-Z]:/../" it means trying to cd above root.
- */
-
- if (newPath.midRef(1, 4) == QLatin1String(":/..") && (newPath.length() == 5 || newPath.at(5) == QLatin1Char('/')))
-#endif
+ bool ok;
+ newPath = qt_cleanPath(newPath, &ok);
+ if (!ok)
return false;
/*
If newPath starts with .., we convert it to absolute to
@@ -2051,10 +2073,14 @@ bool QDir::match(const QString &filter, const QString &fileName)
This method is shared with QUrl, so it doesn't deal with QDir::separator(),
nor does it remove the trailing slash, if any.
*/
-Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool allowUncPaths)
+Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool allowUncPaths,
+ bool *ok = nullptr)
{
const int len = name.length();
+ if (ok)
+ *ok = false;
+
if (len == 0)
return name;
@@ -2066,19 +2092,7 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all
const QChar *prefix = p;
int up = 0;
- int prefixLength = 0;
-
- if (allowUncPaths && len >= 2 && p[1].unicode() == '/' && p[0].unicode() == '/') {
- // starts with double slash
- prefixLength = 2;
-#ifdef Q_OS_WIN
- } else if (len >= 2 && p[1].unicode() == ':') {
- // remember the drive letter
- prefixLength = (len > 2 && p[2].unicode() == '/') ? 3 : 2;
-#endif
- } else if (p[0].unicode() == '/') {
- prefixLength = 1;
- }
+ const int prefixLength = rootLength(name, allowUncPaths);
p += prefixLength;
i -= prefixLength;
@@ -2131,6 +2145,10 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all
--up;
}
+ // Indicate failure when ".." are left over for an absolute path.
+ if (ok)
+ *ok = prefixLength == 0 || up == 0;
+
// add remaining '..'
while (up) {
if (used != len && out[used].unicode() != '/') // is not empty and there isn't already a '/'
@@ -2168,32 +2186,16 @@ Q_AUTOTEST_EXPORT QString qt_normalizePathSegments(const QString &name, bool all
return ret;
}
-/*!
- Returns \a path with directory separators normalized (converted to "/") and
- redundant ones removed, and "."s and ".."s resolved (as far as possible).
-
- Symbolic links are kept. This function does not return the
- canonical path, but rather the simplest version of the input.
- For example, "./local" becomes "local", "local/../bin" becomes
- "bin" and "/local/usr/../bin" becomes "/local/bin".
-
- \sa absolutePath(), canonicalPath()
-*/
-QString QDir::cleanPath(const QString &path)
+static QString qt_cleanPath(const QString &path, bool *ok)
{
if (path.isEmpty())
return path;
QString name = path;
- QChar dir_separator = separator();
+ QChar dir_separator = QDir::separator();
if (dir_separator != QLatin1Char('/'))
name.replace(dir_separator, QLatin1Char('/'));
- bool allowUncPaths = false;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //allow unc paths
- allowUncPaths = true;
-#endif
-
- QString ret = qt_normalizePathSegments(name, allowUncPaths);
+ QString ret = qt_normalizePathSegments(name, OSSupportsUncPaths, ok);
// Strip away last slash except for root directories
if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) {
@@ -2211,6 +2213,22 @@ QString QDir::cleanPath(const QString &path)
}
/*!
+ Returns \a path with directory separators normalized (converted to "/") and
+ redundant ones removed, and "."s and ".."s resolved (as far as possible).
+
+ Symbolic links are kept. This function does not return the
+ canonical path, but rather the simplest version of the input.
+ For example, "./local" becomes "local", "local/../bin" becomes
+ "bin" and "/local/usr/../bin" becomes "/local/bin".
+
+ \sa absolutePath(), canonicalPath()
+*/
+QString QDir::cleanPath(const QString &path)
+{
+ return qt_cleanPath(path);
+}
+
+/*!
Returns \c true if \a path is relative; returns \c false if it is
absolute.
diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp
index ae3a7c6abc..cb1ff93ad3 100644
--- a/src/corelib/io/qlockfile.cpp
+++ b/src/corelib/io/qlockfile.cpp
@@ -84,6 +84,9 @@ QT_BEGIN_NAMESPACE
For the use case of protecting a resource over a long time, you should therefore call
setStaleLockTime(0), and when tryLock() returns LockFailedError, inform the user
that the document is locked, possibly using getLockInfo() for more details.
+
+ \note On Windows, this class has problems detecting a stale lock if the
+ machine's hostname contains characters outside the US-ASCII character set.
*/
/*!
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 82beb15912..3a80014c00 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -81,15 +81,6 @@
QT_BEGIN_NAMESPACE
-static QByteArray localHostName() // from QHostInfo::localHostName(), modified to return a QByteArray
-{
- QByteArray hostName(512, Qt::Uninitialized);
- if (gethostname(hostName.data(), hostName.size()) == -1)
- return QByteArray();
- hostName.truncate(strlen(hostName.data()));
- return hostName;
-}
-
// ### merge into qt_safe_write?
static qint64 qt_write_loop(int fd, const char *data, qint64 len)
{
@@ -185,7 +176,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
// Use operator% from the fast builder to avoid multiple memory allocations.
QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'
% QCoreApplication::applicationName().toUtf8() % '\n'
- % localHostName() % '\n';
+ % QSysInfo::machineHostName().toUtf8() % '\n';
const QByteArray lockFileName = QFile::encodeName(fileName);
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
@@ -242,7 +233,7 @@ bool QLockFilePrivate::isApparentlyStale() const
qint64 pid;
QString hostname, appname;
if (getLockInfo(&pid, &hostname, &appname)) {
- if (hostname.isEmpty() || hostname == QString::fromLocal8Bit(localHostName())) {
+ if (hostname.isEmpty() || hostname == QSysInfo::machineHostName()) {
if (::kill(pid, 0) == -1 && errno == ESRCH)
return true; // PID doesn't exist anymore
const QString processName = processNameByPid(pid);
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 23a3cc1a16..c7d6cb426d 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -509,6 +509,9 @@ void QProcessPrivate::Channel::clear()
You can also call error() to find the type of error that occurred
last, and state() to find the current process state.
+ \note QProcess is not supported on VxWorks, iOS, tvOS, watchOS,
+ or the Universal Windows Platform.
+
\section1 Communicating via Channels
Processes have two predefined output channels: The standard
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 480a777457..8c67d97afa 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2705,6 +2705,7 @@ void QSettings::sync()
{
Q_D(QSettings);
d->sync();
+ d->pendingChanges = false;
}
/*!
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 60ce752eb6..38f2a708b5 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -240,7 +240,7 @@
Only valid if RemovePath is not set.
\value PreferLocalFile If the URL is a local file according to isLocalFile()
and contains no query or fragment, a local file path is returned.
- \value StripTrailingSlash The trailing slash is removed if one is present.
+ \value StripTrailingSlash The trailing slash is removed from the path, if one is present.
\value NormalizePathSegments Modifies the path to remove redundant directory separators,
and to resolve "."s and ".."s (as far as possible).
@@ -417,7 +417,8 @@
#include "qurlquery.h"
QT_BEGIN_NAMESPACE
-extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp
+extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths,
+ bool *ok = nullptr); // qdir.cpp
inline static bool isHex(char c)
{
diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp
index e537793146..7c306799d0 100644
--- a/src/corelib/itemmodels/qidentityproxymodel.cpp
+++ b/src/corelib/itemmodels/qidentityproxymodel.cpp
@@ -496,15 +496,6 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
{
Q_Q(QIdentityProxyModel);
- const auto proxyPersistentIndexes = q->persistentIndexList();
- for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
- proxyIndexes << proxyPersistentIndex;
- Q_ASSERT(proxyPersistentIndex.isValid());
- const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
- Q_ASSERT(srcPersistentIndex.isValid());
- layoutChangePersistentIndexes << srcPersistentIndex;
- }
-
QList<QPersistentModelIndex> parents;
parents.reserve(sourceParents.size());
for (const QPersistentModelIndex &parent : sourceParents) {
@@ -518,6 +509,15 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
}
q->layoutAboutToBeChanged(parents, hint);
+
+ const auto proxyPersistentIndexes = q->persistentIndexList();
+ for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
+ proxyIndexes << proxyPersistentIndex;
+ Q_ASSERT(proxyPersistentIndex.isValid());
+ const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex);
+ Q_ASSERT(srcPersistentIndex.isValid());
+ layoutChangePersistentIndexes << srcPersistentIndex;
+ }
}
void QIdentityProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index b0ddfa879d..226a2401e1 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -171,6 +171,7 @@ public:
QRowsRemoval itemsBeingRemoved;
QModelIndexPairList saved_persistent_indexes;
+ QList<QPersistentModelIndex> saved_layoutChange_parents;
QHash<QModelIndex, Mapping *>::const_iterator create_mapping(
const QModelIndex &source_parent) const;
@@ -1331,23 +1332,23 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<Q
Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
saved_persistent_indexes.clear();
- QList<QPersistentModelIndex> parents;
+ saved_layoutChange_parents.clear();
for (const QPersistentModelIndex &parent : sourceParents) {
if (!parent.isValid()) {
- parents << QPersistentModelIndex();
+ saved_layoutChange_parents << QPersistentModelIndex();
continue;
}
const QModelIndex mappedParent = q->mapFromSource(parent);
// Might be filtered out.
if (mappedParent.isValid())
- parents << mappedParent;
+ saved_layoutChange_parents << mappedParent;
}
// All parents filtered out.
- if (!sourceParents.isEmpty() && parents.isEmpty())
+ if (!sourceParents.isEmpty() && saved_layoutChange_parents.isEmpty())
return;
- emit q->layoutAboutToBeChanged(parents);
+ emit q->layoutAboutToBeChanged(saved_layoutChange_parents);
if (persistent.indexes.isEmpty())
return;
@@ -1359,6 +1360,9 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
Q_Q(QSortFilterProxyModel);
Q_UNUSED(hint); // We can't forward Hint because we might filter additional rows or columns
+ if (!sourceParents.isEmpty() && saved_layoutChange_parents.isEmpty())
+ return;
+
// Optimize: We only actually have to clear the mapping related to the contents of
// sourceParents, not everything.
qDeleteAll(source_index_mapping);
@@ -1373,21 +1377,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersisten
source_index_mapping.clear();
}
- QList<QPersistentModelIndex> parents;
- for (const QPersistentModelIndex &parent : sourceParents) {
- if (!parent.isValid()) {
- parents << QPersistentModelIndex();
- continue;
- }
- const QModelIndex mappedParent = q->mapFromSource(parent);
- if (mappedParent.isValid())
- parents << mappedParent;
- }
-
- if (!sourceParents.isEmpty() && parents.isEmpty())
- return;
-
- emit q->layoutChanged(parents);
+ emit q->layoutChanged(saved_layoutChange_parents);
+ saved_layoutChange_parents.clear();
}
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
@@ -1427,49 +1418,27 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsRemoved(
void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
// Because rows which are contiguous in the source model might not be contiguous
// in the proxy due to sorting, the best thing we can do here is be specific about what
// parents are having their children changed.
// Optimize: Emit move signals if the proxy is not sorted. Will need to account for rows
// being filtered out though.
- saved_persistent_indexes.clear();
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutAboutToBeChanged(parents);
- if (persistent.indexes.isEmpty())
- return;
- saved_persistent_indexes = store_persistent_indexes();
+ parents << destParent;
+ _q_sourceLayoutAboutToBeChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
-
- // Optimize: We only need to clear and update the persistent indexes which are children of
- // sourceParent or destParent
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
-
- update_persistent_indexes(saved_persistent_indexes);
- saved_persistent_indexes.clear();
-
- if (dynamic_sortfilter && update_source_sort_column()) {
- //update_source_sort_column might have created wrong mapping so we have to clear it again
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
- }
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutChanged(parents);
+ parents << destParent;
+ _q_sourceLayoutChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(
@@ -1531,42 +1500,21 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved(
void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
-
- saved_persistent_indexes.clear();
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutAboutToBeChanged(parents);
-
- if (persistent.indexes.isEmpty())
- return;
- saved_persistent_indexes = store_persistent_indexes();
+ parents << destParent;
+ _q_sourceLayoutAboutToBeChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved(
const QModelIndex &sourceParent, int /* sourceStart */, int /* sourceEnd */, const QModelIndex &destParent, int /* dest */)
{
- Q_Q(QSortFilterProxyModel);
-
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
-
- update_persistent_indexes(saved_persistent_indexes);
- saved_persistent_indexes.clear();
-
- if (dynamic_sortfilter && update_source_sort_column()) {
- qDeleteAll(source_index_mapping);
- source_index_mapping.clear();
- }
-
QList<QPersistentModelIndex> parents;
- parents << q->mapFromSource(sourceParent);
+ parents << sourceParent;
if (sourceParent != destParent)
- parents << q->mapFromSource(destParent);
- emit q->layoutChanged(parents);
+ parents << destParent;
+ _q_sourceLayoutChanged(parents, QAbstractItemModel::NoLayoutChangeHint);
}
/*!
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 7799113d30..61d0f2bdf1 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -151,9 +151,6 @@ unix|integrity {
kernel/qtimerinfo_unix_p.h
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
qtConfig(glib) {
SOURCES += \
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 2042964427..686143f8c7 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -38,6 +38,7 @@
**
****************************************************************************/
+#include <QtCore/private/qglobal_p.h>
#include "qcore_unix_p.h"
#include "qelapsedtimer.h"
@@ -49,9 +50,8 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLLTS)
-# define ppoll pollts
-# define QT_HAVE_PPOLL
+#if QT_CONFIG(poll_pollts)
+# define ppoll pollts
#endif
static inline bool time_update(struct timespec *tv, const struct timespec &start,
@@ -64,7 +64,7 @@ static inline bool time_update(struct timespec *tv, const struct timespec &start
return tv->tv_sec >= 0;
}
-#if !defined(QT_HAVE_PPOLL) && defined(QT_HAVE_POLL)
+#if QT_CONFIG(poll_poll)
static inline int timespecToMillisecs(const struct timespec *ts)
{
return (ts == NULL) ? -1 :
@@ -77,9 +77,9 @@ int qt_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts);
static inline int qt_ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts)
{
-#if defined(QT_HAVE_PPOLL)
- return ::ppoll(fds, nfds, timeout_ts, Q_NULLPTR);
-#elif defined(QT_HAVE_POLL)
+#if QT_CONFIG(poll_ppoll) || QT_CONFIG(poll_pollts)
+ return ::ppoll(fds, nfds, timeout_ts, nullptr);
+#elif QT_CONFIG(poll_poll)
return ::poll(fds, nfds, timespecToMillisecs(timeout_ts));
#else
return qt_poll(fds, nfds, timeout_ts);
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index b5756af994..80058d9115 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -370,7 +370,7 @@ union qt_semun {
};
#ifndef QT_POSIX_IPC
-#ifndef QT_NO_SHAREDMEMORY
+#if QT_CONFIG(sharedmemory) || QT_CONFIG(systemsemaphore)
#ifndef Q_OS_ANDROID
static inline key_t qt_safe_ftok(const QByteArray &filename, int proj_id)
{
@@ -379,7 +379,7 @@ static inline key_t qt_safe_ftok(const QByteArray &filename, int proj_id)
return ::ftok(filename.constData(), qHash(filename, proj_id));
}
#endif // !Q_OS_ANDROID
-#endif // !QT_NO_SHAREDMEMORY
+#endif // QT_CONFIG(sharedmemory) || QT_CONFIG(systemsemaphore)
#endif // !QT_POSIX_IPC
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index f27fde6b8d..ef68878f68 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -207,8 +207,6 @@ struct DefinedTypesFilter {
\enum QMetaType::Type
These are the built-in types supported by QMetaType:
- Read doc on QChar
- Read doc on \l QChar
\value Void \c void
\value Bool \c bool
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index 79c9c8303e..1768e8ccc6 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -149,6 +149,20 @@ namespace QtPrivate {
(o->*f)((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]);
}
};
+#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510
+ template <int... II, typename... SignalArgs, typename R, typename... SlotArgs, typename SlotRet, class Obj>
+ struct FunctorCall<IndexesList<II...>, List<SignalArgs...>, R, SlotRet (Obj::*)(SlotArgs...) noexcept> {
+ static void call(SlotRet (Obj::*f)(SlotArgs...) noexcept, Obj *o, void **arg) {
+ (o->*f)((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]);
+ }
+ };
+ template <int... II, typename... SignalArgs, typename R, typename... SlotArgs, typename SlotRet, class Obj>
+ struct FunctorCall<IndexesList<II...>, List<SignalArgs...>, R, SlotRet (Obj::*)(SlotArgs...) const noexcept> {
+ static void call(SlotRet (Obj::*f)(SlotArgs...) const noexcept, Obj *o, void **arg) {
+ (o->*f)((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...), ApplyReturnValue<R>(arg[0]);
+ }
+ };
+#endif
template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...)>
{
@@ -187,6 +201,47 @@ namespace QtPrivate {
}
};
+#if defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510
+ template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...) noexcept>
+ {
+ typedef Obj Object;
+ typedef List<Args...> Arguments;
+ typedef Ret ReturnType;
+ typedef Ret (Obj::*Function) (Args...) noexcept;
+ template <class Base> struct ChangeClass { typedef Ret (Base:: *Type)(Args...) noexcept; };
+ enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true};
+ template <typename SignalArgs, typename R>
+ static void call(Function f, Obj *o, void **arg) {
+ FunctorCall<typename Indexes<ArgumentCount>::Value, SignalArgs, R, Function>::call(f, o, arg);
+ }
+ };
+ template<class Obj, typename Ret, typename... Args> struct FunctionPointer<Ret (Obj::*) (Args...) const noexcept>
+ {
+ typedef Obj Object;
+ typedef List<Args...> Arguments;
+ typedef Ret ReturnType;
+ typedef Ret (Obj::*Function) (Args...) const noexcept;
+ template <class Base> struct ChangeClass { typedef Ret (Base:: *Type)(Args...) const noexcept; };
+ enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = true};
+ template <typename SignalArgs, typename R>
+ static void call(Function f, Obj *o, void **arg) {
+ FunctorCall<typename Indexes<ArgumentCount>::Value, SignalArgs, R, Function>::call(f, o, arg);
+ }
+ };
+
+ template<typename Ret, typename... Args> struct FunctionPointer<Ret (*) (Args...) noexcept>
+ {
+ typedef List<Args...> Arguments;
+ typedef Ret ReturnType;
+ typedef Ret (*Function) (Args...) noexcept;
+ enum {ArgumentCount = sizeof...(Args), IsPointerToMemberFunction = false};
+ template <typename SignalArgs, typename R>
+ static void call(Function f, void *, void **arg) {
+ FunctorCall<typename Indexes<ArgumentCount>::Value, SignalArgs, R, Function>::call(f, arg);
+ }
+ };
+#endif
+
template<typename Function, int N> struct Functor
{
template <typename SignalArgs, typename R>
diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h
index 51f729cf23..95fe0d1083 100644
--- a/src/corelib/kernel/qsharedmemory_p.h
+++ b/src/corelib/kernel/qsharedmemory_p.h
@@ -53,6 +53,8 @@
#include "qsharedmemory.h"
+#include <QtCore/qstring.h>
+
#ifdef QT_NO_SHAREDMEMORY
# ifndef QT_NO_SYSTEMSEMAPHORE
namespace QSharedMemoryPrivate
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index ccfa7d0d38..9476ab3f5b 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -319,7 +319,7 @@ template<typename TInput, typename LiteralWrapper>
inline bool qt_convertToBool(const QVariant::Private *const d)
{
TInput str = v_cast<TInput>(d)->toLower();
- return !(str == LiteralWrapper("0") || str == LiteralWrapper("false") || str.isEmpty());
+ return !(str.isEmpty() || str == LiteralWrapper("0") || str == LiteralWrapper("false"));
}
/*!
@@ -700,7 +700,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
bool *b = static_cast<bool *>(result);
switch(d->type) {
case QVariant::ByteArray:
- *b = qt_convertToBool<QByteArray, QByteArray>(d);
+ *b = qt_convertToBool<QByteArray, const char*>(d);
break;
case QVariant::String:
*b = qt_convertToBool<QString, QLatin1String>(d);
@@ -1186,7 +1186,7 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
\snippet code/src_corelib_kernel_qvariant.cpp 1
QVariant can be extended to support other types than those
- mentioned in the \l Type enum. See the \l QMetaType documentation
+ mentioned in the \l Type enum. See \l{Creating Custom Qt Types}{Creating Custom Qt Types}
for details.
\section1 A Note on GUI Types
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index 448e6117b1..fda9f01643 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -108,12 +108,12 @@ QMimeType QMimeDatabasePrivate::mimeTypeForName(const QString &nameOrAlias)
return provider()->mimeTypeForName(provider()->resolveAlias(nameOrAlias));
}
-QStringList QMimeDatabasePrivate::mimeTypeForFileName(const QString &fileName, QString *foundSuffix)
+QStringList QMimeDatabasePrivate::mimeTypeForFileName(const QString &fileName)
{
if (fileName.endsWith(QLatin1Char('/')))
return QStringList() << QLatin1String("inode/directory");
- QStringList matchingMimeTypes = provider()->findByFileName(QFileInfo(fileName).fileName(), foundSuffix);
+ QStringList matchingMimeTypes = provider()->findByFileName(QFileInfo(fileName).fileName()).m_matchingMimeTypes;
matchingMimeTypes.sort(); // make it deterministic
return matchingMimeTypes;
}
@@ -168,13 +168,17 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
*accuracyPtr = 0;
// Pass 1) Try to match on the file name
- QStringList candidatesByName = mimeTypeForFileName(fileName);
- if (candidatesByName.count() == 1) {
+ QMimeGlobMatchResult candidatesByName;
+ if (fileName.endsWith(QLatin1Char('/')))
+ candidatesByName.addMatch(QLatin1String("inode/directory"), 100, QString());
+ else
+ candidatesByName = provider()->findByFileName(QFileInfo(fileName).fileName());
+ if (candidatesByName.m_allMatchingMimeTypes.count() == 1) {
*accuracyPtr = 100;
- const QMimeType mime = mimeTypeForName(candidatesByName.at(0));
+ const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0));
if (mime.isValid())
return mime;
- candidatesByName.clear();
+ candidatesByName = {};
}
// Extension is unknown, or matches multiple mimetypes.
@@ -193,7 +197,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
// "for glob_match in glob_matches:"
// "if glob_match is subclass or equal to sniffed_type, use glob_match"
const QString sniffedMime = candidateByData.name();
- for (const QString &m : qAsConst(candidatesByName)) {
+ for (const QString &m : qAsConst(candidatesByName.m_matchingMimeTypes)) {
if (inherits(m, sniffedMime)) {
// We have magic + pattern pointing to this, so it's a pretty good match
*accuracyPtr = 100;
@@ -205,9 +209,10 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
}
}
- if (candidatesByName.count() > 1) {
+ if (candidatesByName.m_allMatchingMimeTypes.count() > 1) {
+ candidatesByName.m_matchingMimeTypes.sort(); // make it deterministic
*accuracyPtr = 20;
- const QMimeType mime = mimeTypeForName(candidatesByName.at(0));
+ const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0));
if (mime.isValid())
return mime;
}
@@ -455,9 +460,7 @@ QList<QMimeType> QMimeDatabase::mimeTypesForFileName(const QString &fileName) co
QString QMimeDatabase::suffixForFileName(const QString &fileName) const
{
QMutexLocker locker(&d->mutex);
- QString foundSuffix;
- d->mimeTypeForFileName(fileName, &foundSuffix);
- return foundSuffix;
+ return d->provider()->findByFileName(QFileInfo(fileName).fileName()).m_foundSuffix;
}
/*!
diff --git a/src/corelib/mimetypes/qmimedatabase_p.h b/src/corelib/mimetypes/qmimedatabase_p.h
index 4ff5110a5b..3f63f5f103 100644
--- a/src/corelib/mimetypes/qmimedatabase_p.h
+++ b/src/corelib/mimetypes/qmimedatabase_p.h
@@ -90,7 +90,7 @@ public:
QMimeType mimeTypeForName(const QString &nameOrAlias);
QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device, int *priorityPtr);
QMimeType findByData(const QByteArray &data, int *priorityPtr);
- QStringList mimeTypeForFileName(const QString &fileName, QString *foundSuffix = 0);
+ QStringList mimeTypeForFileName(const QString &fileName);
mutable QMimeProviderBase *m_provider;
const QString m_defaultMimeType;
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp
index 568f9bf4de..a4d2b046fa 100644
--- a/src/corelib/mimetypes/qmimeglobpattern.cpp
+++ b/src/corelib/mimetypes/qmimeglobpattern.cpp
@@ -58,9 +58,13 @@ QT_BEGIN_NAMESPACE
void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const QString &pattern)
{
+ if (m_allMatchingMimeTypes.contains(mimeType))
+ return;
// Is this a lower-weight pattern than the last match? Skip this match then.
- if (weight < m_weight)
+ if (weight < m_weight) {
+ m_allMatchingMimeTypes.append(mimeType);
return;
+ }
bool replace = weight > m_weight;
if (!replace) {
// Compare the length of the match
@@ -79,6 +83,7 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q
}
if (!m_matchingMimeTypes.contains(mimeType)) {
m_matchingMimeTypes.append(mimeType);
+ m_allMatchingMimeTypes.append(mimeType);
if (pattern.startsWith(QLatin1String("*.")))
m_foundSuffix = pattern.mid(2);
}
@@ -201,35 +206,32 @@ void QMimeGlobPatternList::match(QMimeGlobMatchResult &result,
}
}
-QStringList QMimeAllGlobPatterns::matchingGlobs(const QString &fileName, QString *foundSuffix) const
+QMimeGlobMatchResult QMimeAllGlobPatterns::matchingGlobs(const QString &fileName) const
{
// First try the high weight matches (>50), if any.
QMimeGlobMatchResult result;
m_highWeightGlobs.match(result, fileName);
- if (result.m_matchingMimeTypes.isEmpty()) {
-
- // Now use the "fast patterns" dict, for simple *.foo patterns with weight 50
- // (which is most of them, so this optimization is definitely worth it)
- const int lastDot = fileName.lastIndexOf(QLatin1Char('.'));
- if (lastDot != -1) { // if no '.', skip the extension lookup
- const int ext_len = fileName.length() - lastDot - 1;
- const QString simpleExtension = fileName.right(ext_len).toLower();
- // (toLower because fast patterns are always case-insensitive and saved as lowercase)
-
- const QStringList matchingMimeTypes = m_fastPatterns.value(simpleExtension);
- const QString simplePattern = QLatin1String("*.") + simpleExtension;
- for (const QString &mime : matchingMimeTypes)
- result.addMatch(mime, 50, simplePattern);
- // Can't return yet; *.tar.bz2 has to win over *.bz2, so we need the low-weight mimetypes anyway,
- // at least those with weight 50.
- }
- // Finally, try the low weight matches (<=50)
- m_lowWeightGlobs.match(result, fileName);
+ // Now use the "fast patterns" dict, for simple *.foo patterns with weight 50
+ // (which is most of them, so this optimization is definitely worth it)
+ const int lastDot = fileName.lastIndexOf(QLatin1Char('.'));
+ if (lastDot != -1) { // if no '.', skip the extension lookup
+ const int ext_len = fileName.length() - lastDot - 1;
+ const QString simpleExtension = fileName.right(ext_len).toLower();
+ // (toLower because fast patterns are always case-insensitive and saved as lowercase)
+
+ const QStringList matchingMimeTypes = m_fastPatterns.value(simpleExtension);
+ const QString simplePattern = QLatin1String("*.") + simpleExtension;
+ for (const QString &mime : matchingMimeTypes)
+ result.addMatch(mime, 50, simplePattern);
+ // Can't return yet; *.tar.bz2 has to win over *.bz2, so we need the low-weight mimetypes anyway,
+ // at least those with weight 50.
}
- if (foundSuffix)
- *foundSuffix = result.m_foundSuffix;
- return result.m_matchingMimeTypes;
+
+ // Finally, try the low weight matches (<=50)
+ m_lowWeightGlobs.match(result, fileName);
+
+ return result;
}
void QMimeAllGlobPatterns::clear()
diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h
index 3e4fdb50f6..c8b70464fd 100644
--- a/src/corelib/mimetypes/qmimeglobpattern_p.h
+++ b/src/corelib/mimetypes/qmimeglobpattern_p.h
@@ -68,7 +68,8 @@ struct QMimeGlobMatchResult
void addMatch(const QString &mimeType, int weight, const QString &pattern);
- QStringList m_matchingMimeTypes;
+ QStringList m_matchingMimeTypes; // only those with highest weight
+ QStringList m_allMatchingMimeTypes;
int m_weight;
int m_matchingPatternLength;
QString m_foundSuffix;
@@ -153,7 +154,7 @@ public:
void addGlob(const QMimeGlobPattern &glob);
void removeMimeType(const QString &mimeType);
- QStringList matchingGlobs(const QString &fileName, QString *foundSuffix) const;
+ QMimeGlobMatchResult matchingGlobs(const QString &fileName) const;
void clear();
PatternsMap m_fastPatterns; // example: "doc" -> "application/msword", "text/plain"
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index 7e07f8acb9..5bbf1bba9d 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -161,7 +161,7 @@ bool QMimeMagicRule::matchNumber(const QByteArray &data) const
//qDebug() << "mask" << QString::number(m_numberMask, 16);
const char *p = data.constData() + m_startPos;
- const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), m_endPos + 1);
+ const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), m_endPos);
for ( ; p <= e; ++p) {
if ((qFromUnaligned<T>(p) & mask) == (value & mask))
return true;
@@ -299,20 +299,30 @@ QMimeMagicRule::QMimeMagicRule(const QString &type,
}
break;
case Big16:
- case Host16:
case Little16:
if (m_number <= quint16(-1)) {
m_number = m_type == Little16 ? qFromLittleEndian<quint16>(m_number) : qFromBigEndian<quint16>(m_number);
+ if (m_numberMask != 0)
+ m_numberMask = m_type == Little16 ? qFromLittleEndian<quint16>(m_numberMask) : qFromBigEndian<quint16>(m_numberMask);
+ }
+ Q_FALLTHROUGH();
+ case Host16:
+ if (m_number <= quint16(-1)) {
if (m_numberMask == 0)
m_numberMask = quint16(-1);
m_matchFunction = &QMimeMagicRule::matchNumber<quint16>;
}
break;
case Big32:
- case Host32:
case Little32:
if (m_number <= quint32(-1)) {
m_number = m_type == Little32 ? qFromLittleEndian<quint32>(m_number) : qFromBigEndian<quint32>(m_number);
+ if (m_numberMask != 0)
+ m_numberMask = m_type == Little32 ? qFromLittleEndian<quint32>(m_numberMask) : qFromBigEndian<quint32>(m_numberMask);
+ }
+ Q_FALLTHROUGH();
+ case Host32:
+ if (m_number <= quint32(-1)) {
if (m_numberMask == 0)
m_numberMask = quint32(-1);
m_matchFunction = &QMimeMagicRule::matchNumber<quint32>;
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index 65b011b439..959421bf52 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -287,13 +287,13 @@ QMimeType QMimeBinaryProvider::mimeTypeForName(const QString &name)
return mimeTypeForNameUnchecked(name);
}
-QStringList QMimeBinaryProvider::findByFileName(const QString &fileName, QString *foundSuffix)
+QMimeGlobMatchResult QMimeBinaryProvider::findByFileName(const QString &fileName)
{
checkCache();
+ QMimeGlobMatchResult result;
if (fileName.isEmpty())
- return QStringList();
+ return result;
const QString lowerFileName = fileName.toLower();
- QMimeGlobMatchResult result;
// TODO this parses in the order (local, global). Check that it handles "NOGLOBS" correctly.
for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
matchGlobList(result, cacheFile, cacheFile->getUint32(PosLiteralListOffset), fileName);
@@ -305,9 +305,7 @@ QStringList QMimeBinaryProvider::findByFileName(const QString &fileName, QString
if (result.m_matchingMimeTypes.isEmpty())
matchSuffixTree(result, cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true);
}
- if (foundSuffix)
- *foundSuffix = result.m_foundSuffix;
- return result.m_matchingMimeTypes;
+ return result;
}
void QMimeBinaryProvider::matchGlobList(QMimeGlobMatchResult &result, CacheFile *cacheFile, int off, const QString &fileName)
@@ -728,12 +726,11 @@ QMimeType QMimeXMLProvider::mimeTypeForName(const QString &name)
return m_nameMimeTypeMap.value(name);
}
-QStringList QMimeXMLProvider::findByFileName(const QString &fileName, QString *foundSuffix)
+QMimeGlobMatchResult QMimeXMLProvider::findByFileName(const QString &fileName)
{
ensureLoaded();
- const QStringList matchingMimeTypes = m_mimeTypeGlobs.matchingGlobs(fileName, foundSuffix);
- return matchingMimeTypes;
+ return m_mimeTypeGlobs.matchingGlobs(fileName);
}
QMimeType QMimeXMLProvider::findByMagic(const QByteArray &data, int *accuracyPtr)
diff --git a/src/corelib/mimetypes/qmimeprovider_p.h b/src/corelib/mimetypes/qmimeprovider_p.h
index e6fc47bf80..f410e62267 100644
--- a/src/corelib/mimetypes/qmimeprovider_p.h
+++ b/src/corelib/mimetypes/qmimeprovider_p.h
@@ -56,6 +56,7 @@
#ifndef QT_NO_MIMETYPE
+#include "qmimeglobpattern_p.h"
#include <QtCore/qdatetime.h>
#include <QtCore/qset.h>
#include <QtCore/qelapsedtimer.h>
@@ -72,7 +73,7 @@ public:
virtual bool isValid() = 0;
virtual QMimeType mimeTypeForName(const QString &name) = 0;
- virtual QStringList findByFileName(const QString &fileName, QString *foundSuffix) = 0;
+ virtual QMimeGlobMatchResult findByFileName(const QString &fileName) = 0;
virtual QStringList parents(const QString &mime) = 0;
virtual QString resolveAlias(const QString &name) = 0;
virtual QStringList listAliases(const QString &name) = 0;
@@ -99,7 +100,7 @@ public:
virtual bool isValid() Q_DECL_OVERRIDE;
virtual QMimeType mimeTypeForName(const QString &name) Q_DECL_OVERRIDE;
- virtual QStringList findByFileName(const QString &fileName, QString *foundSuffix) Q_DECL_OVERRIDE;
+ virtual QMimeGlobMatchResult findByFileName(const QString &fileName) Q_DECL_OVERRIDE;
virtual QStringList parents(const QString &mime) Q_DECL_OVERRIDE;
virtual QString resolveAlias(const QString &name) Q_DECL_OVERRIDE;
virtual QStringList listAliases(const QString &name) Q_DECL_OVERRIDE;
@@ -142,7 +143,7 @@ public:
virtual bool isValid() Q_DECL_OVERRIDE;
virtual QMimeType mimeTypeForName(const QString &name) Q_DECL_OVERRIDE;
- virtual QStringList findByFileName(const QString &fileName, QString *foundSuffix) Q_DECL_OVERRIDE;
+ virtual QMimeGlobMatchResult findByFileName(const QString &fileName) Q_DECL_OVERRIDE;
virtual QStringList parents(const QString &mime) Q_DECL_OVERRIDE;
virtual QString resolveAlias(const QString &name) Q_DECL_OVERRIDE;
virtual QStringList listAliases(const QString &name) Q_DECL_OVERRIDE;
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index c09dc6c22b..b8e18cc9a8 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -282,6 +282,7 @@ QObject *QFactoryLoader::instance(int index) const
return 0;
#ifndef QT_NO_LIBRARY
+ QMutexLocker lock(&d->mutex);
if (index < d->libraryList.size()) {
QLibraryPrivate *library = d->libraryList.at(index);
if (library->instance || library->loadPlugin()) {
@@ -297,6 +298,7 @@ QObject *QFactoryLoader::instance(int index) const
return 0;
}
index -= d->libraryList.size();
+ lock.unlock();
#endif
QVector<QStaticPlugin> staticPlugins = QPluginLoader::staticPlugins();
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index 410f642ca7..45786537e2 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -140,10 +140,10 @@ public:
static QThread* currentThread();
protected:
- QThread(QThreadPrivate &dd, QObject *parent = 0);
+ QThread(QThreadPrivate &dd, QObject *parent = nullptr);
private:
- explicit QThread(QObject *parent = 0);
+ explicit QThread(QObject *parent = nullptr);
static QThread *instance;
friend class QCoreApplication;
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 51f73c3368..fb7031ce71 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -589,15 +589,16 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NO
return __builtin_popcountll(v);
}
#elif defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM)
+#define QT_POPCOUNT_CONSTEXPR
#define QT_HAS_BUILTIN_CTZ
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val)
+Q_ALWAYS_INLINE unsigned long qt_builtin_ctz(quint32 val)
{
unsigned long result;
_BitScanForward(&result, val);
return result;
}
#define QT_HAS_BUILTIN_CLZ
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val)
+Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val)
{
unsigned long result;
_BitScanReverse(&result, val);
@@ -610,7 +611,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clz(quint32 val)
#if Q_PROCESSOR_WORDSIZE == 8
// These are only defined for 64bit builds.
#define QT_HAS_BUILTIN_CTZLL
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val)
+Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val)
{
unsigned long result;
_BitScanForward64(&result, val);
@@ -618,7 +619,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_ctzll(quint64 val)
}
// MSVC calls it _BitScanReverse and returns the carry flag, which we don't need
#define QT_HAS_BUILTIN_CLZLL
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val)
+Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val)
{
unsigned long result;
_BitScanReverse64(&result, val);
@@ -628,31 +629,31 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val)
}
#endif // MSVC 64bit
# define QT_HAS_BUILTIN_CTZS
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
+Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
{
return qt_builtin_ctz(v);
}
#define QT_HAS_BUILTIN_CLZS
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
+Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
{
return qt_builtin_clz(v) - 16U;
}
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
+Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
{
return __popcnt(v);
}
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
+Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
{
return __popcnt16(v);
}
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
+Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
{
return __popcnt16(v);
}
#if Q_PROCESSOR_WORDSIZE == 8
#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
-Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
+Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
{
return __popcnt64(v);
}
@@ -660,9 +661,13 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NO
#endif // MSVC
#endif // QT_HAS_CONSTEXPR_BUILTINS
+#ifndef QT_POPCOUNT_CONSTEXPR
+#define QT_POPCOUNT_CONSTEXPR Q_DECL_CONSTEXPR
+#endif
+
} //namespace QAlgorithmsPrivate
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW
+Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
return QAlgorithmsPrivate::qt_builtin_popcount(v);
@@ -675,7 +680,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q
#endif
}
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW
+Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
return QAlgorithmsPrivate::qt_builtin_popcount(v);
@@ -685,7 +690,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_
#endif
}
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW
+Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
return QAlgorithmsPrivate::qt_builtin_popcount(v);
@@ -696,7 +701,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q
#endif
}
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW
+Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNTLL
return QAlgorithmsPrivate::qt_builtin_popcountll(v);
@@ -711,7 +716,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint64 v) Q
#endif
}
-Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW
+Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW
{
return qPopulationCount(static_cast<quint64>(v));
}
@@ -719,6 +724,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(long unsigne
#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
#undef QALGORITHMS_USE_BUILTIN_POPCOUNT
#endif
+#undef QT_POPCOUNT_CONSTEXPR
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NOTHROW
{
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index fbbce00676..423ba0325a 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -55,7 +55,7 @@
#include <QtCore/private/qglobal_p.h>
#include "qcollator.h"
#include <QVector>
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
#include <unicode/ucol.h>
#elif defined(Q_OS_OSX)
#include <CoreServices/CoreServices.h>
@@ -65,7 +65,7 @@
QT_BEGIN_NAMESPACE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
typedef UCollator *CollatorType;
typedef QByteArray CollatorKeyType;
@@ -90,7 +90,7 @@ class Q_CORE_EXPORT QCollatorPrivate
public:
QAtomicInt ref;
QLocale locale;
-#if defined(Q_OS_WIN) && !defined(QT_USE_ICU)
+#if defined(Q_OS_WIN) && !QT_CONFIG(icu)
#ifdef USE_COMPARESTRINGEX
QString localeName;
#else
diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h
index 4dcae03ad9..276be042de 100644
--- a/src/corelib/tools/qcommandlineoption.h
+++ b/src/corelib/tools/qcommandlineoption.h
@@ -94,7 +94,7 @@ public:
void setFlags(Flags aflags);
#if QT_DEPRECATED_SINCE(5, 8)
- QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp)")
+ QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp")
void setHidden(bool hidden);
QT_DEPRECATED_X("Use flags() and HiddenFromHelp")
bool isHidden() const;
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 621c877174..ae429950c8 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -1216,15 +1216,15 @@ end:
} else {
if (context == FromString) {
// optimization
- Q_ASSERT(getMaximum().date().toJulianDay() == 4642999);
+ Q_ASSERT(maximum.date().toJulianDay() == 4642999);
if (newCurrentValue.date().toJulianDay() > 4642999)
state = Invalid;
} else {
- if (newCurrentValue > getMaximum())
+ if (newCurrentValue > maximum)
state = Invalid;
}
- QDTPDEBUG << "not checking intermediate because newCurrentValue is" << newCurrentValue << getMinimum() << getMaximum();
+ QDTPDEBUG << "not checking intermediate because newCurrentValue is" << newCurrentValue << minimum << maximum;
}
}
StateNode node;
@@ -1607,13 +1607,13 @@ bool QDateTimeParser::potentialValue(const QStringRef &str, int min, int max, in
bool QDateTimeParser::skipToNextSection(int index, const QDateTime &current, const QStringRef &text) const
{
- Q_ASSERT(current >= getMinimum() && current <= getMaximum());
-
const SectionNode &node = sectionNode(index);
Q_ASSERT(text.size() < sectionMaxSize(index));
const QDateTime maximum = getMaximum();
const QDateTime minimum = getMinimum();
+ Q_ASSERT(current >= minimum && current <= maximum);
+
QDateTime tmp = current;
int min = absoluteMin(index);
setDigit(tmp, index, min);
@@ -1713,11 +1713,21 @@ bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) con
QDateTime QDateTimeParser::getMinimum() const
{
+ // Cache the most common case
+ if (spec == Qt::LocalTime) {
+ static const QDateTime localTimeMin(QDATETIMEEDIT_DATE_MIN, QDATETIMEEDIT_TIME_MIN, Qt::LocalTime);
+ return localTimeMin;
+ }
return QDateTime(QDATETIMEEDIT_DATE_MIN, QDATETIMEEDIT_TIME_MIN, spec);
}
QDateTime QDateTimeParser::getMaximum() const
{
+ // Cache the most common case
+ if (spec == Qt::LocalTime) {
+ static const QDateTime localTimeMax(QDATETIMEEDIT_DATE_MAX, QDATETIMEEDIT_TIME_MAX, Qt::LocalTime);
+ return localTimeMax;
+ }
return QDateTime(QDATETIMEEDIT_DATE_MAX, QDATETIMEEDIT_TIME_MAX, spec);
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 847fc2d55e..5b53b8b338 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -334,33 +334,17 @@ QByteArray QLocalePrivate::bcp47Name(char separator) const
return localeId.withLikelySubtagsRemoved().name(separator);
}
-const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country)
+static const QLocaleData *findLocaleDataById(const QLocaleId &localeId)
{
- QLocaleId localeId = QLocaleId::fromIds(language, script, country);
- localeId = localeId.withLikelySubtagsAdded();
-
- uint idx = locale_index[localeId.language_id];
+ const uint idx = locale_index[localeId.language_id];
const QLocaleData *data = locale_data + idx;
- if (idx == 0) // default language has no associated country
+ if (idx == 0) // default language has no associated script or country
return data;
Q_ASSERT(data->m_language_id == localeId.language_id);
- if (localeId.script_id != QLocale::AnyScript && localeId.country_id != QLocale::AnyCountry) {
- // both script and country are explicitly specified
- do {
- if (data->m_script_id == localeId.script_id && data->m_country_id == localeId.country_id)
- return data;
- ++data;
- } while (data->m_language_id == localeId.language_id);
-
- // no match; try again with default script
- localeId.script_id = QLocale::AnyScript;
- data = locale_data + idx;
- }
-
if (localeId.script_id == QLocale::AnyScript && localeId.country_id == QLocale::AnyCountry)
return data;
@@ -369,15 +353,72 @@ const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLoca
if (data->m_country_id == localeId.country_id)
return data;
++data;
- } while (data->m_language_id == localeId.language_id);
+ } while (data->m_language_id && data->m_language_id == localeId.language_id);
} else if (localeId.country_id == QLocale::AnyCountry) {
do {
if (data->m_script_id == localeId.script_id)
return data;
++data;
- } while (data->m_language_id == localeId.language_id);
+ } while (data->m_language_id && data->m_language_id == localeId.language_id);
+ } else {
+ do {
+ if (data->m_script_id == localeId.script_id && data->m_country_id == localeId.country_id)
+ return data;
+ ++data;
+ } while (data->m_language_id && data->m_language_id == localeId.language_id);
+ }
+
+ return 0;
+}
+
+const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country)
+{
+ QLocaleId localeId = QLocaleId::fromIds(language, script, country);
+ localeId = localeId.withLikelySubtagsAdded();
+
+ const uint idx = locale_index[localeId.language_id];
+
+ // Try a straight match
+ if (const QLocaleData *const data = findLocaleDataById(localeId))
+ return data;
+ QList<QLocaleId> tried;
+ tried.push_back(localeId);
+
+ // No match; try again with likely country
+ localeId = QLocaleId::fromIds(language, script, QLocale::AnyCountry);
+ localeId = localeId.withLikelySubtagsAdded();
+ if (!tried.contains(localeId)) {
+ if (const QLocaleData *const data = findLocaleDataById(localeId))
+ return data;
+ tried.push_back(localeId);
}
+ // No match; try again with any country
+ localeId = QLocaleId::fromIds(language, script, QLocale::AnyCountry);
+ if (!tried.contains(localeId)) {
+ if (const QLocaleData *const data = findLocaleDataById(localeId))
+ return data;
+ tried.push_back(localeId);
+ }
+
+ // No match; try again with likely script
+ localeId = QLocaleId::fromIds(language, QLocale::AnyScript, country);
+ localeId = localeId.withLikelySubtagsAdded();
+ if (!tried.contains(localeId)) {
+ if (const QLocaleData *const data = findLocaleDataById(localeId))
+ return data;
+ tried.push_back(localeId);
+ }
+
+ // No match; try again with any script
+ localeId = QLocaleId::fromIds(language, QLocale::AnyScript, country);
+ if (!tried.contains(localeId)) {
+ if (const QLocaleData *const data = findLocaleDataById(localeId))
+ return data;
+ tried.push_back(localeId);
+ }
+
+ // No match; return data at original index
return locale_data + idx;
}
@@ -1305,8 +1346,8 @@ float QLocale::toFloat(const QString &s, bool *ok) const
If \a ok is not 0, reports failure by setting
*ok to false and success by setting *ok to true.
- Unlike QString::toDouble(), this function does not fall back to
- the "C" locale if the string cannot be interpreted in this
+ Unlike QString::toDouble(), this function does not use
+ the 'C' locale if the string cannot be interpreted in this
locale.
\snippet code/src_corelib_tools_qlocale.cpp 3
@@ -2431,7 +2472,7 @@ Qt::LayoutDirection QLocale::textDirection() const
*/
QString QLocale::toUpper(const QString &str) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
bool ok = true;
QString result = QIcu::toUpper(d->bcp47Name('_'), str, &ok);
if (ok)
@@ -2455,7 +2496,7 @@ QString QLocale::toUpper(const QString &str) const
*/
QString QLocale::toLower(const QString &str) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
bool ok = true;
const QString result = QIcu::toLower(d->bcp47Name('_'), str, &ok);
if (ok)
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index c83c9d3333..20eff8fd64 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -134,7 +134,7 @@ Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_MOVABLE_TYPE);
#endif
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
namespace QIcu {
QString toUpper(const QByteArray &localeId, const QString &str, bool *ok);
QString toLower(const QByteArray &localeId, const QString &str, bool *ok);
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index 406eb31923..94ed47f898 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -399,7 +399,9 @@ void QMapDataBase::freeData(QMapDataBase *d)
With QMap, the items are always sorted by key.
\li The key type of a QHash must provide operator==() and a global
qHash(Key) function. The key type of a QMap must provide
- operator<() specifying a total order.
+ operator<() specifying a total order. Since Qt 5.8.1 it is also safe
+ to use a pointer type as key, even if the underlying operator<()
+ does not provide a total order.
\endlist
Here's an example QMap with QString keys and \c int values:
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index 96ce787446..3f4f034b4e 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -51,6 +51,7 @@
#include <map>
#include <new>
+#include <functional>
#ifdef Q_COMPILER_INITIALIZER_LISTS
#include <initializer_list>
@@ -61,11 +62,8 @@ QT_BEGIN_NAMESPACE
/*
QMap uses qMapLessThanKey() to compare keys. The default
implementation uses operator<(). For pointer types,
- qMapLessThanKey() casts the pointers to integers before it
- compares them, because operator<() is undefined on pointers
- that come from different memory blocks. (In practice, this
- is only a problem when running a program such as
- BoundsChecker.)
+ qMapLessThanKey() uses std::less (because operator<() on
+ pointers can be used only between pointers in the same array).
*/
template <class Key> inline bool qMapLessThanKey(const Key &key1, const Key &key2)
@@ -75,8 +73,7 @@ template <class Key> inline bool qMapLessThanKey(const Key &key1, const Key &key
template <class Ptr> inline bool qMapLessThanKey(const Ptr *key1, const Ptr *key2)
{
- Q_STATIC_ASSERT(sizeof(quintptr) == sizeof(const Ptr *));
- return quintptr(key1) < quintptr(key2);
+ return std::less<const Ptr *>()(key1, key2);
}
struct QMapDataBase;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index eef375fe72..8888eced87 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -5575,7 +5575,7 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length());
}
-#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
+#if QT_CONFIG(icu) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
#endif
@@ -5621,7 +5621,7 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
CFRelease(thisString);
CFRelease(otherString);
return result;
-#elif defined(QT_USE_ICU)
+#elif QT_CONFIG(icu)
if (!defaultCollator()->hasLocalData())
defaultCollator()->setLocalData(QCollator());
return defaultCollator()->localData().compare(data1, length1, data2, length2);
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp
index e423d9af0c..359c2d0bdb 100644
--- a/src/corelib/tools/qtimezone.cpp
+++ b/src/corelib/tools/qtimezone.cpp
@@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE
static QTimeZonePrivate *newBackendTimeZone()
{
#ifdef QT_NO_SYSTEMLOCALE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
-#endif // QT_USE_ICU
+#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate();
@@ -69,7 +69,7 @@ static QTimeZonePrivate *newBackendTimeZone()
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate();
-#elif defined QT_USE_ICU
+#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate();
#else
return new QUtcTimeZonePrivate();
@@ -81,11 +81,11 @@ static QTimeZonePrivate *newBackendTimeZone()
static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
{
#ifdef QT_NO_SYSTEMLOCALE
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
-#endif // QT_USE_ICU
+#endif
#else
#if defined Q_OS_MAC
return new QMacTimeZonePrivate(ianaId);
@@ -96,7 +96,7 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
// Registry based timezone backend not available on WinRT
#elif defined Q_OS_WIN
return new QWinTimeZonePrivate(ianaId);
-#elif defined QT_USE_ICU
+#elif QT_CONFIG(icu)
return new QIcuTimeZonePrivate(ianaId);
#else
return new QUtcTimeZonePrivate(ianaId);
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index 56da197542..2ff03eddec 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -590,7 +590,7 @@ template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone()
}
/*
- UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and QT_USE_ICU not set,
+ UTC Offset implementation, used when QT_NO_SYSTEMLOCALE set and ICU is not being used,
or for QDateTimes with a Qt:Spec of Qt::OffsetFromUtc.
*/
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index d7fbb12344..d06784b0f9 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -56,9 +56,9 @@
#include "qlocale_p.h"
#include "qvector.h"
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
#include <unicode/ucal.h>
-#endif // QT_USE_ICU
+#endif
#ifdef Q_OS_MAC
#ifdef __OBJC__
@@ -227,7 +227,7 @@ private:
int m_offsetFromUtc;
};
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
{
public:
@@ -268,7 +268,7 @@ private:
UCalendar *m_ucal;
};
-#endif // QT_USE_ICU
+#endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_ANDROID
struct QTzTransitionTime
@@ -337,9 +337,9 @@ private:
QVector<QTzTransitionTime> m_tranTimes;
QVector<QTzTransitionRule> m_tranRules;
QList<QByteArray> m_abbreviations;
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
mutable QSharedDataPointer<QTimeZonePrivate> m_icu;
-#endif // QT_USE_ICU
+#endif
QByteArray m_posixRule;
};
#endif // Q_OS_UNIX
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 96d04df0e2..10b61c3a40 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -598,18 +598,18 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
// Create the system default time zone
QTzTimeZonePrivate::QTzTimeZonePrivate()
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
: m_icu(0)
-#endif // QT_USE_ICU
+#endif
{
init(systemTimeZoneId());
}
// Create a named time zone
QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
: m_icu(0)
-#endif // QT_USE_ICU
+#endif
{
init(ianaId);
}
@@ -617,9 +617,9 @@ QTzTimeZonePrivate::QTzTimeZonePrivate(const QByteArray &ianaId)
QTzTimeZonePrivate::QTzTimeZonePrivate(const QTzTimeZonePrivate &other)
: QTimeZonePrivate(other), m_tranTimes(other.m_tranTimes),
m_tranRules(other.m_tranRules), m_abbreviations(other.m_abbreviations),
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
m_icu(other.m_icu),
-#endif // QT_USE_ICU
+#endif
m_posixRule(other.m_posixRule)
{
}
@@ -778,7 +778,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@@ -788,7 +788,7 @@ QString QTzTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch,
#else
Q_UNUSED(nameType)
Q_UNUSED(locale)
-#endif // QT_USE_ICU
+#endif
return abbreviation(atMSecsSinceEpoch);
}
@@ -796,7 +796,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const
{
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
if (!m_icu)
m_icu = new QIcuTimeZonePrivate(m_id);
// TODO small risk may not match if tran times differ due to outdated files
@@ -807,7 +807,7 @@ QString QTzTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
Q_UNUSED(timeType)
Q_UNUSED(nameType)
Q_UNUSED(locale)
-#endif // QT_USE_ICU
+#endif
// If no ICU available then have to use abbreviations instead
// Abbreviations don't have GenericTime
if (timeType == QTimeZone::GenericTime)
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index c3ac104399..1530299303 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -76,7 +76,8 @@ public:
QVarLengthArray(std::initializer_list<T> args)
: a(Prealloc), s(0), ptr(reinterpret_cast<T *>(array))
{
- append(args.begin(), args.size());
+ if (args.size())
+ append(args.begin(), args.size());
}
#endif
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index fb80bbd6b8..fa8e07abbc 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -144,7 +144,6 @@ qtConfig(icu) {
SOURCES += tools/qlocale_icu.cpp \
tools/qcollator_icu.cpp
- DEFINES += QT_USE_ICU
} else: win32 {
SOURCES += tools/qcollator_win.cpp
} else: macx {
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index f95cc3a15d..da7557d7e8 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -69,6 +69,10 @@
QT_BEGIN_NAMESPACE
+#ifdef Q_OS_WIN
+static void preventDllUnload();
+#endif
+
Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager)
struct QDBusConnectionManager::ConnectionRequestData
@@ -139,6 +143,10 @@ QDBusConnectionManager::QDBusConnectionManager()
this, &QDBusConnectionManager::createServer, Qt::BlockingQueuedConnection);
moveToThread(this); // ugly, don't do this in other projects
+#ifdef Q_OS_WIN
+ // prevent the library from being unloaded on Windows. See comments in the function.
+ preventDllUnload();
+#endif
defaultBuses[0] = defaultBuses[1] = Q_NULLPTR;
start();
}
@@ -1262,4 +1270,31 @@ QByteArray QDBusConnection::localMachineId()
QT_END_NAMESPACE
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+static void preventDllUnload()
+{
+ // Thread termination is really wacky on Windows. For some reason we don't
+ // understand, exiting from the thread may try to unload the DLL. Since the
+ // QDBusConnectionManager thread runs until the DLL is unloaded, we've got
+ // a deadlock: the main thread is waiting for the manager thread to exit,
+ // but the manager thread is attempting to acquire a lock to unload the DLL.
+ //
+ // We work around the issue by preventing the unload from happening in the
+ // first place.
+ //
+ // For this trick, see
+ // https://blogs.msdn.microsoft.com/oldnewthing/20131105-00/?p=2733
+
+ static HMODULE self;
+ GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
+ GET_MODULE_HANDLE_EX_FLAG_PIN,
+ reinterpret_cast<const wchar_t *>(&self), // any address in this DLL
+ &self);
+}
+QT_END_NAMESPACE
+#endif
+
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index 786eab2120..da29894d15 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -77,7 +77,7 @@ namespace QDBusPendingReplyTypes {
typedef T1 Type;
};
- template<typename T1> inline int metaTypeFor(T1 * = 0)
+ template<typename T1> inline int metaTypeFor(T1 * = nullptr)
{ return qMetaTypeId<T1>(); }
// specialize for QVariant, allowing it to be used in place of QDBusVariant
template<> inline int metaTypeFor<QVariant>(QVariant *)
@@ -91,7 +91,7 @@ namespace QDBusPendingReplyTypes {
enum { Total = Next::Total + 1 };
static inline void fillMetaTypes(int *p)
{
- *p = metaTypeFor<T1>(0);
+ *p = metaTypeFor<T1>(nullptr);
Next::fillMetaTypes(++p);
}
};
diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h
index b6a454d240..227615024a 100644
--- a/src/dbus/qdbusreply.h
+++ b/src/dbus/qdbusreply.h
@@ -66,7 +66,7 @@ public:
}
inline QDBusReply& operator=(const QDBusMessage &reply)
{
- QVariant data(qMetaTypeId<Type>(), reinterpret_cast<void*>(0));
+ QVariant data(qMetaTypeId<Type>(), nullptr);
qDBusReplyFill(reply, m_error, data);
m_data = qvariant_cast<Type>(data);
return *this;
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index b67b8062ba..2ef8502ad5 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -125,7 +125,7 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
for (int i = 0; i < childCount(); ++i) {
QAccessibleInterface *childIface = child(i);
Q_ASSERT(childIface);
- if (childIface->rect().contains(x,y))
+ if (childIface->isValid() && childIface->rect().contains(x,y))
return childIface;
}
return 0;
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 1f5011617c..01566ad35b 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -7,7 +7,6 @@
"commandline": {
"options": {
- "android-style-assets": "boolean",
"angle": "boolean",
"direct2d": "boolean",
"directfb": "boolean",
@@ -323,7 +322,7 @@
"use": "egl xcb_xlib"
},
"egl-brcm": {
- "label": "Broadcom EGL (Rasberry Pi)",
+ "label": "Broadcom EGL (Raspberry Pi)",
"type": "compile",
"test": "qpa/eglfs-brcm",
"use": "egl bcm_host"
@@ -413,11 +412,6 @@
"condition": "features.accessibility && features.xcb && features.dbus",
"output": [ "privateFeature", "feature" ]
},
- "android-style-assets": {
- "label": "Android Style Assets",
- "condition": "config.android",
- "output": [ "privateFeature" ]
- },
"angle": {
"label": "ANGLE",
"autoDetect": "features.opengles2 || features.opengl-dynamic",
@@ -429,6 +423,7 @@
},
"directfb": {
"label": "DirectFB",
+ "section": "Platform plugins",
"autoDetect": false,
"condition": "libs.directfb",
"output": [ "privateFeature" ]
@@ -447,6 +442,7 @@
},
"direct2d": {
"label": "Direct 2D",
+ "section": "Platform plugins",
"condition": "config.win32 && !config.winrt && libs.direct2d",
"output": [ "privateFeature" ]
},
@@ -499,6 +495,7 @@
},
"integrityfb": {
"label": "INTEGRITY framebuffer",
+ "section": "Platform plugins",
"condition": "config.integrity",
"output": [ "privateFeature" ]
},
@@ -525,11 +522,13 @@
},
"linuxfb": {
"label": "LinuxFB",
+ "section": "Platform plugins",
"condition": "tests.linuxfb",
"output": [ "privateFeature" ]
},
"mirclient": {
"label": "Mir client",
+ "section": "Platform plugins",
"condition": "libs.mirclient",
"output": [ "privateFeature" ]
},
@@ -600,12 +599,13 @@
},
"eglfs": {
"label": "EGLFS",
+ "section": "Platform plugins",
"autoDetect": "!config.android && !config.win32",
"condition": "features.egl",
"output": [ "privateFeature" ]
},
"eglfs_brcm": {
- "label": "EGLFS Rasberry Pi",
+ "label": "EGLFS Raspberry Pi",
"condition": "features.eglfs && tests.egl-brcm",
"output": [ "privateFeature" ]
},
@@ -697,6 +697,7 @@
},
"xcb": {
"label": "XCB",
+ "section": "Platform plugins",
"autoDetect": "!config.darwin",
"condition": "libs.xcb",
"output": [ "privateFeature" ]
diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc
index 03b3cbfa24..945c485705 100644
--- a/src/gui/doc/src/dnd.qdoc
+++ b/src/gui/doc/src/dnd.qdoc
@@ -343,9 +343,7 @@
Applications can also communicate with each other by putting data on
the clipboard. To access this, you need to obtain a QClipboard object
- from the QApplication object:
-
- \snippet ../widgets/widgets/charactermap/mainwindow.cpp 3
+ from the QApplication object.
The QMimeData class is used to represent data that is transferred to and
from the clipboard. To put data on the clipboard, you can use the
diff --git a/src/gui/image/qimage_sse2.cpp b/src/gui/image/qimage_sse2.cpp
index 0fb92e9d43..8f7195e0b5 100644
--- a/src/gui/image/qimage_sse2.cpp
+++ b/src/gui/image/qimage_sse2.cpp
@@ -51,51 +51,66 @@ bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionF
{
Q_ASSERT(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_RGBA8888);
- // extra pixels on each line
- const int spare = data->width & 3;
- // width in pixels of the pad at the end of each line
- const int pad = (data->bytes_per_line >> 2) - data->width;
- const int iter = data->width >> 2;
- int height = data->height;
+ const int width = data->width;
+ const int height = data->height;
+ const int bpl = data->bytes_per_line;
const __m128i alphaMask = _mm_set1_epi32(0xff000000);
const __m128i nullVector = _mm_setzero_si128();
const __m128i half = _mm_set1_epi16(0x80);
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
- __m128i *d = reinterpret_cast<__m128i*>(data->data);
- while (height--) {
- const __m128i *end = d + iter;
-
- for (; d != end; ++d) {
- const __m128i srcVector = _mm_loadu_si128(d);
+ uchar *d = data->data;
+ for (int y = 0; y < height; ++y) {
+ int i = 0;
+ quint32 *d32 = reinterpret_cast<quint32 *>(d);
+ ALIGNMENT_PROLOGUE_16BYTES(d, i, width) {
+ const quint32 p = d32[i];
+ if (p <= 0x00ffffff)
+ d32[i] = 0;
+ else if (p < 0xff000000)
+ d32[i] = qPremultiply(p);
+ }
+ __m128i *d128 = reinterpret_cast<__m128i *>(d32 + i);
+ for (; i < (width - 3); i += 4) {
+ const __m128i srcVector = _mm_load_si128(d128);
+#ifdef __SSE4_1__
+ if (_mm_testc_si128(srcVector, alphaMask)) {
+ // opaque, data is unchanged
+ } else if (_mm_testz_si128(srcVector, alphaMask)) {
+ // fully transparent
+ _mm_store_si128(d128, nullVector);
+ } else {
+ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask);
+#else
const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask);
if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) {
// opaque, data is unchanged
} else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) == 0xffff) {
// fully transparent
- _mm_storeu_si128(d, nullVector);
+ _mm_store_si128(d128, nullVector);
} else {
+#endif
__m128i alphaChannel = _mm_srli_epi32(srcVector, 24);
alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16));
__m128i result;
BYTE_MUL_SSE2(result, srcVector, alphaChannel, colorMask, half);
result = _mm_or_si128(_mm_andnot_si128(alphaMask, result), srcVectorAlpha);
- _mm_storeu_si128(d, result);
+ _mm_store_si128(d128, result);
}
+ d128++;
}
- QRgb *p = reinterpret_cast<QRgb*>(d);
- QRgb *pe = p+spare;
- for (; p != pe; ++p) {
- if (*p < 0x00ffffff)
- *p = 0;
- else if (*p < 0xff000000)
- *p = qPremultiply(*p);
+ SIMD_EPILOGUE(i, width, 3) {
+ const quint32 p = d32[i];
+ if (p <= 0x00ffffff)
+ d32[i] = 0;
+ else if (p < 0xff000000)
+ d32[i] = qPremultiply(p);
}
- d = reinterpret_cast<__m128i*>(p+pad);
+ d += bpl;
}
if (data->format == QImage::Format_ARGB32)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 7beab72ab0..98cdecc444 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1914,7 +1914,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
- if (window->d_func()->blockedByModalWindow) {
+ if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
// a modal window is blocking this window, don't allow mouse events through
return;
}
@@ -2595,7 +2595,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
}
- if (w->d_func()->blockedByModalWindow) {
+ if (w->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
// a modal window is blocking this window, don't allow touch events through
// QTBUG-37371 temporary fix; TODO: revisit in 5.4 when we have a forwarding solution
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index e1a35e048c..0d62490c75 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -199,6 +199,7 @@ public:
static void hideModalWindow(QWindow *window);
static void updateBlockedStatus(QWindow *window);
virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const;
+ virtual bool popupActive() { return false; }
static Qt::MouseButtons buttons;
static ulong mousePressTime;
diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp
index f48e470d1b..6614d45b12 100644
--- a/src/gui/kernel/qplatformnativeinterface.cpp
+++ b/src/gui/kernel/qplatformnativeinterface.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qplatformnativeinterface.h"
+#include <QtGui/qcursor.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index bcd3e830dd..11432a4272 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -60,7 +60,7 @@ QPlatformWindow::QPlatformWindow(QWindow *window)
, d_ptr(new QPlatformWindowPrivate)
{
Q_D(QPlatformWindow);
- d->rect = window->geometry();
+ d->rect = QHighDpi::toNativePixels(window->geometry(), window);
}
/*!
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index a6ce04dc34..fc62273325 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -53,6 +53,8 @@
#include "qdir.h"
#include "qimagereader.h"
#include "qimagewriter.h"
+#include "qplatformscreen.h"
+#include "qplatformwindow.h"
#include <QtCore/QEventLoop>
#include <QtCore/QDebug>
@@ -316,6 +318,25 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
updateAction(action);
}
+
+static inline QPoint fromNativeGlobalPixels(const QPoint &point)
+{
+#ifndef QT_NO_HIGHDPISCALING
+ QPoint res = point;
+ if (QHighDpiScaling::isActive()) {
+ for (const QScreen *s : qAsConst(QGuiApplicationPrivate::screen_list)) {
+ if (s->handle()->geometry().contains(point)) {
+ res = QHighDpi::fromNativePixels(point, s);
+ break;
+ }
+ }
+ }
+ return res;
+#else
+ return point;
+#endif
+}
+
/*!
\class QSimpleDrag
\brief QSimpleDrag implements QBasicDrag for Drag and Drop operations within the Qt Application itself.
@@ -344,7 +365,7 @@ void QSimpleDrag::startDrag()
QBasicDrag::startDrag();
m_current_window = topLevelAt(QCursor::pos());
if (m_current_window) {
- QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_current_window, drag()->mimeData(), QCursor::pos(), drag()->supportedActions());
+ QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_current_window, drag()->mimeData(), QHighDpi::toNativePixels(QCursor::pos(), m_current_window), drag()->supportedActions());
setCanDrop(response.isAccepted());
updateCursor(response.acceptedAction());
} else {
@@ -363,15 +384,15 @@ void QSimpleDrag::cancel()
}
}
-void QSimpleDrag::move(const QPoint &globalPos)
+void QSimpleDrag::move(const QPoint &nativeGlobalPos)
{
- //### not high-DPI aware
+ QPoint globalPos = fromNativeGlobalPixels(nativeGlobalPos);
moveShapedPixmapWindow(globalPos);
QWindow *window = topLevelAt(globalPos);
if (!window)
return;
- const QPoint pos = globalPos - window->geometry().topLeft();
+ const QPoint pos = nativeGlobalPos - window->handle()->geometry().topLeft();
const QPlatformDragQtResponse qt_response =
QWindowSystemInterface::handleDrag(window, drag()->mimeData(), pos, drag()->supportedActions());
@@ -379,16 +400,16 @@ void QSimpleDrag::move(const QPoint &globalPos)
setCanDrop(qt_response.isAccepted());
}
-void QSimpleDrag::drop(const QPoint &globalPos)
+void QSimpleDrag::drop(const QPoint &nativeGlobalPos)
{
- //### not high-DPI aware
+ QPoint globalPos = fromNativeGlobalPixels(nativeGlobalPos);
- QBasicDrag::drop(globalPos);
+ QBasicDrag::drop(nativeGlobalPos);
QWindow *window = topLevelAt(globalPos);
if (!window)
return;
- const QPoint pos = globalPos - window->geometry().topLeft();
+ const QPoint pos = nativeGlobalPos - window->handle()->geometry().topLeft();
const QPlatformDropQtResponse response =
QWindowSystemInterface::handleDrop(window, drag()->mimeData(),pos, drag()->supportedActions());
if (response.isAccepted()) {
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 667304859e..8e86ce0b5c 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -924,6 +924,13 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QP
QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(w, timestamp, local * factor, global * factor, b, mods);
}
+// Wrapper for compatibility with Qt < 5.6
+// ### Qt6: Remove
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier)
+{
+ qt_handleMouseEvent(w, local, global, b, mods, QWindowSystemInterfacePrivate::eventTime.elapsed());
+}
+
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
{
QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(w, t, k, mods, text, autorep, count);
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 19540308a1..e143884f9d 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -867,9 +867,9 @@ inline QPointF operator*(const QPointF& point, const QMatrix4x4& matrix)
yin * matrix.m[3][1] +
matrix.m[3][3];
if (w == 1.0f) {
- return QPointF(float(x), float(y));
+ return QPointF(qreal(x), qreal(y));
} else {
- return QPointF(float(x / w), float(y / w));
+ return QPointF(qreal(x / w), qreal(y / w));
}
}
@@ -907,33 +907,35 @@ inline QPoint operator*(const QMatrix4x4& matrix, const QPoint& point)
inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
{
- float xin, yin;
- float x, y, w;
+ qreal xin, yin;
+ qreal x, y, w;
xin = point.x();
yin = point.y();
if (matrix.flagBits == QMatrix4x4::Identity) {
return point;
} else if (matrix.flagBits < QMatrix4x4::Rotation2D) {
// Translation | Scale
- return QPointF(xin * matrix.m[0][0] + matrix.m[3][0],
- yin * matrix.m[1][1] + matrix.m[3][1]);
+ return QPointF(xin * qreal(matrix.m[0][0]) + qreal(matrix.m[3][0]),
+ yin * qreal(matrix.m[1][1]) + qreal(matrix.m[3][1]));
} else if (matrix.flagBits < QMatrix4x4::Perspective) {
- return QPointF(xin * matrix.m[0][0] + yin * matrix.m[1][0] + matrix.m[3][0],
- xin * matrix.m[0][1] + yin * matrix.m[1][1] + matrix.m[3][1]);
+ return QPointF(xin * qreal(matrix.m[0][0]) + yin * qreal(matrix.m[1][0]) +
+ qreal(matrix.m[3][0]),
+ xin * qreal(matrix.m[0][1]) + yin * qreal(matrix.m[1][1]) +
+ qreal(matrix.m[3][1]));
} else {
- x = xin * matrix.m[0][0] +
- yin * matrix.m[1][0] +
- matrix.m[3][0];
- y = xin * matrix.m[0][1] +
- yin * matrix.m[1][1] +
- matrix.m[3][1];
- w = xin * matrix.m[0][3] +
- yin * matrix.m[1][3] +
- matrix.m[3][3];
- if (w == 1.0f) {
- return QPointF(float(x), float(y));
+ x = xin * qreal(matrix.m[0][0]) +
+ yin * qreal(matrix.m[1][0]) +
+ qreal(matrix.m[3][0]);
+ y = xin * qreal(matrix.m[0][1]) +
+ yin * qreal(matrix.m[1][1]) +
+ qreal(matrix.m[3][1]);
+ w = xin * qreal(matrix.m[0][3]) +
+ yin * qreal(matrix.m[1][3]) +
+ qreal(matrix.m[3][3]);
+ if (w == 1.0) {
+ return QPointF(qreal(x), qreal(y));
} else {
- return QPointF(float(x / w), float(y / w));
+ return QPointF(qreal(x / w), qreal(y / w));
}
}
}
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 21b051e08e..808e0ee6d7 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -202,7 +202,8 @@ inline QQuaternion QQuaternion::inverted() const
double(yp) * double(yp) +
double(zp) * double(zp);
if (!qFuzzyIsNull(len))
- return QQuaternion(wp / len, -xp / len, -yp / len, -zp / len);
+ return QQuaternion(double(wp) / len, double(-xp) / len,
+ double(-yp) / len, double(-zp) / len);
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
}
@@ -251,7 +252,7 @@ inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
float xx = ww + yy + zz;
- float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
+ float qq = 0.5f * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
float w = qq - ww + (q1.zp - q1.yp) * (q2.yp - q2.zp);
float x = qq - xx + (q1.xp + q1.wp) * (q2.xp + q2.wp);
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 0a46eea85d..c9b08f60b1 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -410,6 +410,34 @@ static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat)
case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2:
case QOpenGLTexture::RGBA8_ETC2_EAC:
case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
+ case QOpenGLTexture::RGBA_ASTC_4x4:
+ case QOpenGLTexture::RGBA_ASTC_5x4:
+ case QOpenGLTexture::RGBA_ASTC_5x5:
+ case QOpenGLTexture::RGBA_ASTC_6x5:
+ case QOpenGLTexture::RGBA_ASTC_6x6:
+ case QOpenGLTexture::RGBA_ASTC_8x5:
+ case QOpenGLTexture::RGBA_ASTC_8x6:
+ case QOpenGLTexture::RGBA_ASTC_8x8:
+ case QOpenGLTexture::RGBA_ASTC_10x5:
+ case QOpenGLTexture::RGBA_ASTC_10x6:
+ case QOpenGLTexture::RGBA_ASTC_10x8:
+ case QOpenGLTexture::RGBA_ASTC_10x10:
+ case QOpenGLTexture::RGBA_ASTC_12x10:
+ case QOpenGLTexture::RGBA_ASTC_12x12:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
return true;
case QOpenGLTexture::RGB8_ETC1:
@@ -703,6 +731,36 @@ static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpen
case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
return QOpenGLTexture::RGBA;
+ case QOpenGLTexture::RGBA_ASTC_4x4:
+ case QOpenGLTexture::RGBA_ASTC_5x4:
+ case QOpenGLTexture::RGBA_ASTC_5x5:
+ case QOpenGLTexture::RGBA_ASTC_6x5:
+ case QOpenGLTexture::RGBA_ASTC_6x6:
+ case QOpenGLTexture::RGBA_ASTC_8x5:
+ case QOpenGLTexture::RGBA_ASTC_8x6:
+ case QOpenGLTexture::RGBA_ASTC_8x8:
+ case QOpenGLTexture::RGBA_ASTC_10x5:
+ case QOpenGLTexture::RGBA_ASTC_10x6:
+ case QOpenGLTexture::RGBA_ASTC_10x8:
+ case QOpenGLTexture::RGBA_ASTC_10x10:
+ case QOpenGLTexture::RGBA_ASTC_12x10:
+ case QOpenGLTexture::RGBA_ASTC_12x12:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
+ return QOpenGLTexture::RGBA;
+
case QOpenGLTexture::DepthFormat:
return QOpenGLTexture::Depth;
@@ -859,6 +917,34 @@ static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTe
case QOpenGLTexture::RGBA8_ETC2_EAC:
case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
case QOpenGLTexture::RGB8_ETC1:
+ case QOpenGLTexture::RGBA_ASTC_4x4:
+ case QOpenGLTexture::RGBA_ASTC_5x4:
+ case QOpenGLTexture::RGBA_ASTC_5x5:
+ case QOpenGLTexture::RGBA_ASTC_6x5:
+ case QOpenGLTexture::RGBA_ASTC_6x6:
+ case QOpenGLTexture::RGBA_ASTC_8x5:
+ case QOpenGLTexture::RGBA_ASTC_8x6:
+ case QOpenGLTexture::RGBA_ASTC_8x8:
+ case QOpenGLTexture::RGBA_ASTC_10x5:
+ case QOpenGLTexture::RGBA_ASTC_10x6:
+ case QOpenGLTexture::RGBA_ASTC_10x8:
+ case QOpenGLTexture::RGBA_ASTC_10x10:
+ case QOpenGLTexture::RGBA_ASTC_12x10:
+ case QOpenGLTexture::RGBA_ASTC_12x12:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
return QOpenGLTexture::UInt8;
case QOpenGLTexture::DepthFormat:
@@ -977,6 +1063,34 @@ static bool isCompressedFormat(QOpenGLTexture::TextureFormat internalFormat)
case QOpenGLTexture::RGBA8_ETC2_EAC:
case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC:
case QOpenGLTexture::RGB8_ETC1:
+ case QOpenGLTexture::RGBA_ASTC_4x4:
+ case QOpenGLTexture::RGBA_ASTC_5x4:
+ case QOpenGLTexture::RGBA_ASTC_5x5:
+ case QOpenGLTexture::RGBA_ASTC_6x5:
+ case QOpenGLTexture::RGBA_ASTC_6x6:
+ case QOpenGLTexture::RGBA_ASTC_8x5:
+ case QOpenGLTexture::RGBA_ASTC_8x6:
+ case QOpenGLTexture::RGBA_ASTC_8x8:
+ case QOpenGLTexture::RGBA_ASTC_10x5:
+ case QOpenGLTexture::RGBA_ASTC_10x6:
+ case QOpenGLTexture::RGBA_ASTC_10x8:
+ case QOpenGLTexture::RGBA_ASTC_10x10:
+ case QOpenGLTexture::RGBA_ASTC_12x10:
+ case QOpenGLTexture::RGBA_ASTC_12x12:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
return true;
case QOpenGLTexture::DepthFormat:
@@ -2037,6 +2151,34 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target
\value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC
\value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
\value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES
+ \value RGBA_ASTC_4x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_4x4_KHR
+ \value RGBA_ASTC_5x4 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x4_KHR
+ \value RGBA_ASTC_5x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_5x5_KHR
+ \value RGBA_ASTC_6x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x5_KHR
+ \value RGBA_ASTC_6x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_6x6_KHR
+ \value RGBA_ASTC_8x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x5_KHR
+ \value RGBA_ASTC_8x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x6_KHR
+ \value RGBA_ASTC_8x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_8x8_KHR
+ \value RGBA_ASTC_10x5 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x5_KHR
+ \value RGBA_ASTC_10x6 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x6_KHR
+ \value RGBA_ASTC_10x8 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x8_KHR
+ \value RGBA_ASTC_10x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_10x10_KHR
+ \value RGBA_ASTC_12x10 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x10_KHR
+ \value RGBA_ASTC_12x12 Equivalent to GL_COMPRESSED_RGBA_ASTC_12x12_KHR
+ \value SRGB8_Alpha8_ASTC_4x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
+ \value SRGB8_Alpha8_ASTC_5x4 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
+ \value SRGB8_Alpha8_ASTC_5x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
+ \value SRGB8_Alpha8_ASTC_6x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
+ \value SRGB8_Alpha8_ASTC_6x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
+ \value SRGB8_Alpha8_ASTC_8x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
+ \value SRGB8_Alpha8_ASTC_8x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
+ \value SRGB8_Alpha8_ASTC_8x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
+ \value SRGB8_Alpha8_ASTC_10x5 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
+ \value SRGB8_Alpha8_ASTC_10x6 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
+ \value SRGB8_Alpha8_ASTC_10x8 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
+ \value SRGB8_Alpha8_ASTC_10x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
+ \value SRGB8_Alpha8_ASTC_12x10 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
+ \value SRGB8_Alpha8_ASTC_12x12 Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
\value SRGB8 Equivalent to GL_SRGB8
\value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8
@@ -2592,6 +2734,34 @@ void QOpenGLTexture::setFormat(TextureFormat format)
case RGBAFormat:
case LuminanceFormat:
case LuminanceAlphaFormat:
+ case QOpenGLTexture::RGBA_ASTC_4x4:
+ case QOpenGLTexture::RGBA_ASTC_5x4:
+ case QOpenGLTexture::RGBA_ASTC_5x5:
+ case QOpenGLTexture::RGBA_ASTC_6x5:
+ case QOpenGLTexture::RGBA_ASTC_6x6:
+ case QOpenGLTexture::RGBA_ASTC_8x5:
+ case QOpenGLTexture::RGBA_ASTC_8x6:
+ case QOpenGLTexture::RGBA_ASTC_8x8:
+ case QOpenGLTexture::RGBA_ASTC_10x5:
+ case QOpenGLTexture::RGBA_ASTC_10x6:
+ case QOpenGLTexture::RGBA_ASTC_10x8:
+ case QOpenGLTexture::RGBA_ASTC_10x10:
+ case QOpenGLTexture::RGBA_ASTC_12x10:
+ case QOpenGLTexture::RGBA_ASTC_12x12:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_4x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x4:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_5x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_6x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_8x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x5:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x6:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x8:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_10x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x10:
+ case QOpenGLTexture::SRGB8_Alpha8_ASTC_12x12:
d->formatClass = FormatClass_Unique;
break;
}
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index 0a948488a6..d0a3bfec8b 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -208,6 +208,34 @@ public:
RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC
SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
RGB8_ETC1 = 0x8D64, // GL_ETC1_RGB8_OES
+ RGBA_ASTC_4x4 = 0x93B0, // GL_COMPRESSED_RGBA_ASTC_4x4_KHR
+ RGBA_ASTC_5x4 = 0x93B1, // GL_COMPRESSED_RGBA_ASTC_5x4_KHR
+ RGBA_ASTC_5x5 = 0x93B2, // GL_COMPRESSED_RGBA_ASTC_5x5_KHR
+ RGBA_ASTC_6x5 = 0x93B3, // GL_COMPRESSED_RGBA_ASTC_6x5_KHR
+ RGBA_ASTC_6x6 = 0x93B4, // GL_COMPRESSED_RGBA_ASTC_6x6_KHR
+ RGBA_ASTC_8x5 = 0x93B5, // GL_COMPRESSED_RGBA_ASTC_8x5_KHR
+ RGBA_ASTC_8x6 = 0x93B6, // GL_COMPRESSED_RGBA_ASTC_8x6_KHR
+ RGBA_ASTC_8x8 = 0x93B7, // GL_COMPRESSED_RGBA_ASTC_8x8_KHR
+ RGBA_ASTC_10x5 = 0x93B8, // GL_COMPRESSED_RGBA_ASTC_10x5_KHR
+ RGBA_ASTC_10x6 = 0x93B9, // GL_COMPRESSED_RGBA_ASTC_10x6_KHR
+ RGBA_ASTC_10x8 = 0x93BA, // GL_COMPRESSED_RGBA_ASTC_10x8_KHR
+ RGBA_ASTC_10x10 = 0x93BB, // GL_COMPRESSED_RGBA_ASTC_10x10_KHR
+ RGBA_ASTC_12x10 = 0x93BC, // GL_COMPRESSED_RGBA_ASTC_12x10_KHR
+ RGBA_ASTC_12x12 = 0x93BD, // GL_COMPRESSED_RGBA_ASTC_12x12_KHR
+ SRGB8_Alpha8_ASTC_4x4 = 0x93D0, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR
+ SRGB8_Alpha8_ASTC_5x4 = 0x93D1, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR
+ SRGB8_Alpha8_ASTC_5x5 = 0x93D2, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR
+ SRGB8_Alpha8_ASTC_6x5 = 0x93D3, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR
+ SRGB8_Alpha8_ASTC_6x6 = 0x93D4, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR
+ SRGB8_Alpha8_ASTC_8x5 = 0x93D5, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR
+ SRGB8_Alpha8_ASTC_8x6 = 0x93D6, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR
+ SRGB8_Alpha8_ASTC_8x8 = 0x93D7, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR
+ SRGB8_Alpha8_ASTC_10x5 = 0x93D8, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR
+ SRGB8_Alpha8_ASTC_10x6 = 0x93D9, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR
+ SRGB8_Alpha8_ASTC_10x8 = 0x93DA, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR
+ SRGB8_Alpha8_ASTC_10x10 = 0x93DB, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR
+ SRGB8_Alpha8_ASTC_12x10 = 0x93DC, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR
+ SRGB8_Alpha8_ASTC_12x12 = 0x93DD, // GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
// sRGB formats
SRGB8 = 0x8C41, // GL_SRGB8
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 54df2e5734..a3d3bb6bd1 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -74,15 +74,21 @@ QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage()
QOpenGLVersionFunctionsStorage::~QOpenGLVersionFunctionsStorage()
{
+#ifndef QT_OPENGL_ES
if (backends) {
- for (int i = 0; i < QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount; ++i) {
- if (backends[i] && !--backends[i]->refs) {
- // deleting the base class is ok, as the derived classes don't have a destructor
- delete backends[i];
- }
- }
+
+ int i = 0;
+
+#define DELETE_BACKEND(X) \
+ if (backends[i] && !--backends[i]->refs) \
+ delete static_cast<QOpenGLFunctions_##X##Backend*>(backends[i]); \
+ ++i;
+
+ QT_OPENGL_VERSIONS(DELETE_BACKEND)
+#undef DELETE_BACKEND
delete[] backends;
}
+#endif
}
QOpenGLVersionFunctionsBackend *QOpenGLVersionFunctionsStorage::backend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 0a5d458532..a4a091a29f 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -385,19 +385,25 @@ void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
fflush(stdout);
#endif
-
- if (const_alpha != 256) {
- qt_blend_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
- return;
- }
-
const uint *src = (const uint *) srcPixels;
uint *dst = (uint *) destPixels;
- int len = w * 4;
- for (int y=0; y<h; ++y) {
- memcpy(dst, src, len);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
+ if (const_alpha == 256) {
+ const int len = w * 4;
+ for (int y = 0; y < h; ++y) {
+ memcpy(dst, src, len);
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
+ return;
+ } else if (const_alpha != 0) {
+ const_alpha = (const_alpha * 255) >> 8;
+ int ialpha = 255 - const_alpha;
+ for (int y=0; y<h; ++y) {
+ for (int x=0; x<w; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(dst[x], ialpha, src[x], const_alpha);
+ dst = (quint32 *)(((uchar *) dst) + dbpl);
+ src = (const quint32 *)(((const uchar *) src) + sbpl);
+ }
}
}
@@ -414,7 +420,7 @@ struct Blend_RGB32_on_RGB32_ConstAlpha {
}
inline void write(quint32 *dst, quint32 src) {
- *dst = BYTE_MUL(src, m_alpha) + BYTE_MUL(*dst, m_ialpha);
+ *dst = INTERPOLATE_PIXEL_255(src, m_alpha, *dst, m_ialpha);
}
inline void flush(void *) {}
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 6a8091bf8b..9e1785c11d 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -545,12 +545,8 @@ static QStringList get_colornames()
\section1 The HSL Color Model
- HSL is similar to HSV. Instead of value parameter from HSV,
- HSL has the lightness parameter.
- The lightness parameter goes from black to color and from color to white.
- If you go outside at the night its black or dark gray. At day its colorful but
- if you look in a really strong light a things they are going to white and
- wash out.
+ HSL is similar to HSV, however instead of the Value parameter, HSL
+ specifies a Lightness parameter.
\section1 The CMYK Color Model
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 77b5be0c4c..7cac2ac358 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -65,10 +65,12 @@ public:
QDataBuffer(int res)
{
capacity = res;
- if (res)
+ if (res) {
buffer = (Type*) malloc(capacity * sizeof(Type));
- else
+ Q_CHECK_PTR(buffer);
+ } else {
buffer = 0;
+ }
siz = 0;
}
@@ -115,14 +117,16 @@ public:
while (capacity < size)
capacity *= 2;
buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
+ Q_CHECK_PTR(buffer);
}
}
inline void shrink(int size) {
capacity = size;
- if (size)
+ if (size) {
buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
- else {
+ Q_CHECK_PTR(buffer);
+ } else {
free(buffer);
buffer = 0;
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index e1875d84b9..adc28f07d3 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -217,8 +217,8 @@ static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *sr
uint green = (src[i] >> greenShift<Format>()) & greenMask;
uint blue = (src[i] >> blueShift<Format>()) & blueMask;
- red = ((red << redLeftShift) | (red >> redRightShift)) << 16;
- green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8;
+ red = ((red << redLeftShift) | (red >> redRightShift));
+ green = ((green << greenLeftShift) | (green >> greenRightShift));
blue = (blue << blueLeftShift) | (blue >> blueRightShift);
buffer[i] = QRgba64::fromRgba(red, green, blue, 255);
}
@@ -580,6 +580,8 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *
int i = 0;
for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) {
uint s = *src++;
+ if (maskAlpha)
+ s = s | 0xff000000;
if (RGBA)
s = RGBA2ARGB(s);
*buffer++ = QRgba64::fromArgb32(s);
@@ -605,6 +607,8 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *
SIMD_EPILOGUE(i, count, 3) {
uint s = *src++;
+ if (maskAlpha)
+ s = s | 0xff000000;
if (RGBA)
s = RGBA2ARGB(s);
*buffer++ = QRgba64::fromArgb32(s);
@@ -839,6 +843,7 @@ template <QPixelLayout::BPP bpp> static
uint QT_FASTCALL fetchPixel(const uchar *, int)
{
Q_UNREACHABLE();
+ return 0;
}
template <>
@@ -1562,8 +1567,12 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
int y, int x, int length)
{
Q_STATIC_ASSERT(blendType == BlendTransformed || blendType == BlendTransformedTiled);
- int image_width = data->texture.width;
- int image_height = data->texture.height;
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
+ const int image_x1 = data->texture.x1;
+ const int image_y1 = data->texture.y1;
+ const int image_x2 = data->texture.x2 - 1;
+ const int image_y2 = data->texture.y2 - 1;
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
@@ -1596,8 +1605,8 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
if (px < 0) px += image_width;
if (py < 0) py += image_height;
} else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
+ px = qBound(image_x1, px, image_x2);
+ py = qBound(image_y1, py, image_y2);
}
*b = fetch(data->texture.scanLine(py), px);
@@ -1627,8 +1636,8 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
if (px < 0) px += image_width;
if (py < 0) py += image_height;
} else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
+ px = qBound(image_x1, px, image_x2);
+ py = qBound(image_y1, py, image_y2);
}
*b = fetch(data->texture.scanLine(py), px);
@@ -1649,8 +1658,12 @@ template<TextureBlendType blendType> /* either BlendTransformed or BlendTransfo
static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Operator *, const QSpanData *data,
int y, int x, int length)
{
- int image_width = data->texture.width;
- int image_height = data->texture.height;
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
+ const int image_x1 = data->texture.x1;
+ const int image_y1 = data->texture.y1;
+ const int image_x2 = data->texture.x2 - 1;
+ const int image_y2 = data->texture.y2 - 1;
const qreal cx = x + qreal(0.5);
const qreal cy = y + qreal(0.5);
@@ -1687,8 +1700,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
if (px < 0) px += image_width;
if (py < 0) py += image_height;
} else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
+ px = qBound(image_x1, px, image_x2);
+ py = qBound(image_y1, py, image_y2);
}
buffer32[j] = fetch(data->texture.scanLine(py), px);
@@ -1728,8 +1741,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
if (px < 0) px += image_width;
if (py < 0) py += image_height;
} else {
- px = qBound(0, px, image_width - 1);
- py = qBound(0, py, image_height - 1);
+ px = qBound(image_x1, px, image_x2);
+ py = qBound(image_y1, py, image_y2);
}
buffer32[j] = fetch(data->texture.scanLine(py), px);
@@ -2231,7 +2244,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
}
}
} else { //rotation
- if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
+ if (std::abs(data->m11) < (1./8.) || std::abs(data->m22) < (1./8.)) {
//if we are zooming more than 8 times, we use 8bit precision for the position.
while (b < end) {
int x1 = (fx >> 16);
@@ -2717,7 +2730,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
- if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
+ if (std::abs(data->m11) < (1./8.) || std::abs(data->m22) < (1./8.)) {
//if we are zooming more than 8 times, we use 8bit precision for the position.
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff) >> 8;
@@ -2857,8 +2870,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint sbuf1[buffer_size];
uint sbuf2[buffer_size];
- QRgba64 buf1[buffer_size];
- QRgba64 buf2[buffer_size];
+ quint64 buf1[buffer_size];
+ quint64 buf2[buffer_size];
QRgba64 *b = buffer;
while (length) {
int len = qMin(length, buffer_size / 2);
@@ -2934,9 +2947,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf1, sbuf1, len * 2, clut, 0);
if (disty)
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
@@ -2954,7 +2967,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
vt = _mm_add_epi16(vt, _mm_srli_si128(vt, 8));
_mm_storel_epi64((__m128i*)(b+i), vt);
#else
- b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ b[i] = interpolate_4_pixels_rgb64((QRgba64 *)buf1 + i*2, (QRgba64 *)buf2 + i*2, distx, disty);
#endif
fracX += fdx;
}
@@ -2965,8 +2978,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint sbuf1[buffer_size];
uint sbuf2[buffer_size];
- QRgba64 buf1[buffer_size];
- QRgba64 buf2[buffer_size];
+ quint64 buf1[buffer_size];
+ quint64 buf2[buffer_size];
QRgba64 *end = buffer + length;
QRgba64 *b = buffer;
@@ -3074,13 +3087,13 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
int disty = (fracY & 0x0000ffff);
- b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ b[i] = interpolate_4_pixels_rgb64((QRgba64 *)buf1 + i*2, (QRgba64 *)buf2 + i*2, distx, disty);
fracX += fdx;
fracY += fdy;
}
@@ -3097,8 +3110,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint sbuf1[buffer_size];
uint sbuf2[buffer_size];
- QRgba64 buf1[buffer_size];
- QRgba64 buf2[buffer_size];
+ quint64 buf1[buffer_size];
+ quint64 buf2[buffer_size];
QRgba64 *b = buffer;
int distxs[buffer_size / 2];
@@ -3146,13 +3159,13 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fw += fdw;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
int disty = distys[i];
- b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ b[i] = interpolate_4_pixels_rgb64((QRgba64 *)buf1 + i*2, (QRgba64 *)buf2 + i*2, distx, disty);
}
length -= len;
@@ -3699,7 +3712,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData)
return blend_color_generic(count, spans, userData);
}
- QRgba64 buffer[buffer_size];
+ quint64 buffer[buffer_size];
const QRgba64 color = data->solid.color;
while (count--) {
@@ -3707,7 +3720,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData)
int length = spans->len;
while (length) {
int l = qMin(buffer_size, length);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
+ QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l);
op.funcSolid64(dest, l, color, spans->coverage);
op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
length -= l;
@@ -3888,11 +3901,11 @@ public:
}
};
-class BlendSrcGenericRGB64 : public QBlendBase<QRgba64>
+class BlendSrcGenericRGB64 : public QBlendBase<quint64>
{
public:
BlendSrcGenericRGB64(QSpanData *d, const Operator &o)
- : QBlendBase<QRgba64>(d, o)
+ : QBlendBase<quint64>(d, o)
{
}
@@ -3901,20 +3914,20 @@ public:
return op.func64 && op.destFetch64 && op.destStore64;
}
- const QRgba64 *fetch(int x, int y, int len)
+ const quint64 *fetch(int x, int y, int len)
{
- dest = op.destFetch64(buffer, data->rasterBuffer, x, y, len);
- return op.srcFetch64(src_buffer, &op, data, y, x, len);
+ dest = (quint64 *)op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, y, len);
+ return (const quint64 *)op.srcFetch64((QRgba64 *)src_buffer, &op, data, y, x, len);
}
- void process(int, int, int len, int coverage, const QRgba64 *src, int offset)
+ void process(int, int, int len, int coverage, const quint64 *src, int offset)
{
- op.func64(dest + offset, src + offset, len, coverage);
+ op.func64((QRgba64 *)dest + offset, (const QRgba64 *)src + offset, len, coverage);
}
void store(int x, int y, int len)
{
- op.destStore64(data->rasterBuffer, x, y, dest, len);
+ op.destStore64(data->rasterBuffer, x, y, (QRgba64 *)dest, len);
}
};
@@ -3993,8 +4006,8 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi
qWarning("Unsupported blend");
return blend_untransformed_generic(count, spans, userData);
}
- QRgba64 buffer[buffer_size];
- QRgba64 src_buffer[buffer_size];
+ quint64 buffer[buffer_size];
+ quint64 src_buffer[buffer_size];
const int image_width = data->texture.width;
const int image_height = data->texture.height;
@@ -4018,8 +4031,8 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi
const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
while (length) {
int l = qMin(buffer_size, length);
- const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
+ const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l);
+ QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l);
op.func64(dest, src, l, coverage);
op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
x += l;
@@ -4234,8 +4247,8 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD
qDebug("unsupported rgb64 blend");
return blend_tiled_generic(count, spans, userData);
}
- QRgba64 buffer[buffer_size];
- QRgba64 src_buffer[buffer_size];
+ quint64 buffer[buffer_size];
+ quint64 src_buffer[buffer_size];
const int image_width = data->texture.width;
const int image_height = data->texture.height;
@@ -4262,8 +4275,8 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD
int l = qMin(image_width - sx, length);
if (buffer_size < l)
l = buffer_size;
- const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
+ const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l);
+ QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l);
op.func64(dest, src, l, coverage);
op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
x += l;
@@ -4628,8 +4641,10 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData
CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
uint buffer[buffer_size];
- int image_width = data->texture.width;
- int image_height = data->texture.height;
+ const int image_x1 = data->texture.x1;
+ const int image_y1 = data->texture.y1;
+ const int image_x2 = data->texture.x2 - 1;
+ const int image_y2 = data->texture.y2 - 1;
if (data->fast_matrix) {
// The increment pr x in the scanline
@@ -4656,8 +4671,8 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData
const uint *end = buffer + l;
uint *b = buffer;
while (b < end) {
- int px = qBound(0, x >> 16, image_width - 1);
- int py = qBound(0, y >> 16, image_height - 1);
+ int px = qBound(image_x1, x >> 16, image_x2);
+ int py = qBound(image_y1, y >> 16, image_y2);
*b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
x += fdx;
@@ -4696,8 +4711,8 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData
const qreal iw = w == 0 ? 1 : 1 / w;
const qreal tx = x * iw;
const qreal ty = y * iw;
- const int px = qBound(0, int(tx) - (tx < 0), image_width - 1);
- const int py = qBound(0, int(ty) - (ty < 0), image_height - 1);
+ const int px = qBound(image_x1, int(tx) - (tx < 0), image_x2);
+ const int py = qBound(image_y1, int(ty) - (ty < 0), image_y2);
*b = reinterpret_cast<const uint *>(data->texture.scanLine(py))[px];
x += fdx;
@@ -4729,8 +4744,10 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa
}
quint16 buffer[buffer_size];
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
+ const int image_x1 = data->texture.x1;
+ const int image_y1 = data->texture.y1;
+ const int image_x2 = data->texture.x2 - 1;
+ const int image_y2 = data->texture.y2 - 1;
if (data->fast_matrix) {
// The increment pr x in the scanline
@@ -4768,8 +4785,8 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa
const quint16 *end = b + l;
while (b < end) {
- const int px = qBound(0, x >> 16, image_width - 1);
- const int py = qBound(0, y >> 16, image_height - 1);
+ const int px = qBound(image_x1, x >> 16, image_x2);
+ const int py = qBound(image_y1, y >> 16, image_y2);
*b = ((const quint16 *)data->texture.scanLine(py))[px];
++b;
@@ -4827,8 +4844,8 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa
const qreal tx = x * iw;
const qreal ty = y * iw;
- const int px = qBound(0, int(tx) - (tx < 0), image_width - 1);
- const int py = qBound(0, int(ty) - (ty < 0), image_height - 1);
+ const int px = qBound(image_x1, int(tx) - (tx < 0), image_x2);
+ const int py = qBound(image_y1, int(ty) - (ty < 0), image_y2);
*b = ((const quint16 *)data->texture.scanLine(py))[px];
++b;
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index acc9bc7ba1..9c1335298e 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -267,11 +267,9 @@ void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
// 2) interpolate pixels with AVX2
for (; x < (w - 7); x += 8) {
const __m256i srcVector = _mm256_lddqu_si256((const __m256i *)&src[x]);
- if (!_mm256_testz_si256(srcVector, srcVector)) {
- __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
- INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
- _mm256_store_si256((__m256i *)&dst[x], dstVector);
- }
+ __m256i dstVector = _mm256_load_si256((__m256i *)&dst[x]);
+ INTERPOLATE_PIXEL_255_AVX2(srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm256_store_si256((__m256i *)&dst[x], dstVector);
}
// 3) Epilogue
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index d51b43961c..a833520b00 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -523,8 +523,6 @@ void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl,
vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high));
}
for (; x<w; ++x) {
- uint s = src[x];
- s = BYTE_MUL(s, const_alpha);
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
}
dst = (quint32 *)(((uchar *) dst) + dbpl);
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index e537c343bb..0e46962784 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -64,6 +64,8 @@
#include "private/qrasterdefs_p.h"
#include <private/qsimd_p.h>
+#include <QtCore/qsharedpointer.h>
+
QT_BEGIN_NAMESPACE
#if defined(Q_CC_GNU)
@@ -335,7 +337,11 @@ struct QSpanData
QGradientData gradient;
QTextureData texture;
};
- QExplicitlySharedDataPointer<const QSharedData> cachedGradient;
+ class Pinnable {
+ protected:
+ ~Pinnable() {}
+ }; // QSharedPointer<const void> is not supported
+ QSharedPointer<const Pinnable> cachedGradient;
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 5ff08e8153..edce70d2d0 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -101,7 +101,6 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
quint32 *dst = (quint32 *) destPixels;
if (const_alpha != 256) {
if (const_alpha != 0) {
- const __m128i nullVector = _mm_set1_epi32(0);
const __m128i half = _mm_set1_epi16(0x80);
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
@@ -119,12 +118,10 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
for (; x < w-3; x += 4) {
__m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]);
- if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) {
- const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
- __m128i result;
- INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
- _mm_store_si128((__m128i *)&dst[x], result);
- }
+ const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
+ __m128i result;
+ INTERPOLATE_PIXEL_255_SSE2(result, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half);
+ _mm_store_si128((__m128i *)&dst[x], result);
}
SIMD_EPILOGUE(x, w, 3)
dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index df96a993e3..6d5eaf5aed 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4150,7 +4150,7 @@ void QRasterBuffer::flushToARGBImage(QImage *target) const
class QGradientCache
{
public:
- struct CacheInfo : public QSharedData
+ struct CacheInfo : QSpanData::Pinnable
{
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
stops(qMove(s)), opacity(op), interpolationMode(mode) {}
@@ -4161,9 +4161,9 @@ public:
QGradient::InterpolationMode interpolationMode;
};
- typedef QMultiHash<quint64, QExplicitlySharedDataPointer<const CacheInfo> > QGradientColorTableHash;
+ typedef QMultiHash<quint64, QSharedPointer<const CacheInfo>> QGradientColorTableHash;
- inline QExplicitlySharedDataPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
+ inline QSharedPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
quint64 hash_val = 0;
const QGradientStops stops = gradient.stops();
@@ -4177,7 +4177,7 @@ public:
return addCacheElement(hash_val, gradient, opacity);
else {
do {
- const QExplicitlySharedDataPointer<const CacheInfo> &cache_info = it.value();
+ const auto &cache_info = it.value();
if (cache_info->stops == stops && cache_info->opacity == opacity && cache_info->interpolationMode == gradient.interpolationMode())
return cache_info;
++it;
@@ -4193,12 +4193,12 @@ protected:
inline void generateGradientColorTable(const QGradient& g,
QRgba64 *colorTable,
int size, int opacity) const;
- QExplicitlySharedDataPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
+ QSharedPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
if (cache.size() == maxCacheSize()) {
// may remove more than 1, but OK
cache.erase(cache.begin() + (qrand() % maxCacheSize()));
}
- QExplicitlySharedDataPointer<CacheInfo> cache_entry(new CacheInfo (gradient.stops(), opacity, gradient.interpolationMode()));
+ auto cache_entry = QSharedPointer<CacheInfo>::create(gradient.stops(), opacity, gradient.interpolationMode());
generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity);
for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i)
cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32();
@@ -4438,7 +4438,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
cachedGradient = cacheInfo;
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
@@ -4460,7 +4460,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
cachedGradient = cacheInfo;
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
@@ -4486,7 +4486,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
cachedGradient = cacheInfo;
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index d9a3231165..6243f1e2a4 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -321,7 +321,7 @@ void QTriangulatingStroker::cubicTo(const qreal *pts)
if (threshold < 4)
threshold = 4;
qreal threshold_minus_1 = threshold - 1;
- float vx, vy;
+ float vx = 0, vy = 0;
float cx = m_cx, cy = m_cy;
float x, y;
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 3b24039ea6..7f3ed3adaa 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2077,6 +2077,8 @@ bool QFont::fromString(const QString &descrip)
setFixedPitch(l[8].toInt());
if (count == 11)
d->request.styleName = l[10].toString();
+ else
+ d->request.styleName.clear();
}
if (count >= 9 && !d->request.fixedPitch) // assume 'false' fixedPitch equals default
diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp
new file mode 100644
index 0000000000..c2c198866a
--- /dev/null
+++ b/src/gui/text/qinputcontrol.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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: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 "qinputcontrol_p.h"
+#include <QtGui/qevent.h>
+
+QT_BEGIN_NAMESPACE
+
+QInputControl::QInputControl(Type type, QObject *parent)
+ : QObject(parent)
+ , m_type(type)
+{
+}
+
+QInputControl::QInputControl(Type type, QObjectPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+ , m_type(type)
+{
+}
+
+bool QInputControl::isAcceptableInput(const QKeyEvent *event) const
+{
+ const QString text = event->text();
+ if (text.isEmpty())
+ return false;
+
+ const QChar c = text.at(0);
+
+ // ZWNJ and ZWJ. This needs to go before the next test, since CTRL+SHIFT is
+ // used to input it on Windows.
+ if (c == QChar(0x200C) || c == QChar(0x200D))
+ return true;
+
+ // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
+ if (event->modifiers() == Qt::ControlModifier
+ || event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
+ return false;
+ }
+
+ if (c.isPrint())
+ return true;
+
+ if (c.category() == QChar::Other_PrivateUse)
+ return true;
+
+ if (m_type == TextEdit && c == QLatin1Char('\t'))
+ return true;
+
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/text/qinputcontrol_p.h b/src/gui/text/qinputcontrol_p.h
new file mode 100644
index 0000000000..3b46067ba9
--- /dev/null
+++ b/src/gui/text/qinputcontrol_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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: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 QINPUTCONTROL_P_H
+#define QINPUTCONTROL_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/qobject.h>
+#include <qtguiglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QKeyEvent;
+class Q_GUI_EXPORT QInputControl : public QObject
+{
+ Q_OBJECT
+public:
+ enum Type {
+ LineEdit,
+ TextEdit
+ };
+
+ explicit QInputControl(Type type, QObject *parent = nullptr);
+
+ bool isAcceptableInput(const QKeyEvent *event) const;
+
+protected:
+ explicit QInputControl(Type type, QObjectPrivate &dd, QObject *parent = nullptr);
+
+private:
+ const Type m_type;
+};
+
+QT_END_NAMESPACE
+
+#endif // QINPUTCONTROL_P_H
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 0d05fee6ef..c006e7f427 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1148,6 +1148,11 @@ void QTextDocument::setMetaInformation(MetaInformation info, const QString &stri
Returns the plain text contained in the document. If you want
formatting information use a QTextCursor instead.
+ Some formatting characters are replaced by ASCII equivalents.
+ In particular, no-break space (U+00A0) is replaced by a regular
+ space (U+0020), and both paragraph (U+2029) and line (U+2028)
+ separators are replaced by line feed (U+000A).
+
\note Embedded objects, such as images, are represented by a
Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER).
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index efd041a5af..abe20abe02 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -39,7 +39,8 @@ HEADERS += \
text/qrawfont_p.h \
text/qglyphrun.h \
text/qglyphrun_p.h \
- text/qdistancefield_p.h
+ text/qdistancefield_p.h \
+ text/qinputcontrol_p.h
SOURCES += \
text/qfont.cpp \
@@ -69,7 +70,8 @@ SOURCES += \
text/qstatictext.cpp \
text/qrawfont.cpp \
text/qglyphrun.cpp \
- text/qdistancefield.cpp
+ text/qdistancefield.cpp \
+ text/qinputcontrol.cpp
SOURCES += \
text/qfontengine_qpf2.cpp \
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 205490b830..7fa19dc65b 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -1080,8 +1080,8 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
"detected unknown Next Protocol Negotiation protocol");
break;
}
- Q_FALLTHROUGH();
}
+ Q_FALLTHROUGH();
case QSslConfiguration::NextProtocolNegotiationNone:
protocolHandler.reset(new QHttpProtocolHandler(this));
connection->setConnectionType(QHttpNetworkConnection::ConnectionTypeHTTP);
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index 2da073fa5a..a903ecda5f 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -40,8 +40,6 @@
#include "qnetworkconfigmanager_p.h"
#include "qbearerplugin_p.h"
-#include <QtCore/private/qfactoryloader_p.h>
-
#include <QtCore/qdebug.h>
#include <QtCore/qtimer.h>
#include <QtCore/qstringlist.h>
@@ -60,7 +58,9 @@
QT_BEGIN_NAMESPACE
QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
- : QObject(), pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true)
+ : QObject(), pollTimer(0), mutex(QMutex::Recursive),
+ loader(QBearerEngineFactoryInterface_iid, QLatin1String("/bearer")),
+ forcedPolling(0), firstUpdate(true)
{
qRegisterMetaType<QNetworkConfiguration>();
qRegisterMetaType<QNetworkConfigurationPrivatePointer>();
@@ -365,7 +365,6 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
bool envOK = false;
const int skipGeneric = qEnvironmentVariableIntValue("QT_EXCLUDE_GENERIC_BEARER", &envOK);
QBearerEngine *generic = 0;
- static QFactoryLoader loader(QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"));
QFactoryLoader *l = &loader;
const PluginKeyMap keyMap = l->keyMap();
const PluginKeyMapConstIterator cend = keyMap.constEnd();
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
index a804e037a3..380e25c22f 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_p.h
@@ -55,6 +55,7 @@
#include "qnetworkconfigmanager.h"
#include "qnetworkconfiguration_p.h"
+#include <QtCore/private/qfactoryloader_p.h>
#include <QtCore/qmutex.h>
#include <QtCore/qset.h>
@@ -118,6 +119,7 @@ private:
private:
mutable QMutex mutex;
+ QFactoryLoader loader;
QList<QBearerEngine *> sessionEngines;
QSet<QString> onlineConfigurations;
diff --git a/src/network/configure.pri b/src/network/configure.pri
index 57568902e4..f87b7f635f 100644
--- a/src/network/configure.pri
+++ b/src/network/configure.pri
@@ -7,6 +7,7 @@ defineTest(qtConfLibrary_openssl) {
export($${1}.libs)
return(true)
}
+ qtLog("$OPENSSL_LIBS is not set.")
return(false)
}
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 8fac76f86a..086e8cede1 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -291,21 +291,27 @@ bool QNetmaskAddress::setAddress(const QHostAddress &address)
d->clear();
return false; // invalid IP-style netmask
- // the rest always falls through
case 254:
++netmask;
+ Q_FALLTHROUGH();
case 252:
++netmask;
+ Q_FALLTHROUGH();
case 248:
++netmask;
+ Q_FALLTHROUGH();
case 240:
++netmask;
+ Q_FALLTHROUGH();
case 224:
++netmask;
+ Q_FALLTHROUGH();
case 192:
++netmask;
+ Q_FALLTHROUGH();
case 128:
++netmask;
+ Q_FALLTHROUGH();
case 0:
break;
}
diff --git a/src/network/kernel/qnetworkdatagram.cpp b/src/network/kernel/qnetworkdatagram.cpp
index ba8a063edf..88ca763187 100644
--- a/src/network/kernel/qnetworkdatagram.cpp
+++ b/src/network/kernel/qnetworkdatagram.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QNetworkDatagram
- \brief The QNetworkDatagram class provides the data and matadata of a UDP datagram.
+ \brief The QNetworkDatagram class provides the data and metadata of a UDP datagram.
\since 5.8
\ingroup network
\inmodule QtNetwork
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 94719e9c2d..0be8a7f79e 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -82,7 +82,9 @@
\section1 SOCKS5
- The SOCKS5 support in Qt 4 is based on \l{http://www.rfc-editor.org/rfc/rfc1928.txt}{RFC 1928} and \l{http://www.rfc-editor.org/rfc/rfc1929.txt}{RFC 1929}.
+ The SOCKS5 support since Qt 4 is based on
+ \l{http://www.rfc-editor.org/rfc/rfc1928.txt}{RFC 1928} and
+ \l{http://www.rfc-editor.org/rfc/rfc1929.txt}{RFC 1929}.
The supported authentication methods are no authentication and
username/password authentication. Both IPv4 and IPv6 are
supported. Domain names are resolved through the SOCKS5 server if
@@ -1515,8 +1517,8 @@ bool QNetworkProxyFactory::usesSystemConfiguration()
Enables the use of the platform-specific proxy settings, and only those.
See systemProxyForQuery() for more information.
- Calling setUseSystemConfiguration(\c{true}) will reset any proxy or
- QNetworkProxyFactory already set.
+ Calling this function with \a enable set to \c true resets any proxy
+ or QNetworkProxyFactory that is already set.
\note See the systemProxyForQuery() documentation for a list of
limitations related to the use of system proxies.
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index 1578d7bb35..8a96cb9d48 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -72,13 +72,13 @@ public:
virtual ~QAbstractSocketPrivate();
// from QAbstractSocketEngineReceiver
- inline void readNotification() { canReadNotification(); }
- inline void writeNotification() { canWriteNotification(); }
- inline void exceptionNotification() {}
- inline void closeNotification() { canCloseNotification(); }
- void connectionNotification();
+ inline void readNotification() override { canReadNotification(); }
+ inline void writeNotification() override { canWriteNotification(); }
+ inline void exceptionNotification() override {}
+ inline void closeNotification() override { canCloseNotification(); }
+ void connectionNotification() override;
#ifndef QT_NO_NETWORKPROXY
- inline void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) {
+ inline void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) override {
Q_Q(QAbstractSocket);
q->proxyAuthenticationRequired(proxy, authenticator);
}
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index 560d74328e..9da37d2af3 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -99,12 +99,12 @@ public:
QTcpSocket::setSocketError(error);
}
- inline qint64 readData(char *data, qint64 maxSize)
+ inline qint64 readData(char *data, qint64 maxSize) override
{
return QTcpSocket::readData(data, maxSize);
}
- inline qint64 writeData(const char *data, qint64 maxSize)
+ inline qint64 writeData(const char *data, qint64 maxSize) override
{
return QTcpSocket::writeData(data, maxSize);
}
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 11d19682d8..928c7fc68f 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -1230,7 +1230,7 @@ public:
{ engine = parent; }
protected:
- bool event(QEvent *);
+ bool event(QEvent *) override;
QNativeSocketEngine *engine;
};
@@ -1262,7 +1262,7 @@ public:
: QSocketNotifier(fd, QSocketNotifier::Write, parent) { engine = parent; }
protected:
- bool event(QEvent *);
+ bool event(QEvent *) override;
QNativeSocketEngine *engine;
};
@@ -1286,7 +1286,7 @@ public:
: QSocketNotifier(fd, QSocketNotifier::Exception, parent) { engine = parent; }
protected:
- bool event(QEvent *);
+ bool event(QEvent *) override;
QNativeSocketEngine *engine;
};
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h
index 1333df316b..3c9da982e9 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache_p.h
+++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h
@@ -83,8 +83,8 @@ public:
GLuint getBuffer(const QGradient &gradient, qreal opacity);
inline int paletteSize() const { return 1024; }
- void invalidateResource();
- void freeResource(QOpenGLContext *ctx);
+ void invalidateResource() override;
+ void freeResource(QOpenGLContext *ctx) override;
private:
inline int maxCacheSize() const { return 60; }
diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h
index 6416e41773..9125fcfb4b 100644
--- a/src/opengl/qglpixelbuffer_p.h
+++ b/src/opengl/qglpixelbuffer_p.h
@@ -63,11 +63,11 @@ class QOpenGLFramebufferObject;
class QGLPBufferGLPaintDevice : public QGLPaintDevice
{
public:
- virtual QPaintEngine* paintEngine() const {return pbuf->paintEngine();}
- virtual QSize size() const {return pbuf->size();}
- virtual QGLContext* context() const;
- virtual void beginPaint();
- virtual void endPaint();
+ QPaintEngine* paintEngine() const override {return pbuf->paintEngine();}
+ QSize size() const override {return pbuf->size();}
+ QGLContext* context() const override;
+ void beginPaint() override;
+ void endPaint() override;
void setPBuffer(QGLPixelBuffer* pb);
void setFbo(GLuint fbo);
private:
diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc
index f0ef5ee2a7..fab473b91b 100644
--- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc
+++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.qdoc
@@ -106,7 +106,7 @@
\fn void QXcbWindowFunctions::setWmWindowRole(QWindow *window, const QByteArray &role)
\since 5.6.2
- Sets the WM_WINDOW_ROLE property from \role on the corresponding
+ Sets the WM_WINDOW_ROLE property from \a role on the corresponding
X11 window.
This is a convenience function that can be used directly instead
diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
index 6c84f29613..8c802a0ca1 100644
--- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
+++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h
@@ -105,6 +105,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLS
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
+#ifndef EGL_KHR_stream_fifo
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#endif
+
#ifndef EGL_KHR_stream_producer_eglsurface
#define EGL_STREAM_BIT_KHR 0x0800
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 78a0c4d0c9..1e29b12ec4 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -189,11 +189,16 @@ QCoreTextFontDatabase::~QCoreTextFontDatabase()
static CFArrayRef availableFamilyNames()
{
-#if defined(Q_OS_OSX)
- return CTFontManagerCopyAvailableFontFamilyNames();
-#elif defined(QT_PLATFORM_UIKIT)
- return (CFArrayRef) [[UIFont familyNames] retain];
+#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(1060, 100000, 100000, 30000)
+ if (&CTFontManagerCopyAvailableFontFamilyNames)
+ return CTFontManagerCopyAvailableFontFamilyNames();
#endif
+#if defined(QT_PLATFORM_UIKIT)
+ CFMutableArrayRef familyNames = CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, (CFArrayRef)[UIFont familyNames]);
+ CFArrayAppendValue(familyNames, CFSTR(".PhoneFallback"));
+ return familyNames;
+#endif
+ Q_UNREACHABLE();
}
void QCoreTextFontDatabase::populateFontDatabase()
@@ -207,17 +212,6 @@ void QCoreTextFontDatabase::populateFontDatabase()
for (int i = 0; i < numberOfFamilies; ++i) {
CFStringRef familyNameRef = (CFStringRef) CFArrayGetValueAtIndex(familyNames, i);
QString familyName = QString::fromCFString(familyNameRef);
-
- // Don't populate internal fonts
- if (familyName.startsWith(QLatin1Char('.')) || familyName == QLatin1String("LastResort"))
- continue;
-
-#if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
- // Skip font families with no corresponding fonts
- if (![UIFont fontNamesForFamilyName:(NSString*)familyNameRef].count)
- continue;
-#endif
-
QPlatformFontDatabase::registerFontFamily(familyName);
#if defined(Q_OS_OSX)
@@ -250,7 +244,7 @@ void QCoreTextFontDatabase::populateFamily(const QString &familyName)
const int numFonts = CFArrayGetCount(matchingFonts);
for (int i = 0; i < numFonts; ++i)
- populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i)));
+ populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i)), familyName);
}
struct FontDescription {
@@ -352,13 +346,18 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd)
}
}
-void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font)
+void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName)
{
FontDescription fd;
getFontDescription(font, &fd);
+ // Note: The familyName we are registering, and the family name of the font descriptor, may not
+ // match, as CTFontDescriptorCreateMatchingFontDescriptors will return descriptors for replacement
+ // fonts if a font family does not have any fonts available on the system.
+ QString family = !familyName.isNull() ? familyName : static_cast<QString>(fd.familyName);
+
CFRetain(font);
- QPlatformFontDatabase::registerFont(fd.familyName, fd.styleName, fd.foundryName, fd.weight, fd.style, fd.stretch,
+ QPlatformFontDatabase::registerFont(family, fd.styleName, fd.foundryName, fd.weight, fd.style, fd.stretch,
true /* antialiased */, true /* scalable */,
fd.pixelSize, fd.fixedPitch, fd.writingSystems, (void *) font);
}
@@ -699,7 +698,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
bool QCoreTextFontDatabase::isPrivateFontFamily(const QString &family) const
{
- if (family.startsWith(QLatin1Char('.')))
+ if (family.startsWith(QLatin1Char('.')) || family == QLatin1String("LastResort"))
return true;
return QPlatformFontDatabase::isPrivateFontFamily(family);
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 1bc3522bda..3b1be2e6a1 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -92,7 +92,7 @@ public:
const QHash<QPlatformTheme::Font, QFont *> &themeFonts() const;
private:
- void populateFromDescriptor(CTFontDescriptorRef font);
+ void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
#ifndef QT_NO_FREETYPE
bool m_useFreeType;
diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp
index f214184c36..9f4b182ece 100644
--- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp
@@ -129,6 +129,17 @@ static QFontDatabase::WritingSystem writingSystemFromUnicodeRange(const DWRITE_U
return QFontDatabase::Other;
}
+QWinRTFontDatabase::~QWinRTFontDatabase()
+{
+ qCDebug(lcQpaFonts) << __FUNCTION__;
+
+ foreach (IDWriteFontFile *fontFile, m_fonts.keys())
+ fontFile->Release();
+
+ foreach (IDWriteFontFamily *fontFamily, m_fontFamilies)
+ fontFamily->Release();
+}
+
QString QWinRTFontDatabase::fontDir() const
{
qCDebug(lcQpaFonts) << __FUNCTION__;
@@ -146,17 +157,6 @@ QString QWinRTFontDatabase::fontDir() const
return fontDirectory;
}
-QWinRTFontDatabase::~QWinRTFontDatabase()
-{
- qCDebug(lcQpaFonts) << __FUNCTION__;
-
- foreach (IDWriteFontFile *fontFile, m_fonts.keys())
- fontFile->Release();
-
- foreach (IDWriteFontFamily *fontFamily, m_fontFamilies)
- fontFamily->Release();
-}
-
QFont QWinRTFontDatabase::defaultFont() const
{
return QFont(QStringLiteral("Segoe UI"));
diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h
index 9559bac0a8..3b803d7613 100644
--- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase_p.h
@@ -70,16 +70,16 @@ struct FontDescription
class QWinRTFontDatabase : public QBasicFontDatabase
{
public:
- QString fontDir() const;
~QWinRTFontDatabase();
- QFont defaultFont() const Q_DECL_OVERRIDE;
- bool fontsAlwaysScalable() const Q_DECL_OVERRIDE;
- void populateFontDatabase() Q_DECL_OVERRIDE;
- void populateFamily(const QString &familyName) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
+ QString fontDir() const override;
+ QFont defaultFont() const override;
+ bool fontsAlwaysScalable() const override;
+ void populateFontDatabase() override;
+ void populateFamily(const QString &familyName) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
QStringList fallbacksForFamily(const QString &family, QFont::Style style,
- QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE;
- void releaseHandle(void *handle) Q_DECL_OVERRIDE;
+ QFont::StyleHint styleHint, QChar::Script script) const override;
+ void releaseHandle(void *handle) override;
private:
QHash<IDWriteFontFile *, FontDescription> m_fonts;
QHash<QString, IDWriteFontFamily *> m_fontFamilies;
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
index a9d758209a..352e4dfd56 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection.cpp
@@ -119,13 +119,16 @@ bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)
if (item->menu())
registerTrayIconMenu(item);
+ return registerTrayIconWithWatcher(item);
+}
+
+bool QDBusMenuConnection::registerTrayIconWithWatcher(QDBusTrayIcon *item)
+{
QDBusMessage registerMethod = QDBusMessage::createMethodCall(
StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService,
QLatin1String("RegisterStatusNotifierItem"));
registerMethod.setArguments(QVariantList() << item->instanceId());
- success = m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError)));
-
- return success;
+ return m_connection.callWithCallback(registerMethod, this, SIGNAL(trayIconRegistered()), SLOT(dbusError(QDBusError)));
}
bool QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
index ae0595ae3b..c7c3f4bc5b 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuconnection_p.h
@@ -69,11 +69,13 @@ class QDBusMenuConnection : public QObject
public:
QDBusMenuConnection(QObject *parent = 0, const QString &serviceName = QString());
QDBusConnection connection() const { return m_connection; }
+ QDBusServiceWatcher *dbusWatcher() const { return m_dbusWatcher; }
bool isStatusNotifierHostRegistered() const { return m_statusNotifierHostRegistered; }
#ifndef QT_NO_SYSTEMTRAYICON
bool registerTrayIconMenu(QDBusTrayIcon *item);
void unregisterTrayIconMenu(QDBusTrayIcon *item);
bool registerTrayIcon(QDBusTrayIcon *item);
+ bool registerTrayIconWithWatcher(QDBusTrayIcon *item);
bool unregisterTrayIcon(QDBusTrayIcon *item);
#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
index a686a33464..5c4157c206 100644
--- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
@@ -116,6 +116,8 @@ void QDBusTrayIcon::init()
{
qCDebug(qLcTray) << "registering" << m_instanceId;
m_registered = dBusConnection()->registerTrayIcon(this);
+ QObject::connect(dBusConnection()->dbusWatcher(), &QDBusServiceWatcher::serviceRegistered,
+ this, &QDBusTrayIcon::watcherServiceRegistered);
}
void QDBusTrayIcon::cleanup()
@@ -130,6 +132,15 @@ void QDBusTrayIcon::cleanup()
m_registered = false;
}
+void QDBusTrayIcon::watcherServiceRegistered(const QString &serviceName)
+{
+ Q_UNUSED(serviceName);
+ // We have the icon registered, but the watcher has restarted or
+ // changed, so we need to tell it about our icon again
+ if (m_registered)
+ dBusConnection()->registerTrayIconWithWatcher(this);
+}
+
void QDBusTrayIcon::attentionTimerExpired()
{
m_messageTitle = QString();
diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
index 234ff60584..ff1a7ae532 100644
--- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
@@ -133,6 +133,7 @@ private Q_SLOTS:
void attentionTimerExpired();
void actionInvoked(uint id, const QString &action);
void notificationClosed(uint id, uint reason);
+ void watcherServiceRegistered(const QString &serviceName);
private:
void setStatus(const QString &status);
diff --git a/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java b/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
index 8170188ecb..805c90548b 100644
--- a/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
+++ b/src/plugins/bearer/android/jar/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
@@ -44,7 +44,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
-import android.app.Activity;
import android.net.ConnectivityManager;
public class QtNetworkReceiver
@@ -65,29 +64,29 @@ public class QtNetworkReceiver
private QtNetworkReceiver() {}
- public static void registerReceiver(final Activity activity)
+ public static void registerReceiver(final Context context)
{
synchronized (m_lock) {
if (m_broadcastReceiver == null) {
m_broadcastReceiver = new BroadcastReceiverPrivate();
IntentFilter intentFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
- activity.registerReceiver(m_broadcastReceiver, intentFilter);
+ context.registerReceiver(m_broadcastReceiver, intentFilter);
}
}
}
- public static void unregisterReceiver(final Activity activity)
+ public static void unregisterReceiver(final Context context)
{
synchronized (m_lock) {
if (m_broadcastReceiver == null)
return;
- activity.unregisterReceiver(m_broadcastReceiver);
+ context.unregisterReceiver(m_broadcastReceiver);
}
}
- public static ConnectivityManager getConnectivityManager(final Activity activity)
+ public static ConnectivityManager getConnectivityManager(final Context context)
{
- return (ConnectivityManager)activity.getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+ return (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
}
}
diff --git a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp b/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp
index 3a5030d1f3..6787690246 100644
--- a/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp
+++ b/src/plugins/bearer/android/src/wrappers/androidconnectivitymanager.cpp
@@ -250,15 +250,15 @@ AndroidConnectivityManager::AndroidConnectivityManager()
m_connectivityManager = QJNIObjectPrivate::callStaticObjectMethod(networkReceiverClass,
"getConnectivityManager",
- "(Landroid/app/Activity;)Landroid/net/ConnectivityManager;",
- QtAndroidPrivate::activity());
+ "(Landroid/content/Context;)Landroid/net/ConnectivityManager;",
+ QtAndroidPrivate::context());
if (!m_connectivityManager.isValid())
return;
QJNIObjectPrivate::callStaticMethod<void>(networkReceiverClass,
"registerReceiver",
- "(Landroid/app/Activity;)V",
- QtAndroidPrivate::activity());
+ "(Landroid/content/Context;)V",
+ QtAndroidPrivate::context());
}
AndroidConnectivityManager *AndroidConnectivityManager::getInstance()
@@ -272,8 +272,8 @@ AndroidConnectivityManager::~AndroidConnectivityManager()
{
QJNIObjectPrivate::callStaticMethod<void>(networkReceiverClass,
"unregisterReceiver",
- "(Landroid/app/Activity;)V",
- QtAndroidPrivate::activity());
+ "(Landroid/content/Context;)V",
+ QtAndroidPrivate::context());
}
AndroidNetworkInfo AndroidConnectivityManager::getActiveNetworkInfo() const
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 02ea7abf88..059617b367 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -37,6 +37,9 @@
**
****************************************************************************/
+// see comment in ../platformdefs_win.h.
+#define WIN32_LEAN_AND_MEAN 1
+
#include "qgenericengine.h"
#include "../qnetworksession_impl.h"
diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h
index 8fb2f1bcc5..5a8487d868 100644
--- a/src/plugins/bearer/platformdefs_win.h
+++ b/src/plugins/bearer/platformdefs_win.h
@@ -40,6 +40,8 @@
#ifndef QPLATFORMDEFS_WIN_H
#define QPLATFORMDEFS_WIN_H
+// Since we need to include winsock2.h, we need to define WIN32_LEAN_AND_MEAN
+// somewhere above so windows.h won't include winsock.h.
#include <winsock2.h>
#include <mswsock.h>
#undef interface
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index 5ce51670f7..7756709e55 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -37,6 +37,9 @@
**
****************************************************************************/
+// see comment in ../platformdefs_win.h.
+#define WIN32_LEAN_AND_MEAN 1
+
#include "qnetworksession_impl.h"
#include "qbearerengine_impl.h"
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 12e85046f8..4ab8a9d060 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -354,10 +354,10 @@ static QRect inputItemRectangle()
? 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);
+ rect.setRect(rect.x() * pixelDensity,
+ rect.y() * pixelDensity,
+ rect.width() * pixelDensity,
+ rect.height() * pixelDensity);
}
return rect;
}
diff --git a/src/plugins/platforms/android/qandroidplatformforeignwindow.h b/src/plugins/platforms/android/qandroidplatformforeignwindow.h
index 100e0adcdf..d42c36dcee 100644
--- a/src/plugins/platforms/android/qandroidplatformforeignwindow.h
+++ b/src/plugins/platforms/android/qandroidplatformforeignwindow.h
@@ -51,12 +51,12 @@ class QAndroidPlatformForeignWindow : public QAndroidPlatformWindow
public:
explicit QAndroidPlatformForeignWindow(QWindow *window);
~QAndroidPlatformForeignWindow();
- void lower() Q_DECL_OVERRIDE;
- void raise() Q_DECL_OVERRIDE;
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void applicationStateChanged(Qt::ApplicationState state) Q_DECL_OVERRIDE;
- void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
+ void lower() override;
+ void raise() override;
+ void setGeometry(const QRect &rect) override;
+ void setVisible(bool visible) override;
+ void applicationStateChanged(Qt::ApplicationState state) override;
+ void setParent(const QPlatformWindow *window) override;
private:
int m_surfaceId;
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 6669ee3176..de9e27e595 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -66,6 +66,8 @@
#include "qandroidplatformtheme.h"
#include "qandroidsystemlocale.h"
+#include <QtPlatformHeaders/QEGLNativeContext>
+
QT_BEGIN_NAMESPACE
int QAndroidPlatformIntegration::m_defaultGeometryWidth = 320;
@@ -251,7 +253,9 @@ QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext
format.setRedBufferSize(8);
format.setGreenBufferSize(8);
format.setBlueBufferSize(8);
- return new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay);
+ auto ctx = new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay, context->nativeHandle());
+ context->setNativeHandle(QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), m_eglDisplay)));
+ return ctx;
}
QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index 2644fa27f6..eeec7a8106 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -49,8 +49,9 @@
QT_BEGIN_NAMESPACE
-QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display)
- :QEGLPlatformContext(format, share, display)
+QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
+ const QVariant &nativeHandle)
+ :QEGLPlatformContext(format, share, display, nullptr, nativeHandle)
{
}
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h
index 87a0829655..3897b3166b 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
class QAndroidPlatformOpenGLContext : public QEGLPlatformContext
{
public:
- QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display);
+ QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, const QVariant &nativeHandle);
void swapBuffers(QPlatformSurface *surface) override;
bool makeCurrent(QPlatformSurface *surface) override;
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h
index 12e86b3db4..d3072f766d 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h
@@ -64,7 +64,7 @@ public:
void applicationStateChanged(Qt::ApplicationState) override;
- void repaint(const QRegion &region) Q_DECL_OVERRIDE;
+ void repaint(const QRegion &region) override;
protected:
void surfaceChanged(JNIEnv *jniEnv, jobject surface, int w, int h) override;
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h
index 7405c3cdbd..b49d2516f1 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.h
+++ b/src/plugins/platforms/android/qandroidplatformtheme.h
@@ -72,7 +72,7 @@ public:
const QPalette *palette(Palette type = SystemPalette) const override;
const QFont *font(Font type = SystemFont) const override;
QVariant themeHint(ThemeHint hint) const override;
- QString standardButtonText(int button) const Q_DECL_OVERRIDE;
+ QString standardButtonText(int button) const override;
bool usePlatformNativeDialog(DialogType type) const override;
QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 97bd402b73..e743dd56bf 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -235,19 +235,19 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
if (!iface || !iface->isValid())
return nil;
- if (QWindow *window = iface->window()) {
- QCocoaWindow *win = static_cast<QCocoaWindow*>(window->handle());
- return qnsview_cast(win->view());
+ if (QAccessibleInterface *parent = iface->parent()) {
+ QAccessible::Id parentId = QAccessible::uniqueId(parent);
+ return [QMacAccessibilityElement elementWithId: parentId];
}
- QAccessibleInterface *parent = iface->parent();
- if (!parent) {
- qWarning() << "INVALID PARENT FOR INTERFACE: " << iface;
- return nil;
+ if (QWindow *window = iface->window()) {
+ QPlatformWindow *platformWindow = window->handle();
+ if (platformWindow) {
+ QCocoaWindow *win = static_cast<QCocoaWindow*>(platformWindow);
+ return qnsview_cast(win->view());
+ }
}
-
- QAccessible::Id parentId = QAccessible::uniqueId(parent);
- return [QMacAccessibilityElement elementWithId: parentId];
+ return nil;
}
@@ -537,7 +537,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
- (void)accessibilityPerformAction:(NSString *)action {
QAccessibleInterface *iface = QAccessible::accessibleInterface(axid);
- if (iface) {
+ if (iface && iface->isValid()) {
const QString qtAction = QCocoaAccessible::translateAction(action, iface);
QAccessibleBridgeUtils::performEffectiveAction(iface, qtAction);
}
@@ -562,16 +562,16 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
int y = qt_mac_flipYCoordinate(point.y);
QAccessibleInterface *childInterface = iface->childAt(point.x, y);
// No child found, meaning we hit this element.
- if (!childInterface)
+ if (!childInterface || !childInterface->isValid())
return NSAccessibilityUnignoredAncestor(self);
// find the deepest child at the point
QAccessibleInterface *childOfChildInterface = 0;
do {
childOfChildInterface = childInterface->childAt(point.x, y);
- if (childOfChildInterface)
+ if (childOfChildInterface && childOfChildInterface->isValid())
childInterface = childOfChildInterface;
- } while (childOfChildInterface);
+ } while (childOfChildInterface && childOfChildInterface->isValid());
QAccessible::Id childId = QAccessible::uniqueId(childInterface);
// hit a child, forward to child accessible interface.
@@ -590,7 +590,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
}
QAccessibleInterface *childInterface = iface->focusChild();
- if (childInterface) {
+ if (childInterface && childInterface->isValid()) {
QAccessible::Id childAxid = QAccessible::uniqueId(childInterface);
QMacAccessibilityElement *accessibleElement = [QMacAccessibilityElement elementWithId:childAxid];
return NSAccessibilityUnignoredAncestor(accessibleElement);
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index da755aa189..7368aabf7d 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -282,14 +282,18 @@ QT_END_NAMESPACE
{
Q_UNUSED(aNotification);
inLaunch = false;
- // qt_release_apple_event_handler();
-
- // Insert code here to initialize your application
+ if (qEnvironmentVariableIsEmpty("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM")) {
+ if (QSysInfo::macVersion() >= QSysInfo::MV_10_12) {
+ // Move the application window to front to avoid launching behind the terminal.
+ // Ignoring other apps is neccessary (we must ignore the terminal), but makes
+ // Qt apps play slightly less nice with other apps when lanching from Finder
+ // (See the activateIgnoringOtherApps docs.)
+ [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
+ }
+ }
}
-
-
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
Q_UNUSED(filenames);
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 92fffb4d15..18340f4ee1 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -312,11 +312,15 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
// see the function implementation for exceptions.)
qt_mac_transformProccessToForegroundApplication();
- // Move the application window to front to avoid launching behind the terminal.
- // Ignoring other apps is neccessary (we must ignore the terminal), but makes
- // Qt apps play slightly less nice with other apps when lanching from Finder
- // (See the activateIgnoringOtherApps docs.)
- [cocoaApplication activateIgnoringOtherApps : YES];
+ // Move the application window to front to make it take focus, also when launching
+ // from the terminal. On 10.12+ this call has been moved to applicationDidFinishLauching
+ // to work around issues with loss of focus at startup.
+ if (QSysInfo::macVersion() < QSysInfo::MV_10_12) {
+ // Ignoring other apps is neccessary (we must ignore the terminal), but makes
+ // Qt apps play slightly less nice with other apps when lanching from Finder
+ // (See the activateIgnoringOtherApps docs.)
+ [cocoaApplication activateIgnoringOtherApps : YES];
+ }
}
// ### For AA_MacPluginApplication we don't want to load the menu nib.
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
index e7952ae1f6..1ef7f11011 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
@@ -366,7 +366,9 @@ Qt::KeyboardModifiers QCocoaKeyMapper::queryKeyboardModifiers()
bool QCocoaKeyMapper::updateKeyboard()
{
const UCKeyboardLayout *uchrData = 0;
- QCFType<TISInputSourceRef> source = TISCopyCurrentKeyboardInputSource();
+ QCFType<TISInputSourceRef> source = TISCopyInputMethodKeyboardLayoutOverride();
+ if (!source)
+ source = TISCopyCurrentKeyboardInputSource();
if (keyboard_mode != NullMode && source == currentInputSource) {
return false;
}
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index a63bc4d570..ba91d3e40e 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -2193,7 +2193,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
}
NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin;
- QPoint qtWindowPoint(windowPoint.x, windowPoint.y);
+ NSPoint nsViewPoint = [self convertPoint: windowPoint fromView: nil]; // NSView/QWindow coordinates
+ QPoint qtWindowPoint(nsViewPoint.x, nsViewPoint.y);
QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
index d86a67b4f4..f936d05927 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro
@@ -2,8 +2,8 @@ TEMPLATE = subdirs
QT_FOR_CONFIG += gui-private
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_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
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index bed775ff81..d4df0dc66e 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -181,24 +181,41 @@ void QEglFSKmsGbmScreen::flip()
FrameBuffer *fb = framebufferForBufferObject(m_gbm_bo_next);
- if (!output().mode_set) {
- int ret = drmModeSetCrtc(device()->fd(),
- output().crtc_id,
+ QEglFSKmsOutput &op(output());
+ const int fd = device()->fd();
+ const uint32_t w = op.modes[op.mode].hdisplay;
+ const uint32_t h = op.modes[op.mode].vdisplay;
+
+ if (!op.mode_set) {
+ int ret = drmModeSetCrtc(fd,
+ op.crtc_id,
fb->fb,
0, 0,
- &output().connector_id, 1,
- &output().modes[output().mode]);
+ &op.connector_id, 1,
+ &op.modes[op.mode]);
- if (ret) {
- qErrnoWarning("Could not set DRM mode!");
+ if (ret == -1) {
+ qErrnoWarning(errno, "Could not set DRM mode!");
} else {
- output().mode_set = true;
+ op.mode_set = true;
setPowerState(PowerStateOn);
+
+ if (!op.plane_set) {
+ op.plane_set = true;
+ if (op.wants_plane) {
+ int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id,
+ uint32_t(-1), 0,
+ 0, 0, w, h,
+ 0 << 16, 0 << 16, w << 16, h << 16);
+ if (ret == -1)
+ qErrnoWarning(errno, "drmModeSetPlane failed");
+ }
+ }
}
}
- int ret = drmModePageFlip(device()->fd(),
- output().crtc_id,
+ int ret = drmModePageFlip(fd,
+ op.crtc_id,
fb->fb,
DRM_MODE_PAGE_FLIP_EVENT,
this);
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 d0c9c9565e..cf1de71831 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -39,11 +39,11 @@
****************************************************************************/
#include "qeglfskmsegldeviceintegration.h"
+#include "qeglfskmsegldevice.h"
+#include "qeglfskmsegldevicescreen.h"
#include <QtEglSupport/private/qeglconvenience_p.h>
#include "private/qeglfswindow_p.h"
#include "private/qeglfscursor_p.h"
-#include "qeglfskmsegldevice.h"
-#include "qeglfskmsscreen.h"
#include <QLoggingCategory>
#include <private/qmath_p.h>
@@ -129,10 +129,16 @@ void QEglJetsonTK1Window::resetSurface()
qCDebug(qLcEglfsKmsDebug, "Creating stream");
EGLDisplay display = screen()->display();
- EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT;
- EGLint count;
+ EGLint streamAttribs[3];
+ int streamAttribCount = 0;
+ int fifoLength = qEnvironmentVariableIntValue("QT_QPA_EGLFS_STREAM_FIFO_LENGTH");
+ if (fifoLength > 0) {
+ streamAttribs[streamAttribCount++] = EGL_STREAM_FIFO_LENGTH_KHR;
+ streamAttribs[streamAttribCount++] = fifoLength;
+ }
+ streamAttribs[streamAttribCount++] = EGL_NONE;
- m_egl_stream = m_integration->m_funcs->create_stream(display, Q_NULLPTR);
+ m_egl_stream = m_integration->m_funcs->create_stream(display, streamAttribs);
if (m_egl_stream == EGL_NO_STREAM_KHR) {
qWarning("resetSurface: Couldn't create EGLStream for native window");
return;
@@ -140,6 +146,16 @@ void QEglJetsonTK1Window::resetSurface()
qCDebug(qLcEglfsKmsDebug, "Created stream %p on display %p", m_egl_stream, display);
+ EGLint count;
+ if (m_integration->m_funcs->query_stream(display, m_egl_stream, EGL_STREAM_FIFO_LENGTH_KHR, &count)) {
+ if (count > 0)
+ qCDebug(qLcEglfsKmsDebug, "Using EGLStream FIFO mode with %d frames", count);
+ else
+ qCDebug(qLcEglfsKmsDebug, "Using EGLStream mailbox mode");
+ } else {
+ qCDebug(qLcEglfsKmsDebug, "Could not query number of EGLStream FIFO frames");
+ }
+
if (!m_integration->m_funcs->get_output_layers(display, Q_NULLPTR, Q_NULLPTR, 0, &count) || count == 0) {
qWarning("No output layers found");
return;
@@ -155,19 +171,23 @@ void QEglJetsonTK1Window::resetSurface()
return;
}
- QEglFSKmsScreen *cur_screen = static_cast<QEglFSKmsScreen*>(screen());
+ QEglFSKmsEglDeviceScreen *cur_screen = static_cast<QEglFSKmsEglDeviceScreen *>(screen());
Q_ASSERT(cur_screen);
- qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", cur_screen->output().crtc_id);
+ QEglFSKmsOutput &output(cur_screen->output());
+ const uint32_t wantedId = !output.wants_plane ? output.crtc_id : output.plane_id;
+ qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", wantedId);
+ EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT;
for (int i = 0; i < actualCount; ++i) {
EGLAttrib id;
if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) {
qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - crtc %d", i, layers[i], (int) id);
- if (id == EGLAttrib(cur_screen->output().crtc_id))
+ if (id == EGLAttrib(wantedId))
layer = layers[i];
} else if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_PLANE_EXT, &id)) {
- // Not used yet, just for debugging.
qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - plane %d", i, layers[i], (int) id);
+ if (id == EGLAttrib(wantedId))
+ layer = layers[i];
} else {
qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - unknown", i, layers[i]);
}
@@ -176,8 +196,10 @@ void QEglJetsonTK1Window::resetSurface()
QByteArray reqLayerIndex = qgetenv("QT_QPA_EGLFS_LAYER_INDEX");
if (!reqLayerIndex.isEmpty()) {
int idx = reqLayerIndex.toInt();
- if (idx >= 0 && idx < layers.count())
+ if (idx >= 0 && idx < layers.count()) {
+ qCDebug(qLcEglfsKmsDebug, "EGLOutput layer index override = %d", idx);
layer = layers[idx];
+ }
}
if (layer == EGL_NO_OUTPUT_LAYER_EXT) {
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 1f672afeb4..3935c99b9e 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
@@ -67,13 +67,16 @@ QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const
void QEglFSKmsEglDeviceScreen::waitForFlip()
{
- if (!output().mode_set) {
- output().mode_set = true;
+ QEglFSKmsOutput &op(output());
+ const int fd = device()->fd();
+ const uint32_t w = op.modes[op.mode].hdisplay;
+ const uint32_t h = op.modes[op.mode].vdisplay;
- drmModeCrtcPtr currentMode = drmModeGetCrtc(device()->fd(), output().crtc_id);
- const bool alreadySet = currentMode
- && currentMode->width == output().modes[output().mode].hdisplay
- && currentMode->height == output().modes[output().mode].vdisplay;
+ if (!op.mode_set) {
+ op.mode_set = true;
+
+ drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id);
+ const bool alreadySet = currentMode && currentMode->width == w && currentMode->height == h;
if (currentMode)
drmModeFreeCrtc(currentMode);
if (alreadySet) {
@@ -87,14 +90,26 @@ void QEglFSKmsEglDeviceScreen::waitForFlip()
}
qCDebug(qLcEglfsKmsDebug, "Setting mode");
- int ret = drmModeSetCrtc(device()->fd(), output().crtc_id,
+ int ret = drmModeSetCrtc(fd, op.crtc_id,
uint32_t(-1), 0, 0,
- &output().connector_id, 1,
- &output().modes[output().mode]);
+ &op.connector_id, 1,
+ &op.modes[op.mode]);
if (ret)
- qFatal("drmModeSetCrtc failed");
+ qErrnoWarning(errno, "drmModeSetCrtc failed");
}
+ if (!op.plane_set) {
+ op.plane_set = true;
+
+ if (op.wants_plane) {
+ qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.plane_id);
+ int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id, uint32_t(-1), 0,
+ 0, 0, w, h,
+ 0 << 16, 0 << 16, w << 16, h << 16);
+ if (ret == -1)
+ qErrnoWarning(errno, "drmModeSetPlane failed");
+ }
+ }
}
QT_END_NAMESPACE
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 f6b58d1ba6..f372b9d156 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -108,14 +108,10 @@ static const char * const connector_type_names[] = { // must match DRM_MODE_CONN
static QByteArray nameForConnector(const drmModeConnectorPtr connector)
{
- QByteArray connectorName("UNKNOWN");
-
+ const QByteArray id = QByteArray::number(connector->connector_type_id);
if (connector->connector_type < ARRAY_LENGTH(connector_type_names))
- connectorName = connector_type_names[connector->connector_type];
-
- connectorName += QByteArray::number(connector->connector_type_id);
-
- return connectorName;
+ return connector_type_names[connector->connector_type] + id;
+ return "UNKNOWN" + id;
}
static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode)
@@ -329,9 +325,32 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc
drmModeGetCrtc(m_dri_fd, crtc_id),
modes,
connector->subpixel,
- connectorProperty(connector, QByteArrayLiteral("DPMS"))
+ connectorProperty(connector, QByteArrayLiteral("DPMS")),
+ false,
+ 0,
+ false
};
+ bool ok;
+ int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_PLANE_INDEX", &ok);
+ if (ok) {
+ drmModePlaneRes *planeResources = drmModeGetPlaneResources(m_dri_fd);
+ if (planeResources) {
+ if (idx >= 0 && idx < int(planeResources->count_planes)) {
+ drmModePlane *plane = drmModeGetPlane(m_dri_fd, planeResources->planes[idx]);
+ if (plane) {
+ output.wants_plane = true;
+ output.plane_id = plane->plane_id;
+ qCDebug(qLcEglfsKmsDebug, "Forcing plane index %d, plane id %u (belongs to crtc id %u)",
+ idx, plane->plane_id, plane->crtc_id);
+ drmModeFreePlane(plane);
+ }
+ } else {
+ qWarning("Invalid plane index %d, must be between 0 and %u", idx, planeResources->count_planes - 1);
+ }
+ }
+ }
+
m_crtc_allocator |= (1 << output.crtc_id);
m_connector_allocator |= (1 << output.connector_id);
@@ -399,7 +418,20 @@ void QEglFSKmsDevice::createScreens()
QVector<OrderedScreen> screens;
+ int wantedConnectorIndex = -1;
+ bool ok;
+ int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_CONNECTOR_INDEX", &ok);
+ if (ok) {
+ if (idx >= 0 && idx < resources->count_connectors)
+ wantedConnectorIndex = idx;
+ else
+ qWarning("Invalid connector index %d, must be between 0 and %u", idx, resources->count_connectors - 1);
+ }
+
for (int i = 0; i < resources->count_connectors; i++) {
+ if (wantedConnectorIndex >= 0 && i != wantedConnectorIndex)
+ continue;
+
drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]);
if (!connector)
continue;
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 2b6a0ffe6c..fa331f0931 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
@@ -67,6 +67,9 @@ struct QEglFSKmsOutput
QList<drmModeModeInfo> modes;
int subpixel;
drmModePropertyPtr dpms_prop;
+ bool wants_plane;
+ uint32_t plane_id;
+ bool plane_set;
};
class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp
index f9924fe5ce..0a547b832f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp
@@ -55,7 +55,7 @@ public:
EventReader(QEglFSX11Integration *integration)
: m_integration(integration) { }
- void run();
+ void run() override;
private:
QEglFSX11Integration *m_integration;
diff --git a/src/plugins/platforms/mirclient/qmirclientplugin.cpp b/src/plugins/platforms/mirclient/qmirclientplugin.cpp
index 201b68c304..6899d70f2e 100644
--- a/src/plugins/platforms/mirclient/qmirclientplugin.cpp
+++ b/src/plugins/platforms/mirclient/qmirclientplugin.cpp
@@ -41,13 +41,6 @@
#include "qmirclientplugin.h"
#include "qmirclientintegration.h"
-QStringList QMirClientIntegrationPlugin::keys() const
-{
- QStringList list;
- list << QStringLiteral("mirclient");
- return list;
-}
-
QPlatformIntegration* QMirClientIntegrationPlugin::create(const QString &system,
const QStringList &)
{
diff --git a/src/plugins/platforms/mirclient/qmirclientplugin.h b/src/plugins/platforms/mirclient/qmirclientplugin.h
index 8b5da6e4f6..c91f2d1924 100644
--- a/src/plugins/platforms/mirclient/qmirclientplugin.h
+++ b/src/plugins/platforms/mirclient/qmirclientplugin.h
@@ -49,7 +49,6 @@ class QMirClientIntegrationPlugin : public QPlatformIntegrationPlugin
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "mirclient.json")
public:
- QStringList keys() const;
QPlatformIntegration* create(const QString&, const QStringList&);
};
diff --git a/src/plugins/platforms/qnx/main.h b/src/plugins/platforms/qnx/main.h
index 8d99d2432e..5d5bf95686 100644
--- a/src/plugins/platforms/qnx/main.h
+++ b/src/plugins/platforms/qnx/main.h
@@ -46,7 +46,7 @@ class QQnxIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "qnx.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&);
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxclipboard.cpp b/src/plugins/platforms/qnx/qqnxclipboard.cpp
index 0d2cc45c30..78174549b1 100644
--- a/src/plugins/platforms/qnx/qqnxclipboard.cpp
+++ b/src/plugins/platforms/qnx/qqnxclipboard.cpp
@@ -103,14 +103,14 @@ public:
qClipboardDebug() << "formats=" << m_formatsToCheck;
}
- bool hasFormat(const QString &mimetype) const
+ bool hasFormat(const QString &mimetype) const override
{
const bool result = is_clipboard_format_present(mimetype.toUtf8().constData()) == 0;
qClipboardDebug() << "mimetype=" << mimetype << "result=" << result;
return result;
}
- QStringList formats() const
+ QStringList formats() const override
{
QStringList result;
@@ -141,7 +141,7 @@ public:
}
protected:
- QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const
+ QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const override
{
qClipboardDebug() << "mimetype=" << mimetype << "preferredType=" << preferredType;
if (is_clipboard_format_present(mimetype.toUtf8().constData()) != 0)
diff --git a/src/plugins/platforms/qnx/qqnxclipboard.h b/src/plugins/platforms/qnx/qqnxclipboard.h
index 5113742087..b9466214f8 100644
--- a/src/plugins/platforms/qnx/qqnxclipboard.h
+++ b/src/plugins/platforms/qnx/qqnxclipboard.h
@@ -52,8 +52,8 @@ class QQnxClipboard : public QPlatformClipboard
public:
QQnxClipboard();
~QQnxClipboard();
- QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard);
- void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard);
+ QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
+ void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override;
private:
class MimeData;
diff --git a/src/plugins/platforms/qnx/qqnxcursor.h b/src/plugins/platforms/qnx/qqnxcursor.h
index 5c0d582107..9559bfb4ce 100644
--- a/src/plugins/platforms/qnx/qqnxcursor.h
+++ b/src/plugins/platforms/qnx/qqnxcursor.h
@@ -50,11 +50,11 @@ public:
QQnxCursor();
#if !defined(QT_NO_CURSOR)
- void changeCursor(QCursor *windowCursor, QWindow *window);
+ void changeCursor(QCursor *windowCursor, QWindow *window) override;
#endif
- void setPos(const QPoint &pos);
+ void setPos(const QPoint &pos) override;
- QPoint pos() const;
+ QPoint pos() const override;
private:
QPoint m_pos;
diff --git a/src/plugins/platforms/qnx/qqnxeglwindow.h b/src/plugins/platforms/qnx/qqnxeglwindow.h
index 943ae44bd9..183be11ddc 100644
--- a/src/plugins/platforms/qnx/qqnxeglwindow.h
+++ b/src/plugins/platforms/qnx/qqnxeglwindow.h
@@ -61,11 +61,11 @@ public:
void setPlatformOpenGLContext(QQnxGLContext *platformOpenGLContext);
QQnxGLContext *platformOpenGLContext() const { return m_platformOpenGLContext; }
- void setGeometry(const QRect &rect);
+ void setGeometry(const QRect &rect) override;
protected:
- int pixelFormat() const;
- void resetBuffers();
+ int pixelFormat() const override;
+ void resetBuffers() override;
private:
QSize m_requestedBufferSize;
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h
index 74cd3b4c48..6e5408e8bf 100644
--- a/src/plugins/platforms/qnx/qqnxglcontext.h
+++ b/src/plugins/platforms/qnx/qqnxglcontext.h
@@ -64,13 +64,13 @@ public:
void requestSurfaceChange();
- bool makeCurrent(QPlatformSurface *surface);
- void doneCurrent();
- void swapBuffers(QPlatformSurface *surface);
- QFunctionPointer getProcAddress(const char *procName);
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+ void swapBuffers(QPlatformSurface *surface) override;
+ QFunctionPointer getProcAddress(const char *procName) override;
- virtual QSurfaceFormat format() const { return m_windowFormat; }
- bool isSharing() const;
+ virtual QSurfaceFormat format() const override { return m_windowFormat; }
+ bool isSharing() const override;
static EGLDisplay getEglDisplay();
EGLConfig getEglConfig() const { return m_eglConfig;}
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h
index c4c2057059..e758ae5bf3 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h
@@ -71,22 +71,22 @@ public:
Reverted,
};
- bool isValid() const;
+ bool isValid() const override;
- bool filterEvent(const QEvent *event);
- QRectF keyboardRect() const;
- void reset();
- void commit();
- void update(Qt::InputMethodQueries);
- bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId);
+ bool filterEvent(const QEvent *event) override;
+ QRectF keyboardRect() const override;
+ void reset() override;
+ void commit() override;
+ void update(Qt::InputMethodQueries) override;
+ bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId) override;
- void showInputPanel();
- void hideInputPanel();
- bool isInputPanelVisible() const;
+ void showInputPanel() override;
+ void hideInputPanel() override;
+ bool isInputPanelVisible() const override;
- QLocale locale() const;
- void setFocusObject(QObject *object);
+ QLocale locale() const override;
+ void setFocusObject(QObject *object) override;
static void setHighlightColor(int index, const QColor &color);
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h
index aab8dabedf..8d6104af80 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h
@@ -56,19 +56,19 @@ public:
explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard);
~QQnxInputContext();
- bool isValid() const;
+ bool isValid() const override;
- void reset();
- bool filterEvent( const QEvent *event );
- QRectF keyboardRect() const;
+ void reset() override;
+ bool filterEvent(const QEvent *event) override;
+ QRectF keyboardRect() const override;
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
- void showInputPanel();
- void hideInputPanel();
- bool isInputPanelVisible() const;
+ void showInputPanel() override;
+ void hideInputPanel() override;
+ bool isInputPanelVisible() const override;
- QLocale locale() const;
- void setFocusObject(QObject *object);
+ QLocale locale() const override;
+ void setFocusObject(QObject *object) override;
private Q_SLOTS:
void keyboardHeightChanged();
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index f543b0d102..6f2af82100 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -89,38 +89,38 @@ public:
explicit QQnxIntegration(const QStringList &paramList);
~QQnxIntegration();
- bool hasCapability(QPlatformIntegration::Capability cap) const;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
#if !defined(QT_NO_OPENGL)
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
#endif
#if defined(QQNX_PPS)
- QPlatformInputContext *inputContext() const;
+ QPlatformInputContext *inputContext() const override;
#endif
void moveToScreen(QWindow *window, int screen);
bool supportsNavigatorEvents() const;
- QAbstractEventDispatcher *createEventDispatcher() const;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
- QPlatformFontDatabase *fontDatabase() const { return m_fontDatabase; }
+ QPlatformFontDatabase *fontDatabase() const override { return m_fontDatabase; }
- QPlatformNativeInterface *nativeInterface() const;
+ QPlatformNativeInterface *nativeInterface() const override;
#if !defined(QT_NO_CLIPBOARD)
- QPlatformClipboard *clipboard() const;
+ QPlatformClipboard *clipboard() const override;
#endif
#if !defined(QT_NO_DRAGANDDROP)
- QPlatformDrag *drag() const;
+ QPlatformDrag *drag() const override;
#endif
- QVariant styleHint(StyleHint hint) const;
+ QVariant styleHint(StyleHint hint) const override;
- QPlatformServices *services() const;
+ QPlatformServices *services() const override;
static QWindow *window(screen_window_t qnxWindow);
diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.h b/src/plugins/platforms/qnx/qqnxnativeinterface.h
index 26e34b9d54..25f1c29b02 100644
--- a/src/plugins/platforms/qnx/qqnxnativeinterface.h
+++ b/src/plugins/platforms/qnx/qqnxnativeinterface.h
@@ -50,16 +50,16 @@ class QQnxNativeInterface : public QPlatformNativeInterface
{
public:
QQnxNativeInterface(QQnxIntegration *integration);
- void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
- void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen);
- void *nativeResourceForIntegration(const QByteArray &resource);
+ void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
+ void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
+ void *nativeResourceForIntegration(const QByteArray &resource) override;
#if !defined(QT_NO_OPENGL)
- void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
+ void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
#endif
- void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value);
- NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource);
+ void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value) override;
+ NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override;
private:
QQnxIntegration *m_integration;
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.h b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
index 08315f166f..3c818f51a6 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatorpps.h
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
@@ -54,7 +54,7 @@ public:
~QQnxNavigatorPps();
protected:
- bool requestInvokeUrl(const QByteArray &encodedUrl);
+ bool requestInvokeUrl(const QByteArray &encodedUrl) override;
private:
bool openPpsConnection();
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h
index e4ac8f02b1..96ac193dda 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.h
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.h
@@ -54,12 +54,12 @@ public:
QQnxRasterBackingStore(QWindow *window);
~QQnxRasterBackingStore();
- QPaintDevice *paintDevice();
- void flush(QWindow *window, const QRegion &region, const QPoint &offset);
- void resize(const QSize &size, const QRegion &staticContents);
- bool scroll(const QRegion &area, int dx, int dy);
- void beginPaint(const QRegion &region);
- void endPaint();
+ QPaintDevice *paintDevice() override;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
+ bool scroll(const QRegion &area, int dx, int dy) override;
+ void beginPaint(const QRegion &region) override;
+ void endPaint() override;
private:
QQnxRasterWindow *platformWindow() const;
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.h b/src/plugins/platforms/qnx/qqnxrasterwindow.h
index 53ab29e443..99396efd57 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.h
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.h
@@ -58,13 +58,13 @@ public:
bool hasBuffers() const { return !bufferSize().isEmpty(); }
- void setParent(const QPlatformWindow *window);
+ void setParent(const QPlatformWindow *window) override;
void adjustBufferSize();
protected:
- int pixelFormat() const;
- void resetBuffers();
+ int pixelFormat() const override;
+ void resetBuffers() override;
// Copies content from the previous buffer (back buffer) to the current buffer (front buffer)
void blitPreviousToCurrent(const QRegion &region, int dx, int dy, bool flush=false);
diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h
index b7264d0973..8a498434aa 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.h
+++ b/src/plugins/platforms/qnx/qqnxscreen.h
@@ -71,26 +71,26 @@ public:
QQnxScreen(screen_context_t context, screen_display_t display, bool primaryScreen);
~QQnxScreen();
- QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
+ QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
- QRect geometry() const { return m_currentGeometry; }
- QRect availableGeometry() const;
- int depth() const;
- QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
- QSizeF physicalSize() const { return m_currentPhysicalSize; }
+ QRect geometry() const override { return m_currentGeometry; }
+ QRect availableGeometry() const override;
+ int depth() const override;
+ QImage::Format format() const override { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
+ QSizeF physicalSize() const override { return m_currentPhysicalSize; }
- qreal refreshRate() const;
+ qreal refreshRate() const override;
- Qt::ScreenOrientation nativeOrientation() const;
- Qt::ScreenOrientation orientation() const;
+ Qt::ScreenOrientation nativeOrientation() const override;
+ Qt::ScreenOrientation orientation() const override;
- QWindow *topLevelAt(const QPoint &point) const;
+ QWindow *topLevelAt(const QPoint &point) const override;
bool isPrimaryScreen() const { return m_primaryScreen; }
int rotation() const { return m_currentRotation; }
- QString name() const { return m_name; }
+ QString name() const override { return m_name; }
int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
screen_display_t nativeDisplay() const { return m_display; }
@@ -111,7 +111,7 @@ public:
QQnxWindow *rootWindow() const;
void setRootWindow(QQnxWindow*);
- QPlatformCursor *cursor() const;
+ QPlatformCursor *cursor() const override;
Q_SIGNALS:
void foreignWindowCreated(void *window);
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
index 6b234e8d8f..80798a8a2d 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
@@ -75,7 +75,7 @@ Q_SIGNALS:
void windowClosed(void *window);
protected:
- void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) override;
#if defined(QQNX_SCREENEVENTTHREAD)
private Q_SLOTS:
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventthread.h b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
index b672fcf991..140f53aa50 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventthread.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventthread.h
@@ -65,7 +65,7 @@ public:
void unlock();
protected:
- void run();
+ void run() override;
Q_SIGNALS:
void eventPending();
diff --git a/src/plugins/platforms/qnx/qqnxservices.h b/src/plugins/platforms/qnx/qqnxservices.h
index 94dd5dc0b4..cbf029fdb9 100644
--- a/src/plugins/platforms/qnx/qqnxservices.h
+++ b/src/plugins/platforms/qnx/qqnxservices.h
@@ -52,8 +52,8 @@ public:
explicit QQnxServices(QQnxAbstractNavigator *navigator);
~QQnxServices();
- bool openUrl(const QUrl &url);
- bool openDocument(const QUrl &url);
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
private:
bool navigatorInvoke(const QUrl &url);
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h
index 8580ee151b..51d55a2036 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h
@@ -56,14 +56,14 @@ public:
QQnxVirtualKeyboardPps();
~QQnxVirtualKeyboardPps();
- bool showKeyboard();
- bool hideKeyboard();
+ bool showKeyboard() override;
+ bool hideKeyboard() override;
public Q_SLOTS:
void start();
protected:
- void applyKeyboardOptions();
+ void applyKeyboardOptions() override;
private Q_SLOTS:
void ppsDataReady();
diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h
index 2e636c7e3e..e248e04462 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.h
+++ b/src/plugins/platforms/qnx/qqnxwindow.h
@@ -67,13 +67,13 @@ public:
QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow);
virtual ~QQnxWindow();
- void setGeometry(const QRect &rect);
- void setVisible(bool visible);
- void setOpacity(qreal level);
+ void setGeometry(const QRect &rect) override;
+ void setVisible(bool visible) override;
+ void setOpacity(qreal level) override;
- bool isExposed() const;
+ bool isExposed() const override;
- WId winId() const { return window()->type() == Qt::Desktop ? -1 : (WId)m_window; }
+ WId winId() const override { return window()->type() == Qt::Desktop ? -1 : (WId)m_window; }
screen_window_t nativeHandle() const { return m_window; }
void setBufferSize(const QSize &size);
@@ -81,14 +81,14 @@ public:
void setScreen(QQnxScreen *platformScreen);
- void setParent(const QPlatformWindow *window);
- void raise();
- void lower();
- void requestActivateWindow();
- void setWindowState(Qt::WindowState state);
+ void setParent(const QPlatformWindow *window) override;
+ void raise() override;
+ void lower() override;
+ void requestActivateWindow() override;
+ void setWindowState(Qt::WindowState state) override;
void setExposed(bool exposed);
- void propagateSizeHints();
+ void propagateSizeHints() override;
void setMMRendererWindowName(const QString &name);
void setMMRendererWindow(screen_window_t handle);
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 9803dedb1e..85aab84c2c 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -890,7 +890,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST
QString shortcut = accessible->text(QAccessible::Accelerator);
if (!shortcut.isEmpty())
- name.append(QLatin1Char(' ') + shortcut);
+ name += QLatin1Char(' ') + shortcut;
if (name.size()) {
*pszName = QStringToBSTR(name);
diff --git a/src/plugins/platforms/windows/qwin10helpers.cpp b/src/plugins/platforms/windows/qwin10helpers.cpp
index 977bbfd11b..12cccd124b 100644
--- a/src/plugins/platforms/windows/qwin10helpers.cpp
+++ b/src/plugins/platforms/windows/qwin10helpers.cpp
@@ -57,7 +57,7 @@
#endif
#ifdef HAS_UI_VIEW_SETTINGS_INTEROP
-# include <UIViewSettingsInterop.h>
+# include <uiviewsettingsinterop.h>
#endif
#ifndef HAS_UI_VIEW_SETTINGS_INTEROP
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 1a03df6ac2..bb9ed730a3 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -990,11 +990,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::MouseWheelEvent:
case QtWindows::MouseEvent:
case QtWindows::LeaveEvent:
+ {
+ QWindow *window = platformWindow->window();
+ while (window->flags() & Qt::WindowTransparentForInput)
+ window = window->parent();
+ if (!window)
+ return false;
#if !defined(QT_NO_SESSIONMANAGER)
- return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
+ return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#else
- return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
+ return d->m_mouseHandler.translateMouseEvent(window, hwnd, et, msg, result);
#endif
+ }
case QtWindows::TouchEvent:
#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 00c4a6191e..b84b586f7c 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -703,7 +703,8 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
quint32 fallbackKey = winceKeyBend(vk_key);
if (!fallbackKey || fallbackKey == Qt::Key_unknown) {
fallbackKey = 0;
- if (vk_key != keyLayout[vk_key].qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
+ if (vk_key != keyLayout[vk_key].qtKey[0] && vk_key != keyLayout[vk_key].qtKey[1]
+ && vk_key < 0x5B && vk_key > 0x2F)
fallbackKey = vk_key;
}
keyLayout[vk_key].qtKey[8] = fallbackKey;
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 3f6230172e..e4025fe60d 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -313,7 +313,8 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// events, "click-through") can be considered as the window under mouse.
QWindow *currentWindowUnderMouse = platformWindow->hasMouseCapture() ?
QWindowsScreen::windowAt(globalPosition, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window;
-
+ while (currentWindowUnderMouse && currentWindowUnderMouse->flags() & Qt::WindowTransparentForInput)
+ currentWindowUnderMouse = currentWindowUnderMouse->parent();
// QTBUG-44332: When Qt is running at low integrity level and
// a Qt Window is parented on a Window of a higher integrity process
// using QWindow::fromWinId() (for example, Qt running in a browser plugin)
@@ -432,22 +433,10 @@ static bool isValidWheelReceiver(QWindow *candidate)
static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int delta,
Qt::Orientation orientation, Qt::KeyboardModifiers mods)
{
- // Redirect wheel event to one of the following, in order of preference:
- // 1) The window under mouse
- // 2) The window receiving the event
// If a window is blocked by modality, it can't get the event.
-
- QWindow *receiver = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE);
- bool handleEvent = true;
- if (!isValidWheelReceiver(receiver)) {
- receiver = window;
- if (!isValidWheelReceiver(receiver))
- handleEvent = false;
- }
-
- if (handleEvent) {
- QWindowSystemInterface::handleWheelEvent(receiver,
- QWindowsGeometryHint::mapFromGlobal(receiver, globalPos),
+ if (isValidWheelReceiver(window)) {
+ QWindowSystemInterface::handleWheelEvent(window,
+ QWindowsGeometryHint::mapFromGlobal(window, globalPos),
globalPos, delta, orientation, mods);
}
}
diff --git a/src/plugins/platforms/winrt/main.cpp b/src/plugins/platforms/winrt/main.cpp
index a0b31e0e25..222287b3ef 100644
--- a/src/plugins/platforms/winrt/main.cpp
+++ b/src/plugins/platforms/winrt/main.cpp
@@ -49,15 +49,9 @@ class QWinRTIntegrationPlugin : public QPlatformIntegrationPlugin
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "winrt.json")
public:
- QStringList keys() const;
- QPlatformIntegration *create(const QString&, const QStringList&);
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
-QStringList QWinRTIntegrationPlugin::keys() const
-{
- return QStringList(QStringLiteral("WinRT"));
-}
-
QPlatformIntegration *QWinRTIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.h b/src/plugins/platforms/winrt/qwinrtbackingstore.h
index 41b27debcc..cd05faa63e 100644
--- a/src/plugins/platforms/winrt/qwinrtbackingstore.h
+++ b/src/plugins/platforms/winrt/qwinrtbackingstore.h
@@ -58,12 +58,12 @@ class QWinRTBackingStore : public QPlatformBackingStore
public:
explicit QWinRTBackingStore(QWindow *window);
~QWinRTBackingStore();
- QPaintDevice *paintDevice();
- void beginPaint(const QRegion &);
- void endPaint();
- void flush(QWindow *window, const QRegion &region, const QPoint &offset);
- void resize(const QSize &size, const QRegion &staticContents);
- QImage toImage() const Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ void beginPaint(const QRegion &) override;
+ void endPaint() override;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
+ QImage toImage() const override;
private:
bool initialize();
diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.h b/src/plugins/platforms/winrt/qwinrtclipboard.h
index 3e6ee109fd..2e3e2b834d 100644
--- a/src/plugins/platforms/winrt/qwinrtclipboard.h
+++ b/src/plugins/platforms/winrt/qwinrtclipboard.h
@@ -64,9 +64,9 @@ class QWinRTClipboard: public QPlatformClipboard
public:
QWinRTClipboard();
- QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
+ void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override;
+ bool supportsMode(QClipboard::Mode mode) const override;
HRESULT onContentChanged(IInspectable *, IInspectable *);
private:
diff --git a/src/plugins/platforms/winrt/qwinrtcursor.h b/src/plugins/platforms/winrt/qwinrtcursor.h
index baf902c7af..7f579f1531 100644
--- a/src/plugins/platforms/winrt/qwinrtcursor.h
+++ b/src/plugins/platforms/winrt/qwinrtcursor.h
@@ -51,9 +51,9 @@ public:
explicit QWinRTCursor();
~QWinRTCursor();
#ifndef QT_NO_CURSOR
- void changeCursor(QCursor * windowCursor, QWindow *window);
+ void changeCursor(QCursor * windowCursor, QWindow *window) override;
#endif
- QPoint pos() const;
+ QPoint pos() const override;
private:
QScopedPointer<QWinRTCursorPrivate> d_ptr;
diff --git a/src/plugins/platforms/winrt/qwinrtdrag.h b/src/plugins/platforms/winrt/qwinrtdrag.h
index 97079d831b..dad3e9892d 100644
--- a/src/plugins/platforms/winrt/qwinrtdrag.h
+++ b/src/plugins/platforms/winrt/qwinrtdrag.h
@@ -75,9 +75,9 @@ public:
QWinRTInternalMimeData();
virtual ~QWinRTInternalMimeData();
- bool hasFormat_sys(const QString &mimetype) const Q_DECL_OVERRIDE;
- QStringList formats_sys() const Q_DECL_OVERRIDE;
- QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const Q_DECL_OVERRIDE;
+ bool hasFormat_sys(const QString &mimetype) const override;
+ QStringList formats_sys() const override;
+ QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const override;
void setDataView(const Microsoft::WRL::ComPtr<ABI::Windows::ApplicationModel::DataTransfer::IDataPackageView> &d);
private:
@@ -91,8 +91,8 @@ public:
virtual ~QWinRTDrag();
static QWinRTDrag *instance();
- QMimeData *platformDropData(void) Q_DECL_OVERRIDE;
- Qt::DropAction drag(QDrag *) Q_DECL_OVERRIDE;
+ QMimeData *platformDropData(void) override;
+ Qt::DropAction drag(QDrag *) override;
void setDropTarget(QWindow *target);
diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.h b/src/plugins/platforms/winrt/qwinrteglcontext.h
index 12b6238cb1..5c75aa90d0 100644
--- a/src/plugins/platforms/winrt/qwinrteglcontext.h
+++ b/src/plugins/platforms/winrt/qwinrteglcontext.h
@@ -52,14 +52,14 @@ public:
explicit QWinRTEGLContext(QOpenGLContext *context);
~QWinRTEGLContext();
- void initialize() Q_DECL_OVERRIDE;
+ void initialize() override;
- bool makeCurrent(QPlatformSurface *windowSurface) Q_DECL_OVERRIDE;
- void doneCurrent() Q_DECL_OVERRIDE;
- void swapBuffers(QPlatformSurface *windowSurface) Q_DECL_OVERRIDE;
+ bool makeCurrent(QPlatformSurface *windowSurface) override;
+ void doneCurrent() override;
+ void swapBuffers(QPlatformSurface *windowSurface) override;
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
- QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
+ QFunctionPointer getProcAddress(const char *procName) override;
static EGLDisplay display();
private:
diff --git a/src/plugins/platforms/winrt/qwinrteventdispatcher.h b/src/plugins/platforms/winrt/qwinrteventdispatcher.h
index c04e9fca12..4c5c19c6b0 100644
--- a/src/plugins/platforms/winrt/qwinrteventdispatcher.h
+++ b/src/plugins/platforms/winrt/qwinrteventdispatcher.h
@@ -51,8 +51,8 @@ public:
explicit QWinRTEventDispatcher(QObject *parent = 0);
protected:
- bool hasPendingEvents();
- bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags);
+ bool hasPendingEvents() override;
+ bool sendPostedEvents(QEventLoop::ProcessEventsFlags flags) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h
index f88bed76ae..413dee7459 100644
--- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h
+++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.h
@@ -72,21 +72,21 @@ public:
explicit QWinRTFileDialogHelper();
~QWinRTFileDialogHelper();
- void exec() Q_DECL_OVERRIDE;
- bool show(Qt::WindowFlags, Qt::WindowModality, QWindow *) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ void exec() override;
+ bool show(Qt::WindowFlags, Qt::WindowModality, QWindow *) override;
+ void hide() override;
#ifdef Q_OS_WINPHONE
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *o, QEvent *e) override;
#endif
- bool defaultNameFilterDisables() const Q_DECL_OVERRIDE { return false; }
- void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE;
- QUrl directory() const Q_DECL_OVERRIDE;
- void selectFile(const QUrl &saveFileName);
- QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
- void setFilter() Q_DECL_OVERRIDE { }
- void selectNameFilter(const QString &selectedNameFilter) Q_DECL_OVERRIDE;
- QString selectedNameFilter() const;
+ bool defaultNameFilterDisables() const override { return false; }
+ void setDirectory(const QUrl &directory) override;
+ QUrl directory() const override;
+ void selectFile(const QUrl &saveFileName) override;
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override { }
+ void selectNameFilter(const QString &selectedNameFilter) override;
+ QString selectedNameFilter() const override;
#ifndef Q_OS_WINPHONE
HRESULT onSingleFilePicked(ABI::Windows::Foundation::IAsyncOperation<ABI::Windows::Storage::StorageFile *> *,
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.h b/src/plugins/platforms/winrt/qwinrtfileengine.h
index 70d5aea30d..73ff54b0c8 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.h
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.h
@@ -58,7 +58,7 @@ class QWinRTFileEngineHandler : public QAbstractFileEngineHandler
public:
QWinRTFileEngineHandler();
~QWinRTFileEngineHandler();
- QAbstractFileEngine *create(const QString &fileName) const Q_DECL_OVERRIDE;
+ QAbstractFileEngine *create(const QString &fileName) const override;
static void registerFile(const QString &fileName, ABI::Windows::Storage::IStorageItem *file);
static ABI::Windows::Storage::IStorageItem *registeredFile(const QString &fileName);
@@ -75,23 +75,23 @@ public:
QWinRTFileEngine(const QString &fileName, ABI::Windows::Storage::IStorageItem *file);
~QWinRTFileEngine();
- bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE;
- bool close() Q_DECL_OVERRIDE;
- bool flush() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 pos() const Q_DECL_OVERRIDE;
- bool seek(qint64 pos) Q_DECL_OVERRIDE;
- bool remove() Q_DECL_OVERRIDE;
- bool copy(const QString &newName) Q_DECL_OVERRIDE;
- bool rename(const QString &newName) Q_DECL_OVERRIDE;
- bool renameOverwrite(const QString &newName) Q_DECL_OVERRIDE;
- FileFlags fileFlags(FileFlags type=FileInfoAll) const Q_DECL_OVERRIDE;
- bool setPermissions(uint perms) Q_DECL_OVERRIDE;
- QString fileName(FileName type=DefaultName) const Q_DECL_OVERRIDE;
- QDateTime fileTime(FileTime type) const Q_DECL_OVERRIDE;
+ bool open(QIODevice::OpenMode openMode) override;
+ bool close() override;
+ bool flush() override;
+ qint64 size() const override;
+ qint64 pos() const override;
+ bool seek(qint64 pos) override;
+ bool remove() override;
+ bool copy(const QString &newName) override;
+ bool rename(const QString &newName) override;
+ bool renameOverwrite(const QString &newName) override;
+ FileFlags fileFlags(FileFlags type=FileInfoAll) const override;
+ bool setPermissions(uint perms) override;
+ QString fileName(FileName type=DefaultName) const override;
+ QDateTime fileTime(FileTime type) const override;
- qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 read(char *data, qint64 maxlen) override;
+ qint64 write(const char *data, qint64 len) override;
private:
QScopedPointer<QWinRTFileEnginePrivate> d_ptr;
diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.h b/src/plugins/platforms/winrt/qwinrtinputcontext.h
index 9d5c4187e2..13a0088ddc 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.h
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.h
@@ -70,13 +70,13 @@ class QWinRTInputContext : public QPlatformInputContext
public:
explicit QWinRTInputContext(QWinRTScreen *);
- QRectF keyboardRect() const;
+ QRectF keyboardRect() const override;
- bool isInputPanelVisible() const;
+ bool isInputPanelVisible() const override;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
- void showInputPanel();
- void hideInputPanel();
+ void showInputPanel() override;
+ void hideInputPanel() override;
#endif
private slots:
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h
index 7b4d5531fc..e22532a266 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.h
+++ b/src/plugins/platforms/winrt/qwinrtintegration.h
@@ -85,28 +85,28 @@ public:
bool succeeded() const;
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
- QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
-
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
- void initialize() Q_DECL_OVERRIDE;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
- QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
+ QVariant styleHint(StyleHint hint) const override;
+
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
+ void initialize() override;
+ QPlatformFontDatabase *fontDatabase() const override;
+ QPlatformInputContext *inputContext() const override;
+ QPlatformServices *services() const override;
+ QPlatformClipboard *clipboard() const override;
#ifndef QT_NO_DRAGANDDROP
- QPlatformDrag *drag() const Q_DECL_OVERRIDE;
+ QPlatformDrag *drag() const override;
#endif
- Qt::KeyboardModifiers queryKeyboardModifiers() const Q_DECL_OVERRIDE;
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
- QStringList themeNames() const Q_DECL_OVERRIDE;
- QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE;
+ QStringList themeNames() const override;
+ QPlatformTheme *createPlatformTheme(const QString &name) const override;
- QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
+ QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
private:
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT onBackButtonPressed(IInspectable *, ABI::Windows::Phone::UI::Input::IBackPressedEventArgs *args);
diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h
index 439e8f592f..14b6d4b715 100644
--- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h
+++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.h
@@ -69,11 +69,11 @@ public:
explicit QWinRTMessageDialogHelper(const QWinRTTheme *theme);
~QWinRTMessageDialogHelper();
- void exec();
+ void exec() override;
bool show(Qt::WindowFlags windowFlags,
Qt::WindowModality windowModality,
- QWindow *parent);
- void hide();
+ QWindow *parent) override;
+ void hide() override;
private:
HRESULT onCompleted(ABI::Windows::Foundation::IAsyncOperation<ABI::Windows::UI::Popups::IUICommand *> *asyncInfo,
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h
index 04ab985699..7dcdb98ead 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.h
+++ b/src/plugins/platforms/winrt/qwinrtscreen.h
@@ -90,19 +90,19 @@ public:
explicit QWinRTScreen();
~QWinRTScreen();
- QRect geometry() const Q_DECL_OVERRIDE;
- QRect availableGeometry() const Q_DECL_OVERRIDE;
- int depth() const Q_DECL_OVERRIDE;
- QImage::Format format() const Q_DECL_OVERRIDE;
- QSizeF physicalSize() const Q_DECL_OVERRIDE;
- QDpi logicalDpi() const Q_DECL_OVERRIDE;
- qreal pixelDensity() const Q_DECL_OVERRIDE;
+ QRect geometry() const override;
+ QRect availableGeometry() const override;
+ int depth() const override;
+ QImage::Format format() const override;
+ QSizeF physicalSize() const override;
+ QDpi logicalDpi() const override;
+ qreal pixelDensity() const override;
qreal scaleFactor() const;
- QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
+ QPlatformCursor *cursor() const override;
Qt::KeyboardModifiers keyboardModifiers() const;
- Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE;
- Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;
+ Qt::ScreenOrientation nativeOrientation() const override;
+ Qt::ScreenOrientation orientation() const override;
QWindow *topWindow() const;
QWindow *windowAt(const QPoint &pos);
diff --git a/src/plugins/platforms/winrt/qwinrtservices.h b/src/plugins/platforms/winrt/qwinrtservices.h
index 1adc6c381c..80b9a6c92a 100644
--- a/src/plugins/platforms/winrt/qwinrtservices.h
+++ b/src/plugins/platforms/winrt/qwinrtservices.h
@@ -52,8 +52,8 @@ public:
explicit QWinRTServices();
~QWinRTServices();
- bool openUrl(const QUrl &url);
- bool openDocument(const QUrl &url);
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
private:
QScopedPointer<QWinRTServicesPrivate> d_ptr;
diff --git a/src/plugins/platforms/winrt/qwinrttheme.h b/src/plugins/platforms/winrt/qwinrttheme.h
index bd244f9fdb..cc5fc851e7 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.h
+++ b/src/plugins/platforms/winrt/qwinrttheme.h
@@ -54,10 +54,10 @@ class QWinRTTheme : public QPlatformTheme
public:
QWinRTTheme();
- bool usePlatformNativeDialog(DialogType type) const;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
+ bool usePlatformNativeDialog(DialogType type) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
- const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
+ const QPalette *palette(Palette type = SystemPalette) const override;
static QVariant styleHint(QPlatformIntegration::StyleHint hint);
QVariant themeHint(ThemeHint hint) const override;
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.h b/src/plugins/platforms/winrt/qwinrtwindow.h
index 35a4c493b6..26c2fa800d 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.h
+++ b/src/plugins/platforms/winrt/qwinrtwindow.h
@@ -56,19 +56,19 @@ public:
QWinRTWindow(QWindow *window);
~QWinRTWindow();
- QSurfaceFormat format() const;
- bool isActive() const;
- bool isExposed() const;
- void setGeometry(const QRect &rect);
- void setVisible(bool visible);
- void setWindowTitle(const QString &title);
- void raise();
- void lower();
+ QSurfaceFormat format() const override;
+ bool isActive() const override;
+ bool isExposed() const override;
+ void setGeometry(const QRect &rect) override;
+ void setVisible(bool visible) override;
+ void setWindowTitle(const QString &title) override;
+ void raise() override;
+ void lower() override;
- WId winId() const Q_DECL_OVERRIDE;
+ WId winId() const override;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE;
+ qreal devicePixelRatio() const override;
+ void setWindowState(Qt::WindowState state) override;
bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
index 8e1688dbe8..6650ca44ae 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.cpp
@@ -55,29 +55,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
(QXcbGlIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif // !QT_NO_LIBRARY
-QStringList QXcbGlIntegrationFactory::keys(const QString &pluginPath)
-{
- QStringList list;
-#ifndef QT_NO_LIBRARY
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
-#else
- Q_UNUSED(pluginPath);
-#endif
- list.append(loader()->keyMap().values());
- return list;
-}
-
QXcbGlIntegration *QXcbGlIntegrationFactory::create(const QString &platform, const QString &pluginPath)
{
#ifndef QT_NO_LIBRARY
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h
index 633b11a505..c4aa0a3d8d 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegrationfactory.h
@@ -49,7 +49,6 @@ class QXcbGlIntegration;
class QXcbGlIntegrationFactory
{
public:
- static QStringList keys(const QString &pluginPath = QString());
static QXcbGlIntegration *create(const QString &name, const QString &platformPluginPath = QString());
};
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
index 0cb4a878a1..54a9f5cd83 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h
@@ -62,13 +62,13 @@ public:
QXcbEglIntegration();
~QXcbEglIntegration();
- bool initialize(QXcbConnection *connection) Q_DECL_OVERRIDE;
+ bool initialize(QXcbConnection *connection) override;
- QXcbWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
- QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
+ QXcbWindow *createWindow(QWindow *window) const override;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
+ QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
- bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE { return true; }
+ bool supportsThreadedOpenGL() const override { return true; }
EGLDisplay eglDisplay() const { return m_egl_display; }
void *xlib_display() const;
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h
index 6e717e4491..7c83d0e240 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.h
@@ -55,9 +55,9 @@ public:
QXcbEglNativeInterfaceHandler(QXcbNativeInterface *nativeInterface);
- QPlatformNativeInterface::NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) const Q_DECL_OVERRIDE;
- QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const Q_DECL_OVERRIDE;
- QPlatformNativeInterface::NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface::NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) const override;
+ QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const override;
+ QPlatformNativeInterface::NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) const override;
private:
static void *eglDisplay();
static void *eglDisplayForWindow(QWindow *window);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h
index 48fc6dce70..3090cef735 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h
@@ -59,11 +59,11 @@ public:
QXcbEglIntegration *glIntegration() const { return m_glIntegration; }
protected:
- void create() Q_DECL_OVERRIDE;
- void resolveFormat(const QSurfaceFormat &format) Q_DECL_OVERRIDE;
+ void create() override;
+ void resolveFormat(const QSurfaceFormat &format) override;
#ifdef XCB_USE_XLIB
- const xcb_visualtype_t *createVisual() Q_DECL_OVERRIDE;
+ const xcb_visualtype_t *createVisual() override;
#endif
private:
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
index bf1f1b324b..3dfe0ac618 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h
@@ -60,14 +60,14 @@ public:
const QVariant &nativeHandle);
~QGLXContext();
- bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- void doneCurrent() Q_DECL_OVERRIDE;
- void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+ void swapBuffers(QPlatformSurface *surface) override;
+ QFunctionPointer getProcAddress(const char *procName) override;
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
- bool isSharing() const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
+ bool isSharing() const override;
+ bool isValid() const override;
GLXContext glxContext() const { return m_context; }
GLXFBConfig glxConfig() const { return m_config; }
@@ -100,8 +100,8 @@ public:
explicit QGLXPbuffer(QOffscreenSurface *offscreenSurface);
~QGLXPbuffer();
- QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
- bool isValid() const Q_DECL_OVERRIDE { return m_pbuffer != 0; }
+ QSurfaceFormat format() const override { return m_format; }
+ bool isValid() const override { return m_pbuffer != 0; }
GLXPbuffer pbuffer() const { return m_pbuffer; }
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
index 8f04db31b2..26cb233a59 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
@@ -52,15 +52,15 @@ public:
QXcbGlxIntegration();
~QXcbGlxIntegration();
- bool initialize(QXcbConnection *connection) Q_DECL_OVERRIDE;
- bool handleXcbEvent(xcb_generic_event_t *event, uint responseType) Q_DECL_OVERRIDE;
+ bool initialize(QXcbConnection *connection) override;
+ bool handleXcbEvent(xcb_generic_event_t *event, uint responseType) override;
- QXcbWindow *createWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
- QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
+ QXcbWindow *createWindow(QWindow *window) const override;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
+ QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
- virtual bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE;
- virtual bool supportsSwitchableWidgetComposition() const Q_DECL_OVERRIDE;
+ bool supportsThreadedOpenGL() const override;
+ bool supportsSwitchableWidgetComposition() const override;
private:
QXcbConnection *m_connection;
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h
index 1748f2298c..d877732725 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.h
@@ -53,7 +53,7 @@ public:
};
QXcbGlxNativeInterfaceHandler(QXcbNativeInterface *nativeInterface);
- QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const override;
private:
static void *glxContextForContext(QOpenGLContext *context);
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h
index 9519245130..14b2d5e6eb 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.h
@@ -52,7 +52,7 @@ public:
~QXcbGlxWindow();
protected:
- const xcb_visualtype_t *createVisual() Q_DECL_OVERRIDE;
+ const xcb_visualtype_t *createVisual() override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 3d09b1c139..f095288221 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -122,7 +122,7 @@ public:
, m_image(image)
{ }
- bool doLock(AccessTypes access, const QRect &rect) Q_DECL_OVERRIDE
+ bool doLock(AccessTypes access, const QRect &rect) override
{
Q_UNUSED(rect);
if (access & ~(QPlatformGraphicsBuffer::SWReadAccess | QPlatformGraphicsBuffer::SWWriteAccess))
@@ -131,13 +131,13 @@ public:
m_access_lock |= access;
return true;
}
- void doUnlock() Q_DECL_OVERRIDE { m_access_lock = None; }
+ void doUnlock() override { m_access_lock = None; }
- const uchar *data() const Q_DECL_OVERRIDE { return m_image->bits(); }
- uchar *data() Q_DECL_OVERRIDE { return m_image->bits(); }
- int bytesPerLine() const Q_DECL_OVERRIDE { return m_image->bytesPerLine(); }
+ const uchar *data() const override { return m_image->bits(); }
+ uchar *data() override { return m_image->bits(); }
+ int bytesPerLine() const override { return m_image->bytesPerLine(); }
- Origin origin() const Q_DECL_OVERRIDE { return QPlatformGraphicsBuffer::OriginTopLeft; }
+ Origin origin() const override { return QPlatformGraphicsBuffer::OriginTopLeft; }
private:
AccessTypes m_access_lock;
QImage *m_image;
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h
index 6af679d28a..2985432b7f 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.h
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.h
@@ -57,22 +57,22 @@ public:
QXcbBackingStore(QWindow *widget);
~QXcbBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
#ifndef QT_NO_OPENGL
void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context,
- bool translucentBackground) Q_DECL_OVERRIDE;
+ bool translucentBackground) override;
#endif
- QImage toImage() const Q_DECL_OVERRIDE;
+ QImage toImage() const override;
- QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE;
+ QPlatformGraphicsBuffer *graphicsBuffer() const override;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
- bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE;
+ void resize(const QSize &size, const QRegion &staticContents) override;
+ bool scroll(const QRegion &area, int dx, int dy) override;
- void beginPaint(const QRegion &) Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &) override;
+ void endPaint() override;
private:
QXcbShmImage *m_image;
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 38e91cc9f6..cee011bbdf 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -90,7 +90,7 @@ public:
}
protected:
- QStringList formats_sys() const Q_DECL_OVERRIDE
+ QStringList formats_sys() const override
{
if (isEmpty())
return QStringList();
@@ -120,13 +120,13 @@ protected:
return formatList;
}
- bool hasFormat_sys(const QString &format) const Q_DECL_OVERRIDE
+ bool hasFormat_sys(const QString &format) const override
{
QStringList list = formats();
return list.contains(format);
}
- QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const Q_DECL_OVERRIDE
+ QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const override
{
if (fmt.isEmpty() || isEmpty())
return QByteArray();
@@ -238,7 +238,7 @@ public:
}
protected:
- void timerEvent(QTimerEvent *ev) Q_DECL_OVERRIDE
+ void timerEvent(QTimerEvent *ev) override
{
if (ev->timerId() == abort_timer) {
// this can happen when the X client we are sending data
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h
index ffd565c56f..a0a4f4e5a1 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.h
+++ b/src/plugins/platforms/xcb/qxcbclipboard.h
@@ -59,11 +59,11 @@ public:
QXcbClipboard(QXcbConnection *connection);
~QXcbClipboard();
- QMimeData *mimeData(QClipboard::Mode mode) Q_DECL_OVERRIDE;
- void setMimeData(QMimeData *data, QClipboard::Mode mode) Q_DECL_OVERRIDE;
+ QMimeData *mimeData(QClipboard::Mode mode) override;
+ void setMimeData(QMimeData *data, QClipboard::Mode mode) override;
- bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
- bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
+ bool supportsMode(QClipboard::Mode mode) const override;
+ bool ownsMode(QClipboard::Mode mode) const override;
QXcbScreen *screen() const;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 7bd233f387..1af2cf9b89 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -417,7 +417,7 @@ void QXcbConnection::initializeScreens()
qWarning("failed to get the current screen resources");
free(error);
} else {
- xcb_timestamp_t timestamp;
+ xcb_timestamp_t timestamp = 0;
xcb_randr_output_t *outputs = Q_NULLPTR;
int outputCount = xcb_randr_get_screen_resources_current_outputs_length(resources_current.data());
if (outputCount) {
@@ -1996,8 +1996,7 @@ void QXcbConnection::initializeAllAtoms() {
Q_ASSERT(i == QXcbAtom::NPredefinedAtoms);
- QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_");
- settings_atom_name += m_displayName;
+ const QByteArray settings_atom_name = "_QT_SETTINGS_TIMESTAMP_" + m_displayName;
names[i++] = settings_atom_name;
xcb_intern_atom_cookie_t cookies[QXcbAtom::NAtoms];
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index f6ba828a15..a9208ffe09 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -315,7 +315,7 @@ class QXcbEventReader : public QThread
public:
QXcbEventReader(QXcbConnection *connection);
- void run() Q_DECL_OVERRIDE;
+ void run() override;
QXcbEventArray *lock();
void unlock();
@@ -504,6 +504,7 @@ public:
#endif
#ifdef XCB_USE_XINPUT22
+ bool startSystemResizeForTouchBegin(xcb_window_t window, const QPoint &point, Qt::Corner corner);
bool xi2SetMouseGrabEnabled(xcb_window_t w, bool grab);
#endif
Qt::MouseButton xiToQtMouseButton(uint32_t b);
@@ -516,10 +517,11 @@ public:
#ifdef XCB_USE_XINPUT22
bool xi2MouseEvents() const;
+ bool isTouchScreen(int id) const;
#endif
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
public slots:
void flush() { xcb_flush(m_connection); }
@@ -639,6 +641,14 @@ private:
QXcbEventReader *m_reader;
#if defined(XCB_USE_XINPUT2)
QHash<int, XInput2TouchDeviceData*> m_touchDevices;
+#ifdef XCB_USE_XINPUT22
+ struct StartSystemResizeInfo {
+ xcb_window_t window;
+ uint16_t deviceid;
+ uint32_t pointid;
+ Qt::Corner corner;
+ } m_startSystemResizeInfo;
+#endif
#endif
#ifdef Q_XCB_DEBUG
struct CallInfo {
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 93f8db92bf..f4f56f25f1 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -61,9 +61,9 @@ struct XInput2TouchDeviceData {
XIDeviceInfo *xiDeviceInfo;
QTouchDevice *qtTouchDevice;
QHash<int, QWindowSystemInterface::TouchPoint> touchPoints;
+ QHash<int, QPointF> pointPressedPosition; // in screen coordinates where each point was pressed
// Stuff that is relevant only for touchpads
- QHash<int, QPointF> pointPressedPosition; // in screen coordinates where each point was pressed
QPointF firstPressedPosition; // in screen coordinates where the first point was pressed
QPointF firstPressedNormalPosition; // device coordinates (0 to 1, 0 to 1) where the first point was pressed
QSizeF size; // device size in mm
@@ -93,6 +93,7 @@ void QXcbConnection::initializeXInput2()
if (m_xi2Enabled) {
#ifdef XCB_USE_XINPUT22
qCDebug(lcQpaXInputDevices, "XInput version %d.%d is available and Qt supports 2.2 or greater", xiMajor, m_xi2Minor);
+ m_startSystemResizeInfo.window = XCB_NONE;
#else
qCDebug(lcQpaXInputDevices, "XInput version %d.%d is available and Qt supports 2.0", xiMajor, m_xi2Minor);
#endif
@@ -714,7 +715,21 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
touchPoint.state = Qt::TouchPointMoved;
} else if (touchPoint.area.center() != QPoint(x, y)) {
touchPoint.state = Qt::TouchPointMoved;
- dev->pointPressedPosition[touchPoint.id] = QPointF(x, y);
+ if (dev->qtTouchDevice->type() == QTouchDevice::TouchPad)
+ dev->pointPressedPosition[touchPoint.id] = QPointF(x, y);
+ }
+
+ if (dev->qtTouchDevice->type() == QTouchDevice::TouchScreen &&
+ xiDeviceEvent->event == m_startSystemResizeInfo.window &&
+ xiDeviceEvent->sourceid == m_startSystemResizeInfo.deviceid &&
+ xiDeviceEvent->detail == m_startSystemResizeInfo.pointid) {
+ QXcbWindow *window = platformWindowFromId(m_startSystemResizeInfo.window);
+ if (window) {
+ XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid,
+ xiDeviceEvent->detail, xiDeviceEvent->event, XIRejectTouch);
+ window->doStartSystemResize(QPoint(x, y), m_startSystemResizeInfo.corner);
+ m_startSystemResizeInfo.window = XCB_NONE;
+ }
}
break;
case XI_TouchEnd:
@@ -745,6 +760,27 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
touchPoint.state = Qt::TouchPointStationary;
}
+bool QXcbConnection::startSystemResizeForTouchBegin(xcb_window_t window, const QPoint &point, Qt::Corner corner)
+{
+ QHash<int, XInput2TouchDeviceData*>::const_iterator devIt = m_touchDevices.constBegin();
+ for (; devIt != m_touchDevices.constEnd(); ++devIt) {
+ XInput2TouchDeviceData *deviceData = devIt.value();
+ if (deviceData->qtTouchDevice->type() == QTouchDevice::TouchScreen) {
+ QHash<int, QPointF>::const_iterator pointIt = deviceData->pointPressedPosition.constBegin();
+ for (; pointIt != deviceData->pointPressedPosition.constEnd(); ++pointIt) {
+ if (pointIt.value().toPoint() == point) {
+ m_startSystemResizeInfo.window = window;
+ m_startSystemResizeInfo.deviceid = devIt.key();
+ m_startSystemResizeInfo.pointid = pointIt.key();
+ m_startSystemResizeInfo.corner = corner;
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
bool QXcbConnection::xi2SetMouseGrabEnabled(xcb_window_t w, bool grab)
{
if (grab && !canGrab())
@@ -989,6 +1025,13 @@ Qt::MouseButton QXcbConnection::xiToQtMouseButton(uint32_t b)
return Qt::NoButton;
}
+bool QXcbConnection::isTouchScreen(int id) const
+{
+ auto device = m_touchDevices.value(id);
+ return device && device->qtTouchDevice
+ && device->qtTouchDevice->type() == QTouchDevice::TouchScreen;
+}
+
static QTabletEvent::TabletDevice toolIdToTabletDevice(quint32 toolId) {
// keep in sync with wacom_intuos_inout() in Linux kernel driver wacom_wac.c
switch (toolId) {
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 3284a9e3e1..c15225f6d2 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -76,10 +76,10 @@ public:
QXcbCursor(QXcbConnection *conn, QXcbScreen *screen);
~QXcbCursor();
#ifndef QT_NO_CURSOR
- void changeCursor(QCursor *cursor, QWindow *widget) Q_DECL_OVERRIDE;
+ void changeCursor(QCursor *cursor, QWindow *widget) override;
#endif
- QPoint pos() const Q_DECL_OVERRIDE;
- void setPos(const QPoint &pos) Q_DECL_OVERRIDE;
+ QPoint pos() const override;
+ void setPos(const QPoint &pos) override;
static void queryPointer(QXcbConnection *c, QXcbVirtualDesktop **virtualDesktop, QPoint *pos, int *keybMask = 0);
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 4915bb1b11..58fb1f3918 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -130,9 +130,9 @@ public:
~QXcbDropData();
protected:
- bool hasFormat_sys(const QString &mimeType) const Q_DECL_OVERRIDE;
- QStringList formats_sys() const Q_DECL_OVERRIDE;
- QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE;
+ bool hasFormat_sys(const QString &mimeType) const override;
+ QStringList formats_sys() const override;
+ QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const override;
QVariant xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const;
@@ -1121,6 +1121,9 @@ void QXcbDrag::cancel()
QBasicDrag::cancel();
if (current_target)
send_leave();
+
+ // remove canceled object
+ currentDrag()->deleteLater();
}
// find an ancestor with XdndAware on it
diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h
index cb6e95cc9a..2d152edf76 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.h
+++ b/src/plugins/platforms/xcb/qxcbdrag.h
@@ -74,14 +74,14 @@ public:
QXcbDrag(QXcbConnection *c);
~QXcbDrag();
- virtual QMimeData *platformDropData() Q_DECL_OVERRIDE;
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ QMimeData *platformDropData() override;
+ bool eventFilter(QObject *o, QEvent *e) override;
- void startDrag() Q_DECL_OVERRIDE;
- void cancel() Q_DECL_OVERRIDE;
- void move(const QPoint &globalPos) Q_DECL_OVERRIDE;
- void drop(const QPoint &globalPos) Q_DECL_OVERRIDE;
- void endDrag() Q_DECL_OVERRIDE;
+ void startDrag() override;
+ void cancel() override;
+ void move(const QPoint &globalPos) override;
+ void drop(const QPoint &globalPos) override;
+ void endDrag() override;
void handleEnter(QPlatformWindow *window, const xcb_client_message_event_t *event, xcb_window_t proxy = 0);
void handlePosition(QPlatformWindow *w, const xcb_client_message_event_t *event);
@@ -93,13 +93,13 @@ public:
void handleFinished(const xcb_client_message_event_t *event);
bool dndEnable(QXcbWindow *win, bool on);
- bool ownsDragObject() const Q_DECL_OVERRIDE;
+ bool ownsDragObject() const override;
void updatePixmap();
xcb_timestamp_t targetTime() { return target_time; }
protected:
- void timerEvent(QTimerEvent* e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent* e) override;
private:
friend class QXcbDropData;
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index f4da7ba033..af9ffab8ae 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -447,12 +447,8 @@ QByteArray QXcbIntegration::wmClass() const
className[0] = className.at(0).toUpper();
}
- if (!name.isEmpty() && !className.isEmpty()) {
- m_wmClass = name.toLocal8Bit();
- m_wmClass.append('\0');
- m_wmClass.append(className.toLocal8Bit());
- m_wmClass.append('\0');
- }
+ if (!name.isEmpty() && !className.isEmpty())
+ m_wmClass = name.toLocal8Bit() + '\0' + className.toLocal8Bit() + '\0';
}
return m_wmClass;
}
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index 34dd44d491..f8034f436f 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -60,57 +60,57 @@ public:
QXcbIntegration(const QStringList &parameters, int &argc, char **argv);
~QXcbIntegration();
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
#ifndef QT_NO_OPENGL
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
#endif
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
- QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
+ QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
- bool hasCapability(Capability cap) const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
- void initialize() Q_DECL_OVERRIDE;
+ bool hasCapability(Capability cap) const override;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
+ void initialize() override;
void moveToScreen(QWindow *window, int screen);
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+ QPlatformFontDatabase *fontDatabase() const override;
- QPlatformNativeInterface *nativeInterface()const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface *nativeInterface()const override;
#ifndef QT_NO_CLIPBOARD
- QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
+ QPlatformClipboard *clipboard() const override;
#endif
#ifndef QT_NO_DRAGANDDROP
- QPlatformDrag *drag() const Q_DECL_OVERRIDE;
+ QPlatformDrag *drag() const override;
#endif
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
+ QPlatformInputContext *inputContext() const override;
#ifndef QT_NO_ACCESSIBILITY
- QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE;
+ QPlatformAccessibility *accessibility() const override;
#endif
- QPlatformServices *services() const Q_DECL_OVERRIDE;
+ QPlatformServices *services() const override;
- Qt::KeyboardModifiers queryKeyboardModifiers() const Q_DECL_OVERRIDE;
- QList<int> possibleKeys(const QKeyEvent *e) const Q_DECL_OVERRIDE;
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
+ QList<int> possibleKeys(const QKeyEvent *e) const override;
- QStringList themeNames() const Q_DECL_OVERRIDE;
- QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE;
- QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
+ QStringList themeNames() const override;
+ QPlatformTheme *createPlatformTheme(const QString &name) const override;
+ QVariant styleHint(StyleHint hint) const override;
QXcbConnection *defaultConnection() const { return m_connections.first(); }
QByteArray wmClass() const;
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM)
- QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE;
+ QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override;
#endif
- void sync() Q_DECL_OVERRIDE;
+ void sync() override;
- void beep() const Q_DECL_OVERRIDE;
+ void beep() const override;
static QXcbIntegration *instance() { return m_instance; }
diff --git a/src/plugins/platforms/xcb/qxcbmain.cpp b/src/plugins/platforms/xcb/qxcbmain.cpp
index ab55bb7691..f8cb9a9269 100644
--- a/src/plugins/platforms/xcb/qxcbmain.cpp
+++ b/src/plugins/platforms/xcb/qxcbmain.cpp
@@ -47,7 +47,7 @@ class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "xcb.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&, int &, char **) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&, int &, char **) override;
};
QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv)
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index acecbf4116..a830829311 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -78,22 +78,22 @@ public:
QXcbNativeInterface();
- void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
- void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) Q_DECL_OVERRIDE;
- void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) Q_DECL_OVERRIDE;
- void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE;
- void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) Q_DECL_OVERRIDE;
+ void *nativeResourceForIntegration(const QByteArray &resource) override;
+ void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) override;
+ void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
+ void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) override;
+ void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) override;
#ifndef QT_NO_CURSOR
- void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) Q_DECL_OVERRIDE;
+ void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override;
#endif
- NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
- NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
- NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) Q_DECL_OVERRIDE;
- NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) Q_DECL_OVERRIDE;
- NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) Q_DECL_OVERRIDE;
+ NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override;
+ NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override;
+ NativeResourceForScreenFunction nativeResourceFunctionForScreen(const QByteArray &resource) override;
+ NativeResourceForWindowFunction nativeResourceFunctionForWindow(const QByteArray &resource) override;
+ NativeResourceForBackingStoreFunction nativeResourceFunctionForBackingStore(const QByteArray &resource) override;
- QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE;
+ QFunctionPointer platformFunction(const QByteArray &function) const override;
inline const QByteArray &genericEventFilterType() const { return m_genericEventFilterType; }
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 0d32c3d624..627397fcaf 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -115,24 +115,24 @@ public:
QString getOutputName(xcb_randr_get_output_info_reply_t *outputInfo);
- QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
+ QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
- QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE;
+ QWindow *topLevelAt(const QPoint &point) const override;
- QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; }
- QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;}
- int depth() const Q_DECL_OVERRIDE { return screen()->root_depth; }
- QImage::Format format() const Q_DECL_OVERRIDE;
- QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_sizeMillimeters; }
+ QRect geometry() const override { return m_geometry; }
+ QRect availableGeometry() const override {return m_availableGeometry;}
+ int depth() const override { return screen()->root_depth; }
+ QImage::Format format() const override;
+ QSizeF physicalSize() const override { return m_sizeMillimeters; }
QSize virtualSize() const { return m_virtualSize; }
QSizeF physicalVirtualSize() const { return m_virtualSizeMillimeters; }
QDpi virtualDpi() const;
- QDpi logicalDpi() const Q_DECL_OVERRIDE;
- qreal pixelDensity() const Q_DECL_OVERRIDE;
- QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
- qreal refreshRate() const Q_DECL_OVERRIDE { return m_refreshRate; }
- Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE { return m_orientation; }
- QList<QPlatformScreen *> virtualSiblings() const Q_DECL_OVERRIDE { return m_virtualDesktop->screens(); }
+ QDpi logicalDpi() const override;
+ qreal pixelDensity() const override;
+ QPlatformCursor *cursor() const override;
+ qreal refreshRate() const override { return m_refreshRate; }
+ Qt::ScreenOrientation orientation() const override { return m_orientation; }
+ QList<QPlatformScreen *> virtualSiblings() const override { return m_virtualDesktop->screens(); }
QXcbVirtualDesktop *virtualDesktop() const { return m_virtualDesktop; }
void setPrimary(bool primary) { m_primary = primary; }
@@ -161,7 +161,7 @@ public:
const xcb_visualtype_t *visualForId(xcb_visualid_t) const;
quint8 depthOfVisual(xcb_visualid_t) const;
- QString name() const Q_DECL_OVERRIDE { return m_outputName; }
+ QString name() const override { return m_outputName; }
void handleScreenChange(xcb_randr_screen_change_notify_event_t *change_event);
void updateGeometry(const QRect &geom, uint8_t rotation);
diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.h b/src/plugins/platforms/xcb/qxcbsessionmanager.h
index a184282034..0ad9445361 100644
--- a/src/plugins/platforms/xcb/qxcbsessionmanager.h
+++ b/src/plugins/platforms/xcb/qxcbsessionmanager.h
@@ -69,17 +69,17 @@ public:
void setSessionId(const QString &id) { m_sessionId = id; }
void setSessionKey(const QString &key) { m_sessionKey = key; }
- bool allowsInteraction() Q_DECL_OVERRIDE;
- bool allowsErrorInteraction() Q_DECL_OVERRIDE;
- void release() Q_DECL_OVERRIDE;
+ bool allowsInteraction() override;
+ bool allowsErrorInteraction() override;
+ void release() override;
- void cancel() Q_DECL_OVERRIDE;
+ void cancel() override;
- void setManagerProperty(const QString &name, const QString &value) Q_DECL_OVERRIDE;
- void setManagerProperty(const QString &name, const QStringList &value) Q_DECL_OVERRIDE;
+ void setManagerProperty(const QString &name, const QString &value) override;
+ void setManagerProperty(const QString &name, const QStringList &value) override;
- bool isPhase2() const Q_DECL_OVERRIDE;
- void requestPhase2() Q_DECL_OVERRIDE;
+ bool isPhase2() const override;
+ void requestPhase2() override;
void exitEventLoop();
diff --git a/src/plugins/platforms/xcb/qxcbsystemtraytracker.h b/src/plugins/platforms/xcb/qxcbsystemtraytracker.h
index 5cca4782aa..a6131e6d0e 100644
--- a/src/plugins/platforms/xcb/qxcbsystemtraytracker.h
+++ b/src/plugins/platforms/xcb/qxcbsystemtraytracker.h
@@ -61,7 +61,7 @@ public:
void notifyManagerClientMessageEvent(const xcb_client_message_event_t *);
- void handleDestroyNotifyEvent(const xcb_destroy_notify_event_t *) Q_DECL_OVERRIDE;
+ void handleDestroyNotifyEvent(const xcb_destroy_notify_event_t *) override;
bool visualHasAlphaChannel();
signals:
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 0c8e78491e..ffbe9a2325 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -315,6 +315,7 @@ static const char *wm_window_role_property_id = "_q_xcb_wm_window_role";
QXcbWindow::QXcbWindow(QWindow *window)
: QPlatformWindow(window)
, m_window(0)
+ , m_cmap(0)
, m_syncCounter(0)
, m_gravity(XCB_GRAVITY_STATIC)
, m_mapped(false)
@@ -443,7 +444,6 @@ void QXcbWindow::create()
m_visualId = visual->visual_id;
m_depth = platformScreen->depthOfVisual(m_visualId);
m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap);
- xcb_colormap_t colormap = 0;
quint32 mask = XCB_CW_BACK_PIXMAP
| XCB_CW_BORDER_PIXEL
@@ -455,10 +455,10 @@ void QXcbWindow::create()
static const bool haveOpenGL = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL);
if ((window()->supportsOpenGL() && haveOpenGL) || m_format.hasAlpha()) {
- colormap = xcb_generate_id(xcb_connection());
+ m_cmap = xcb_generate_id(xcb_connection());
Q_XCB_CALL(xcb_create_colormap(xcb_connection(),
XCB_COLORMAP_ALLOC_NONE,
- colormap,
+ m_cmap,
xcb_parent_id,
m_visualId));
@@ -472,7 +472,7 @@ void QXcbWindow::create()
type == Qt::Popup || type == Qt::ToolTip || (window()->flags() & Qt::BypassWindowManagerHint),
type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer,
defaultEventMask,
- colormap
+ m_cmap
};
m_window = xcb_generate_id(xcb_connection());
@@ -638,6 +638,9 @@ void QXcbWindow::destroy()
Q_XCB_CALL(xcb_destroy_window(xcb_connection(), m_window));
m_window = 0;
}
+ if (m_cmap) {
+ xcb_free_colormap(xcb_connection(), m_cmap);
+ }
m_mapped = false;
if (m_pendingSyncRequest)
@@ -2423,22 +2426,27 @@ static inline int fixed1616ToInt(FP1616 val)
return int((qreal(val >> 16)) + (val & 0xFFFF) / (qreal)0xFFFF);
}
-void QXcbWindow::handleXIMouseButtonState(const xcb_ge_event_t *event)
+// With XI 2.2+ press/release/motion comes here instead of the above handlers.
+void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source)
{
QXcbConnection *conn = connection();
- const xXIDeviceEvent *ev = reinterpret_cast<const xXIDeviceEvent *>(event);
+ xXIDeviceEvent *ev = reinterpret_cast<xXIDeviceEvent *>(event);
+
if (ev->buttons_len > 0) {
unsigned char *buttonMask = (unsigned char *) &ev[1];
+ // There is a bug in the evdev driver which leads to receiving mouse events without
+ // XIPointerEmulated being set: https://bugs.freedesktop.org/show_bug.cgi?id=98188
+ // Filter them out by other attributes: when their source device is a touch screen
+ // and the LMB is pressed.
+ if (XIMaskIsSet(buttonMask, 1) && conn->isTouchScreen(ev->sourceid)) {
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInput, "XI2 mouse event from touch device %d was ignored", ev->sourceid);
+ return;
+ }
for (int i = 1; i <= 15; ++i)
conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i));
}
-}
-// With XI 2.2+ press/release/motion comes here instead of the above handlers.
-void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source)
-{
- QXcbConnection *conn = connection();
- xXIDeviceEvent *ev = reinterpret_cast<xXIDeviceEvent *>(event);
const Qt::KeyboardModifiers modifiers = conn->keyboard()->translateModifiers(ev->mods.effective_mods);
const int event_x = fixed1616ToInt(ev->event_x);
const int event_y = fixed1616ToInt(ev->event_y);
@@ -2458,23 +2466,18 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
switch (ev->evtype) {
case XI_ButtonPress:
- handleXIMouseButtonState(event);
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButton(button, true);
handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
break;
case XI_ButtonRelease:
- handleXIMouseButtonState(event);
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButton(button, false);
handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
break;
case XI_Motion:
- // Here we do NOT call handleXIMouseButtonState because we don't expect button state change to be bundled with motion.
- // When a touchscreen is pressed, an XI_Motion event occurs in which XIMaskIsSet says the left button is pressed,
- // but we don't want QGuiApplicationPrivate::processMouseEvent() to react by generating a mouse press event.
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName);
handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source);
@@ -2738,13 +2741,23 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner)
const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE);
if (!connection()->wmSupport()->isSupportedByWM(moveResize))
return false;
+ const QPoint globalPos = QHighDpi::toNativePixels(window()->mapToGlobal(pos), window()->screen());
+#ifdef XCB_USE_XINPUT22
+ if (connection()->startSystemResizeForTouchBegin(m_window, globalPos, corner))
+ return true;
+#endif
+ return doStartSystemResize(globalPos, corner);
+}
+
+bool QXcbWindow::doStartSystemResize(const QPoint &globalPos, Qt::Corner corner)
+{
+ const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE);
xcb_client_message_event_t xev;
xev.response_type = XCB_CLIENT_MESSAGE;
xev.type = moveResize;
xev.sequence = 0;
xev.window = xcb_window();
xev.format = 32;
- const QPoint globalPos = window()->mapToGlobal(pos);
xev.data.data32[0] = globalPos.x();
xev.data.data32[1] = globalPos.y();
const bool bottom = corner == Qt::BottomRightCorner || corner == Qt::BottomLeftCorner;
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 92f3f7a67c..d100120d46 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -76,75 +76,74 @@ public:
QXcbWindow(QWindow *window);
~QXcbWindow();
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) override;
- QMargins frameMargins() const Q_DECL_OVERRIDE;
+ QMargins frameMargins() const override;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
- void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE;
- WId winId() const Q_DECL_OVERRIDE;
- void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
+ void setWindowFlags(Qt::WindowFlags flags) override;
+ void setWindowState(Qt::WindowState state) override;
+ WId winId() const override;
+ void setParent(const QPlatformWindow *window) override;
- bool isExposed() const Q_DECL_OVERRIDE;
- bool isEmbedded(const QPlatformWindow *parentWindow = 0) const Q_DECL_OVERRIDE;
- QPoint mapToGlobal(const QPoint &pos) const Q_DECL_OVERRIDE;
- QPoint mapFromGlobal(const QPoint &pos) const Q_DECL_OVERRIDE;
+ bool isExposed() const override;
+ bool isEmbedded(const QPlatformWindow *parentWindow = 0) const override;
+ QPoint mapToGlobal(const QPoint &pos) const override;
+ QPoint mapFromGlobal(const QPoint &pos) const override;
- void setWindowTitle(const QString &title) Q_DECL_OVERRIDE;
+ void setWindowTitle(const QString &title) override;
void setWindowIconText(const QString &title);
- void setWindowIcon(const QIcon &icon) Q_DECL_OVERRIDE;
- void raise() Q_DECL_OVERRIDE;
- void lower() Q_DECL_OVERRIDE;
- void propagateSizeHints() Q_DECL_OVERRIDE;
+ void setWindowIcon(const QIcon &icon) override;
+ void raise() override;
+ void lower() override;
+ void propagateSizeHints() override;
- void requestActivateWindow() Q_DECL_OVERRIDE;
+ void requestActivateWindow() override;
- bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
- bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
+ bool setKeyboardGrabEnabled(bool grab) override;
+ bool setMouseGrabEnabled(bool grab) override;
void setCursor(xcb_cursor_t cursor, bool isBitmapCursor);
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
- void windowEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void windowEvent(QEvent *event) override;
- bool startSystemResize(const QPoint &pos, Qt::Corner corner) Q_DECL_OVERRIDE;
+ bool startSystemResize(const QPoint &pos, Qt::Corner corner) override;
- void setOpacity(qreal level) Q_DECL_OVERRIDE;
- void setMask(const QRegion &region) Q_DECL_OVERRIDE;
+ void setOpacity(qreal level) override;
+ void setMask(const QRegion &region) override;
- void setAlertState(bool enabled) Q_DECL_OVERRIDE;
- bool isAlertState() const Q_DECL_OVERRIDE { return m_alertState; }
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override { return m_alertState; }
xcb_window_t xcb_window() const { return m_window; }
uint depth() const { return m_depth; }
QImage::Format imageFormat() const { return m_imageFormat; }
bool imageNeedsRgbSwap() const { return m_imageRgbSwap; }
- bool handleGenericEvent(xcb_generic_event_t *event, long *result) Q_DECL_OVERRIDE;
-
- void handleExposeEvent(const xcb_expose_event_t *event) Q_DECL_OVERRIDE;
- void handleClientMessageEvent(const xcb_client_message_event_t *event) Q_DECL_OVERRIDE;
- void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) Q_DECL_OVERRIDE;
- void handleMapNotifyEvent(const xcb_map_notify_event_t *event) Q_DECL_OVERRIDE;
- void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) Q_DECL_OVERRIDE;
- void handleButtonPressEvent(const xcb_button_press_event_t *event) Q_DECL_OVERRIDE;
- void handleButtonReleaseEvent(const xcb_button_release_event_t *event) Q_DECL_OVERRIDE;
- void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) Q_DECL_OVERRIDE;
-
- void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) Q_DECL_OVERRIDE;
- void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) Q_DECL_OVERRIDE;
- void handleFocusInEvent(const xcb_focus_in_event_t *event) Q_DECL_OVERRIDE;
- void handleFocusOutEvent(const xcb_focus_out_event_t *event) Q_DECL_OVERRIDE;
- void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE;
+ bool handleGenericEvent(xcb_generic_event_t *event, long *result) override;
+
+ void handleExposeEvent(const xcb_expose_event_t *event) override;
+ void handleClientMessageEvent(const xcb_client_message_event_t *event) override;
+ void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) override;
+ void handleMapNotifyEvent(const xcb_map_notify_event_t *event) override;
+ void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) override;
+ void handleButtonPressEvent(const xcb_button_press_event_t *event) override;
+ void handleButtonReleaseEvent(const xcb_button_release_event_t *event) override;
+ void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) override;
+
+ void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) override;
+ void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) override;
+ void handleFocusInEvent(const xcb_focus_in_event_t *event) override;
+ void handleFocusOutEvent(const xcb_focus_out_event_t *event) override;
+ void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override;
#ifdef XCB_USE_XINPUT22
- void handleXIMouseButtonState(const xcb_ge_event_t *);
- void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) Q_DECL_OVERRIDE;
- void handleXIEnterLeave(xcb_ge_event_t *) Q_DECL_OVERRIDE;
+ void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) override;
+ void handleXIEnterLeave(xcb_ge_event_t *) override;
#endif
- QXcbWindow *toWindow() Q_DECL_OVERRIDE;
+ QXcbWindow *toWindow() override;
void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global,
Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source);
@@ -178,6 +177,8 @@ public:
QXcbScreen *xcbScreen() const;
+ bool doStartSystemResize(const QPoint &globalPos, Qt::Corner corner);
+
virtual void create();
virtual void destroy();
@@ -233,6 +234,7 @@ protected:
quint8 mode, quint8 detail, xcb_timestamp_t timestamp);
xcb_window_t m_window;
+ xcb_colormap_t m_cmap;
uint m_depth;
QImage::Format m_imageFormat;
diff --git a/src/plugins/platforms/xcb/qxcbxsettings.h b/src/plugins/platforms/xcb/qxcbxsettings.h
index ff1932734a..ab1f784274 100644
--- a/src/plugins/platforms/xcb/qxcbxsettings.h
+++ b/src/plugins/platforms/xcb/qxcbxsettings.h
@@ -61,7 +61,7 @@ public:
void removeCallbackForHandle(const QByteArray &property, void *handle);
void removeCallbackForHandle(void *handle);
- void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE;
+ void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) override;
private:
QXcbXSettingsPrivate *d_ptr;
};
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 941c25361f..620d9cb8c9 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += network
-SUBDIRS *= sqldrivers
+qtHaveModule(sql): SUBDIRS += sqldrivers
qtHaveModule(network):qtConfig(bearermanagement): SUBDIRS += bearer
qtHaveModule(gui) {
SUBDIRS *= platforms platforminputcontexts platformthemes
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 0bea9ebfa1..7cfa554418 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -699,10 +699,8 @@ QVariant QMYSQLResult::data(int field)
}
if(ok)
return v;
- else
- return QVariant();
+ return QVariant();
}
- return QVariant(val.toDouble());
case QVariant::Date:
return qDateFromString(val);
case QVariant::Time:
@@ -719,12 +717,11 @@ QVariant QMYSQLResult::data(int field)
}
return QVariant(ba);
}
- default:
case QVariant::String:
+ default:
return QVariant(val);
}
- qWarning("QMYSQLResult::data: unknown data type");
- return QVariant();
+ Q_UNREACHABLE();
}
bool QMYSQLResult::isNull(int field)
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 47d6db7ea4..32d3681a17 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -2405,16 +2405,16 @@ static QString make_where_clause(const QString &user, Expression e)
static const char joinC[][4] = { "or" , "and" };
static Q_CONSTEXPR QLatin1Char bang[] = { QLatin1Char(' '), QLatin1Char('!') };
- const QLatin1String join(joinC[e], -1); // -1: force strlen call
+ const QLatin1String join(joinC[e]);
QString result;
result.reserve(sizeof sysUsers / sizeof *sysUsers *
// max-sizeof(owner != <sysuser> and )
(9 + sizeof *sysUsers + 5));
for (const auto &sysUser : sysUsers) {
- const QLatin1String l1(sysUser, -1); // -1: force strlen call
+ const QLatin1String l1(sysUser);
if (l1 != user)
- result += QLatin1String("owner ") + bang[e] + QLatin1String("= '") + l1 + QLatin1Char(' ') + join + QLatin1Char(' ');
+ result += QLatin1String("owner ") + bang[e] + QLatin1String("= '") + l1 + QLatin1String("' ") + join + QLatin1Char(' ');
}
result.chop(join.size() + 2); // remove final " <join> "
diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h
index e8eee2ca9c..f18406af4b 100644
--- a/src/printsupport/dialogs/qabstractprintdialog.h
+++ b/src/printsupport/dialogs/qabstractprintdialog.h
@@ -83,7 +83,7 @@ public:
explicit QAbstractPrintDialog(QPrinter *printer, QWidget *parent = Q_NULLPTR);
~QAbstractPrintDialog();
- virtual int exec() = 0;
+ int exec() override = 0;
// obsolete
void addEnabledOption(PrintDialogOption option);
diff --git a/src/printsupport/kernel/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h
index b5ba98bf88..efae442690 100644
--- a/src/printsupport/kernel/qpaintengine_alpha_p.h
+++ b/src/printsupport/kernel/qpaintengine_alpha_p.h
@@ -67,18 +67,18 @@ class Q_PRINTSUPPORT_EXPORT QAlphaPaintEngine : public QPaintEngine
public:
~QAlphaPaintEngine();
- virtual bool begin(QPaintDevice *pdev);
- virtual bool end();
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- virtual void updateState(const QPaintEngineState &state);
+ void updateState(const QPaintEngineState &state) override;
- virtual void drawPath(const QPainterPath &path);
+ void drawPath(const QPainterPath &path) override;
- virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
protected:
QAlphaPaintEngine(QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps = 0);
diff --git a/src/printsupport/kernel/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h
index 6277451bfa..31b3142cb6 100644
--- a/src/printsupport/kernel/qpaintengine_preview_p.h
+++ b/src/printsupport/kernel/qpaintengine_preview_p.h
@@ -69,33 +69,33 @@ public:
QPreviewPaintEngine();
~QPreviewPaintEngine();
- bool begin(QPaintDevice *dev);
- bool end();
+ bool begin(QPaintDevice *dev) override;
+ bool end() override;
- void updateState(const QPaintEngineState &state);
+ void updateState(const QPaintEngineState &state) override;
- void drawPath(const QPainterPath &path);
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- void drawTextItem(const QPointF &p, const QTextItem &textItem);
+ void drawPath(const QPainterPath &path) override;
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &p) override;
QList<const QPicture *> pages();
- QPaintEngine::Type type() const { return Picture; }
+ QPaintEngine::Type type() const override { return Picture; }
void setProxyEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine);
- void setProperty(PrintEnginePropertyKey key, const QVariant &value);
- QVariant property(PrintEnginePropertyKey key) const;
+ void setProperty(PrintEnginePropertyKey key, const QVariant &value) override;
+ QVariant property(PrintEnginePropertyKey key) const override;
- bool newPage();
- bool abort();
+ bool newPage() override;
+ bool abort() override;
- int metric(QPaintDevice::PaintDeviceMetric) const;
+ int metric(QPaintDevice::PaintDeviceMetric) const override;
- QPrinter::PrinterState printerState() const;
+ QPrinter::PrinterState printerState() const override;
};
QT_END_NAMESPACE
diff --git a/src/sql/configure.json b/src/sql/configure.json
index 96c82e84f9..72671b6df9 100644
--- a/src/sql/configure.json
+++ b/src/sql/configure.json
@@ -58,8 +58,10 @@
"label": "MySQL",
"test": "unix/mysql",
"sources": [
- { "type": "mysqlConfig", "query": "--libs_r" },
- { "type": "mysqlConfig", "query": "--libs" },
+ { "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": true },
+ { "type": "mysqlConfig", "query": "--libs", "cleanlibs": true },
+ { "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": false },
+ { "type": "mysqlConfig", "query": "--libs", "cleanlibs": false },
{ "libs": "-lmysqlclient_r", "condition": "!config.win32" },
{ "libs": "-llibmysql", "condition": "config.win32" },
{ "libs": "-lmysqlclient", "condition": "!config.win32" }
diff --git a/src/sql/configure.pri b/src/sql/configure.pri
index 1d8847b4bc..a8bc09e524 100644
--- a/src/sql/configure.pri
+++ b/src/sql/configure.pri
@@ -26,6 +26,7 @@ defineTest(qtConfLibrary_psqlConfig) {
export($${1}.includedir)
return(true)
}
+ qtLog("pg_config not found.")
return(false)
}
@@ -57,6 +58,14 @@ defineTest(qtConfLibrary_mysqlConfig) {
libs = $$filterLibraryPath($$libs)
# -rdynamic should not be returned by mysql_config, but is on RHEL 6.6
libs -= -rdynamic
+ equals($${1}.cleanlibs, true) {
+ for(l, libs) {
+ # Drop all options besides the -L one and the -lmysqlclient one
+ # so we don't unnecessarily link to libs like OpenSSL
+ contains(l, "^(-L|-lmysqlclient).*"): cleanlibs += $$l
+ }
+ libs = $$cleanlibs
+ }
$${1}.libs = "$$val_escape(libs)"
eval(includedir = $$includedir)
includedir ~= s/^-I//g
@@ -66,6 +75,7 @@ defineTest(qtConfLibrary_mysqlConfig) {
export($${1}.includedir)
return(true)
}
+ qtLog("mysql_config not found.")
return(false)
}
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index e98bf28d3b..f295de7396 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -65,7 +65,7 @@ explicit QSqlRelationalDelegate(QObject *aParent = 0)
QWidget *createEditor(QWidget *aParent,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+ const QModelIndex &index) const override
{
const QSqlRelationalTableModel *sqlModel = qobject_cast<const QSqlRelationalTableModel *>(index.model());
QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
@@ -80,7 +80,7 @@ QWidget *createEditor(QWidget *aParent,
return combo;
}
-void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
{
if (!index.isValid())
return;
diff --git a/src/src.pro b/src/src.pro
index 90d7e2b76c..c0366f32b6 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -124,7 +124,6 @@ src_printsupport.depends = src_corelib src_gui src_widgets src_tools_uic
src_plugins.subdir = $$PWD/plugins
src_plugins.target = sub-plugins
-src_plugins.depends = src_sql src_xml src_network
src_android.subdir = $$PWD/android
@@ -144,7 +143,16 @@ qtConfig(regularexpression):pcre {
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
+qtConfig(network) {
+ SUBDIRS += src_network
+ src_plugins.depends += src_network
+}
+qtConfig(sql) {
+ SUBDIRS += src_sql
+ src_plugins.depends += src_sql
+}
+qtConfig(xml): SUBDIRS += src_xml
+qtConfig(testlib): SUBDIRS += src_testlib
qtConfig(dbus) {
force_dbus_bootstrap|qtConfig(private_tests): \
SUBDIRS += src_tools_bootstrap_dbus
diff --git a/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp b/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp
index fdcbdc603c..a4513a55a9 100644
--- a/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp
+++ b/src/testlib/doc/snippets/code/doc_src_qsignalspy.cpp
@@ -69,7 +69,7 @@ myCustomObject->doSomething(); // trigger emission of the signal
QList<QVariant> arguments = spy.takeFirst();
QVERIFY(arguments.at(0).type() == QVariant::Int);
-QVERIFY(arguments.at(1).type() == QVariant::QString);
+QVERIFY(arguments.at(1).type() == QVariant::String);
QVERIFY(arguments.at(2).type() == QVariant::double);
//! [1]
diff --git a/src/testlib/qbenchmarkevent_p.h b/src/testlib/qbenchmarkevent_p.h
index 8231b57127..af42a17141 100644
--- a/src/testlib/qbenchmarkevent_p.h
+++ b/src/testlib/qbenchmarkevent_p.h
@@ -63,15 +63,15 @@ class QBenchmarkEvent : public QBenchmarkMeasurerBase, public QAbstractNativeEve
public:
QBenchmarkEvent();
~QBenchmarkEvent();
- void start();
- qint64 checkpoint();
- qint64 stop();
- bool isMeasurementAccepted(qint64 measurement);
- int adjustIterationCount(int suggestion);
- int adjustMedianCount(int suggestion);
- bool repeatCount() { return 1; }
- QTest::QBenchmarkMetric metricType();
- virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
+ void start() override;
+ qint64 checkpoint() override;
+ qint64 stop() override;
+ bool isMeasurementAccepted(qint64 measurement) override;
+ int adjustIterationCount(int suggestion) override;
+ int adjustMedianCount(int suggestion) override;
+ bool repeatCount() override { return 1; }
+ QTest::QBenchmarkMetric metricType() override;
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
qint64 eventCounter;
};
diff --git a/src/testlib/qbenchmarktimemeasurers_p.h b/src/testlib/qbenchmarktimemeasurers_p.h
index e5ffb1157d..f268669e2f 100644
--- a/src/testlib/qbenchmarktimemeasurers_p.h
+++ b/src/testlib/qbenchmarktimemeasurers_p.h
@@ -60,14 +60,14 @@ QT_BEGIN_NAMESPACE
class QBenchmarkTimeMeasurer : public QBenchmarkMeasurerBase
{
public:
- void start();
- qint64 checkpoint();
- qint64 stop();
- bool isMeasurementAccepted(qint64 measurement);
- int adjustIterationCount(int sugestion);
- int adjustMedianCount(int suggestion);
- bool needsWarmupIteration();
- QTest::QBenchmarkMetric metricType();
+ void start() override;
+ qint64 checkpoint() override;
+ qint64 stop() override;
+ bool isMeasurementAccepted(qint64 measurement) override;
+ int adjustIterationCount(int sugestion) override;
+ int adjustMedianCount(int suggestion) override;
+ bool needsWarmupIteration() override;
+ QTest::QBenchmarkMetric metricType() override;
private:
QElapsedTimer time;
};
@@ -77,14 +77,14 @@ private:
class QBenchmarkTickMeasurer : public QBenchmarkMeasurerBase
{
public:
- void start();
- qint64 checkpoint();
- qint64 stop();
- bool isMeasurementAccepted(qint64 measurement);
- int adjustIterationCount(int);
- int adjustMedianCount(int suggestion);
- bool needsWarmupIteration();
- QTest::QBenchmarkMetric metricType();
+ void start() override;
+ qint64 checkpoint() override;
+ qint64 stop() override;
+ bool isMeasurementAccepted(qint64 measurement) override;
+ int adjustIterationCount(int) override;
+ int adjustMedianCount(int suggestion) override;
+ bool needsWarmupIteration() override;
+ QTest::QBenchmarkMetric metricType() override;
private:
CycleCounterTicks startTicks;
};
diff --git a/src/testlib/qbenchmarkvalgrind_p.h b/src/testlib/qbenchmarkvalgrind_p.h
index dd7e7381c1..69219b9a65 100644
--- a/src/testlib/qbenchmarkvalgrind_p.h
+++ b/src/testlib/qbenchmarkvalgrind_p.h
@@ -76,14 +76,14 @@ public:
class QBenchmarkCallgrindMeasurer : public QBenchmarkMeasurerBase
{
public:
- void start();
- qint64 checkpoint();
- qint64 stop();
- bool isMeasurementAccepted(qint64 measurement);
- int adjustIterationCount(int);
- int adjustMedianCount(int);
- bool needsWarmupIteration();
- QTest::QBenchmarkMetric metricType();
+ void start() override;
+ qint64 checkpoint() override;
+ qint64 stop() override;
+ bool isMeasurementAccepted(qint64 measurement) override;
+ int adjustIterationCount(int) override;
+ int adjustMedianCount(int) override;
+ bool needsWarmupIteration() override;
+ QTest::QBenchmarkMetric metricType() override;
};
QT_END_NAMESPACE
diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h
index efa79e550d..93d3c7143a 100644
--- a/src/testlib/qplaintestlogger_p.h
+++ b/src/testlib/qplaintestlogger_p.h
@@ -61,18 +61,18 @@ public:
QPlainTestLogger(const char *filename);
~QPlainTestLogger();
- void startLogging();
- void stopLogging();
+ void startLogging() override;
+ void stopLogging() override;
- void enterTestFunction(const char *function);
- void leaveTestFunction();
+ void enterTestFunction(const char *function) override;
+ void leaveTestFunction() override;
void addIncident(IncidentTypes type, const char *description,
- const char *file = 0, int line = 0);
- void addBenchmarkResult(const QBenchmarkResult &result);
+ const char *file = 0, int line = 0) override;
+ void addBenchmarkResult(const QBenchmarkResult &result) override;
void addMessage(MessageTypes type, const QString &message,
- const char *file = 0, int line = 0);
+ const char *file = 0, int line = 0) override;
private:
void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0);
diff --git a/src/testlib/qteamcitylogger_p.h b/src/testlib/qteamcitylogger_p.h
index b8fad3ae34..219aeb5ceb 100644
--- a/src/testlib/qteamcitylogger_p.h
+++ b/src/testlib/qteamcitylogger_p.h
@@ -63,18 +63,18 @@ public:
QTeamCityLogger(const char *filename);
~QTeamCityLogger();
- void startLogging();
- void stopLogging();
+ void startLogging() override;
+ void stopLogging() override;
- void enterTestFunction(const char *function);
- void leaveTestFunction();
+ void enterTestFunction(const char *function) override;
+ void leaveTestFunction() override;
void addIncident(IncidentTypes type, const char *description,
- const char *file = 0, int line = 0);
- void addBenchmarkResult(const QBenchmarkResult &result);
+ const char *file = 0, int line = 0) override;
+ void addBenchmarkResult(const QBenchmarkResult &result) override;
void addMessage(MessageTypes type, const QString &message,
- const char *file = 0, int line = 0);
+ const char *file = 0, int line = 0) override;
private:
QString currTestFuncName;
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 1c13f8edc2..7b76f1f970 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -99,6 +99,7 @@
#include <errno.h>
#include <signal.h>
#include <time.h>
+#include <sys/resource.h>
#endif
#if defined(Q_OS_MACX)
@@ -143,6 +144,22 @@ static bool debuggerPresent()
#endif
}
+static void disableCoreDump()
+{
+ bool ok = false;
+ const int disableCoreDump = qEnvironmentVariableIntValue("QTEST_DISABLE_CORE_DUMP", &ok);
+ if (ok && disableCoreDump == 1) {
+#if defined(Q_OS_UNIX)
+ struct rlimit limit;
+ limit.rlim_cur = 0;
+ limit.rlim_max = 0;
+ if (setrlimit(RLIMIT_CORE, &limit) != 0)
+ qWarning("Failed to disable core dumps: %d", errno);
+#endif
+ }
+}
+Q_CONSTRUCTOR_FUNCTION(disableCoreDump);
+
static void stackTrace()
{
bool ok = false;
@@ -925,7 +942,7 @@ public:
waitCondition.wakeAll();
}
- void run() {
+ void run() override {
QMutexLocker locker(&mutex);
waitCondition.wakeAll();
while (1) {
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index c3ccfc3f8c..4c226830e9 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -309,7 +309,7 @@ namespace QTest
Q_TESTLIB_EXPORT void addColumnInternal(int id, const char *name);
template <typename T>
- inline void addColumn(const char *name, T * = 0)
+ inline void addColumn(const char *name, T * = nullptr)
{
typedef std::is_same<T, const char*> QIsSameTConstChar;
Q_STATIC_ASSERT_X(!QIsSameTConstChar::value, "const char* is not allowed as a test data format.");
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index 63b7401e6f..159e3e01ff 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -79,10 +79,10 @@ public:
inline QTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay)
: _action(action), _delay(delay), _modifiers(modifiers),
_ascii(ascii), _key(Qt::Key_unknown) {}
- inline QTestEvent *clone() const { return new QTestKeyEvent(*this); }
+ inline QTestEvent *clone() const override { return new QTestKeyEvent(*this); }
#ifdef QT_WIDGETS_LIB
- inline void simulate(QWidget *w)
+ inline void simulate(QWidget *w) override
{
if (_ascii == 0)
QTest::keyEvent(_action, w, _key, _modifiers, _delay);
@@ -104,10 +104,10 @@ class QTestKeyClicksEvent: public QTestEvent
public:
inline QTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay)
: _keys(keys), _modifiers(modifiers), _delay(delay) {}
- inline QTestEvent *clone() const { return new QTestKeyClicksEvent(*this); }
+ inline QTestEvent *clone() const override { return new QTestKeyClicksEvent(*this); }
#ifdef QT_WIDGETS_LIB
- inline void simulate(QWidget *w)
+ inline void simulate(QWidget *w) override
{
QTest::keyClicks(w, _keys, _modifiers, _delay);
}
@@ -125,10 +125,10 @@ public:
inline QTestMouseEvent(QTest::MouseAction action, Qt::MouseButton button,
Qt::KeyboardModifiers modifiers, QPoint position, int delay)
: _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {}
- inline QTestEvent *clone() const { return new QTestMouseEvent(*this); }
+ inline QTestEvent *clone() const override { return new QTestMouseEvent(*this); }
#ifdef QT_WIDGETS_LIB
- inline void simulate(QWidget *w)
+ inline void simulate(QWidget *w) override
{
QTest::mouseEvent(_action, w, _button, _modifiers, _pos, _delay);
}
@@ -148,10 +148,10 @@ class QTestDelayEvent: public QTestEvent
{
public:
inline QTestDelayEvent(int msecs): _delay(msecs) {}
- inline QTestEvent *clone() const { return new QTestDelayEvent(*this); }
+ inline QTestEvent *clone() const override { return new QTestDelayEvent(*this); }
#ifdef QT_WIDGETS_LIB
- inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); }
+ inline void simulate(QWidget * /*w*/) override { QTest::qWait(_delay); }
#endif
private:
diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h
index 032c95d692..bcf4a4be2d 100644
--- a/src/testlib/qtesteventloop.h
+++ b/src/testlib/qtesteventloop.h
@@ -80,7 +80,7 @@ public Q_SLOTS:
inline void exitLoop();
protected:
- inline void timerEvent(QTimerEvent *e);
+ inline void timerEvent(QTimerEvent *e) override;
private:
bool inLoop;
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 1143361323..166622e950 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -73,6 +73,11 @@ namespace QTest
extern Q_TESTLIB_EXPORT Qt::MouseButton lastMouseButton;
extern Q_TESTLIB_EXPORT int lastMouseTimestamp;
+ // This value is used to emulate timestamps to avoid creating double clicks by mistake.
+ // Use this constant instead of QStyleHints::mouseDoubleClickInterval property to avoid tests
+ // to depend on platform themes.
+ static const int mouseDoubleClickInterval = 500;
+
static void waitForEvents()
{
#ifdef Q_OS_MAC
@@ -125,7 +130,7 @@ namespace QTest
Q_FALLTHROUGH();
case MouseRelease:
qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
- lastMouseTimestamp += 500; // avoid double clicks being generated
+ lastMouseTimestamp += mouseDoubleClickInterval; // avoid double clicks being generated
lastMouseButton = Qt::NoButton;
break;
case MouseMove:
@@ -176,8 +181,10 @@ namespace QTest
if (delay == -1 || delay < defaultMouseDelay())
delay = defaultMouseDelay();
- if (delay > 0)
+ if (delay > 0) {
QTest::qWait(delay);
+ lastMouseTimestamp += delay;
+ }
if (action == MouseClick) {
mouseEvent(MousePress, widget, button, stateKey, pos);
@@ -194,12 +201,16 @@ namespace QTest
{
case MousePress:
me = QMouseEvent(QEvent::MouseButtonPress, pos, widget->mapToGlobal(pos), button, button, stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
break;
case MouseRelease:
me = QMouseEvent(QEvent::MouseButtonRelease, pos, widget->mapToGlobal(pos), button, Qt::MouseButton(), stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
+ lastMouseTimestamp += mouseDoubleClickInterval; // avoid double clicks being generated
break;
case MouseDClick:
me = QMouseEvent(QEvent::MouseButtonDblClick, pos, widget->mapToGlobal(pos), button, button, stateKey);
+ me.setTimestamp(++lastMouseTimestamp);
break;
case MouseMove:
QCursor::setPos(widget->mapToGlobal(pos));
diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h
index c6461387b2..b85742f939 100644
--- a/src/testlib/qxmltestlogger_p.h
+++ b/src/testlib/qxmltestlogger_p.h
@@ -64,18 +64,18 @@ public:
QXmlTestLogger(XmlMode mode, const char *filename);
~QXmlTestLogger();
- void startLogging();
- void stopLogging();
+ void startLogging() override;
+ void stopLogging() override;
- void enterTestFunction(const char *function);
- void leaveTestFunction();
+ void enterTestFunction(const char *function) override;
+ void leaveTestFunction() override;
void addIncident(IncidentTypes type, const char *description,
- const char *file = 0, int line = 0);
- void addBenchmarkResult(const QBenchmarkResult &result);
+ const char *file = 0, int line = 0) override;
+ void addBenchmarkResult(const QBenchmarkResult &result) override;
void addMessage(MessageTypes type, const QString &message,
- const char *file = 0, int line = 0);
+ const char *file = 0, int line = 0) override;
static int xmlCdata(QTestCharBuffer *dest, char const* src);
static int xmlQuote(QTestCharBuffer *dest, char const* src);
diff --git a/src/testlib/qxunittestlogger_p.h b/src/testlib/qxunittestlogger_p.h
index 50f26c317b..8fb01fbe61 100644
--- a/src/testlib/qxunittestlogger_p.h
+++ b/src/testlib/qxunittestlogger_p.h
@@ -64,19 +64,19 @@ class QXunitTestLogger : public QAbstractTestLogger
QXunitTestLogger(const char *filename);
~QXunitTestLogger();
- void startLogging();
- void stopLogging();
+ void startLogging() override;
+ void stopLogging() override;
- void enterTestFunction(const char *function);
- void leaveTestFunction();
+ void enterTestFunction(const char *function) override;
+ void leaveTestFunction() override;
void addIncident(IncidentTypes type, const char *description,
- const char *file = 0, int line = 0);
- void addBenchmarkResult(const QBenchmarkResult &result);
+ const char *file = 0, int line = 0) override;
+ void addBenchmarkResult(const QBenchmarkResult &result) override;
void addTag(QTestElement* element);
void addMessage(MessageTypes type, const QString &message,
- const char *file = 0, int line = 0);
+ const char *file = 0, int line = 0) override;
private:
QTestElement *listOfTestcases;
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 5b2205e875..e84651ccd5 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -111,4 +111,6 @@ mac {
!qtHaveModule(widgets): HEADERSCLEAN_EXCLUDE += qtest_widgets.h
+!qtHaveModule(network): HEADERSCLEAN_EXCLUDE += qtest_network.h
+
load(qt_module)
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 89bf2bd6a1..03f022da69 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -197,6 +197,7 @@ Type Moc::parseType()
prev();
break;
}
+ Q_FALLTHROUGH();
case CHAR:
case SHORT:
case INT:
diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h
index ee8761108b..bedcbbf7e2 100644
--- a/src/tools/moc/parser.h
+++ b/src/tools/moc/parser.h
@@ -68,8 +68,8 @@ public:
inline QByteArray unquotedLexem() { return symbols.at(index-1).unquotedLexem();}
inline const Symbol &symbol() { return symbols.at(index-1);}
- void error(int rollback);
- void error(const char *msg = 0);
+ Q_NORETURN void error(int rollback);
+ Q_NORETURN void error(const char *msg = 0);
void warning(const char * = 0);
void note(const char * = 0);
diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
index bd94017821..cdf3ad3310 100644
--- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
+++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp
@@ -98,7 +98,8 @@ static QDBusIntrospection::Interfaces readInput()
// already XML
return QDBusIntrospection::parseInterfaces(QString::fromUtf8(data));
- fprintf(stderr, "Cannot process input: '%s'. Stop.\n", qPrintable(inputFile));
+ fprintf(stderr, "%s: Cannot process input: '%s'. Stop.\n",
+ PROGRAMNAME, qPrintable(inputFile));
exit(1);
}
@@ -225,7 +226,8 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
if (qttype.isEmpty()) {
if (!isSignal || qstrcmp(direction, "Out") == 0) {
- fprintf(stderr, "Got unknown type `%s'\n", qPrintable(signature));
+ fprintf(stderr, "%s: Got unknown type `%s' processing '%s'\n",
+ PROGRAMNAME, qPrintable(signature), qPrintable(inputFile));
fprintf(stderr, "You should add <annotation name=\"%s\" value=\"<type>\"/> to the XML description\n",
qPrintable(annotationName));
}
@@ -236,8 +238,10 @@ static QByteArray qtTypeName(const QString &signature, const QDBusIntrospection:
exit(1);
}
- fprintf(stderr, "Warning: deprecated annotation '%s' found; suggest updating to '%s'\n",
- qPrintable(oldAnnotationName), qPrintable(annotationName));
+ fprintf(stderr, "%s: Warning: deprecated annotation '%s' found while processing '%s'; "
+ "suggest updating to '%s'\n",
+ PROGRAMNAME, qPrintable(oldAnnotationName), qPrintable(inputFile),
+ qPrintable(annotationName));
return qttype.toLatin1();
}
@@ -357,8 +361,10 @@ static QString propertyGetter(const QDBusIntrospection::Property &property)
getter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertyGetter"));
if (!getter.isEmpty()) {
- fprintf(stderr, "Warning: deprecated annotation 'com.trolltech.QtDBus.propertyGetter' found;"
- " suggest updating to 'org.qtproject.QtDBus.PropertyGetter'\n");
+ fprintf(stderr, "%s: Warning: deprecated annotation 'com.trolltech.QtDBus.propertyGetter' found"
+ " while processing '%s';"
+ " suggest updating to 'org.qtproject.QtDBus.PropertyGetter'\n",
+ PROGRAMNAME, qPrintable(inputFile));
return getter;
}
@@ -375,8 +381,10 @@ static QString propertySetter(const QDBusIntrospection::Property &property)
setter = property.annotations.value(QLatin1String("com.trolltech.QtDBus.propertySetter"));
if (!setter.isEmpty()) {
- fprintf(stderr, "Warning: deprecated annotation 'com.trolltech.QtDBus.propertySetter' found;"
- " suggest updating to 'org.qtproject.QtDBus.PropertySetter'\n");
+ fprintf(stderr, "%s: Warning: deprecated annotation 'com.trolltech.QtDBus.propertySetter' found"
+ " while processing '%s';"
+ " suggest updating to 'org.qtproject.QtDBus.PropertySetter'\n",
+ PROGRAMNAME, qPrintable(inputFile));
return setter;
}
@@ -426,8 +434,8 @@ static bool openFile(const QString &fileName, QFile &file)
}
if (!isOk)
- fprintf(stderr, "Unable to open '%s': %s\n", qPrintable(fileName),
- qPrintable(file.errorString()));
+ fprintf(stderr, "%s: Unable to open '%s': %s\n",
+ PROGRAMNAME, qPrintable(fileName), qPrintable(file.errorString()));
return isOk;
}
@@ -506,7 +514,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
// constructors/destructors:
hs << "public:" << endl
- << " " << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);" << endl
+ << " " << className << "(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);" << endl
<< endl
<< " ~" << className << "();" << endl
<< endl;
@@ -566,8 +574,9 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
bool isNoReply =
method.annotations.value(QLatin1String(ANNOTATION_NO_WAIT)) == QLatin1String("true");
if (isNoReply && !method.outputArgs.isEmpty()) {
- fprintf(stderr, "warning: method %s in interface %s is marked 'no-reply' but has output arguments.\n",
- qPrintable(method.name), qPrintable(interface->name));
+ fprintf(stderr, "%s: warning while processing '%s': method %s in interface %s is marked 'no-reply' but has output arguments.\n",
+ PROGRAMNAME, qPrintable(inputFile), qPrintable(method.name),
+ qPrintable(interface->name));
continue;
}
@@ -893,8 +902,8 @@ static void writeAdaptor(const QString &filename, const QDBusIntrospection::Inte
bool isNoReply =
method.annotations.value(QLatin1String(ANNOTATION_NO_WAIT)) == QLatin1String("true");
if (isNoReply && !method.outputArgs.isEmpty()) {
- fprintf(stderr, "warning: method %s in interface %s is marked 'no-reply' but has output arguments.\n",
- qPrintable(method.name), qPrintable(interface->name));
+ fprintf(stderr, "%s: warning while processing '%s': method %s in interface %s is marked 'no-reply' but has output arguments.\n",
+ PROGRAMNAME, qPrintable(inputFile), qPrintable(method.name), qPrintable(interface->name));
continue;
}
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index b241fcdf11..8acbffef6a 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -44,31 +44,31 @@
},
"style-fusion": {
"label": "Fusion",
- "output": [ "styles" ]
+ "output": [ "privateFeature", "styles" ]
},
"style-mac": {
"label": "macOS",
"condition": "config.osx",
- "output": [ "styles" ]
+ "output": [ "privateFeature", "styles" ]
},
"style-windows": {
"label": "Windows",
- "output": [ "styles" ]
+ "output": [ "privateFeature", "styles" ]
},
"style-windowsxp": {
"label": "WindowsXP",
"condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme",
- "output": [ "styles" ]
+ "output": [ "privateFeature", "styles" ]
},
"style-windowsvista": {
"label": "WindowsVista",
"condition": "features.style-windowsxp",
- "output": [ "styles" ]
+ "output": [ "privateFeature", "styles" ]
},
"style-android": {
"label": "Android",
"autoDetect": "config.android",
- "output": [ "styles" ]
+ "output": [ "privateFeature", "styles" ]
},
"style-stylesheet": {
"label": "QStyleSheetStyle",
@@ -86,6 +86,7 @@
"label": "QFileSystemModel",
"purpose": "Provides a data model for the local filesystem.",
"section": "File I/O",
+ "condition": "features.itemmodel",
"output": [ "publicFeature", "feature" ]
},
"itemviews": {
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index 265790b0e5..d88ff4a841 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -65,7 +65,7 @@ public:
int result() const;
- void setVisible(bool visible);
+ void setVisible(bool visible) override;
void setOrientation(Qt::Orientation orientation);
Qt::Orientation orientation() const;
@@ -73,8 +73,8 @@ public:
void setExtension(QWidget* extension);
QWidget* extension() const;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void setSizeGripEnabled(bool);
bool isSizeGripEnabled() const;
@@ -99,14 +99,14 @@ public Q_SLOTS:
protected:
QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
- void keyPressEvent(QKeyEvent *);
- void closeEvent(QCloseEvent *);
- void showEvent(QShowEvent *);
- void resizeEvent(QResizeEvent *);
+ void keyPressEvent(QKeyEvent *) override;
+ void closeEvent(QCloseEvent *) override;
+ void showEvent(QShowEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *);
+ void contextMenuEvent(QContextMenuEvent *) override;
#endif
- bool eventFilter(QObject *, QEvent *);
+ bool eventFilter(QObject *, QEvent *) override;
void adjustPosition(QWidget*);
private:
Q_DECLARE_PRIVATE(QDialog)
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index bcad069b50..9153d7ea41 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qwizard.h"
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_WIZARD
@@ -61,7 +62,7 @@
#include <QtCore/QMetaMethod>
#include <QtGui/QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
-#elif !defined(QT_NO_STYLE_WINDOWSVISTA)
+#elif QT_CONFIG(style_windowsvista)
#include "qwizard_win_p.h"
#include "qtimer.h"
#endif
@@ -295,7 +296,7 @@ public:
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
private:
bool vistaDisabled() const;
#endif
@@ -342,7 +343,7 @@ QWizardHeader::QWizardHeader(QWidget *parent)
layout->addWidget(logoLabel, 1, 5, 5, 1);
}
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
bool QWizardHeader::vistaDisabled() const
{
bool styleDisabled = false;
@@ -362,7 +363,7 @@ void QWizardHeader::setup(const QWizardLayoutInfo &info, const QString &title,
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat)
{
bool modern = ((info.wizStyle == QWizard::ModernStyle)
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
|| ((info.wizStyle == QWizard::AeroStyle
&& QVistaHelper::vistaState() == QVistaHelper::Classic) || vistaDisabled())
#endif
@@ -525,7 +526,7 @@ void QWizardPagePrivate::_q_updateCachedCompleteState()
class QWizardAntiFlickerWidget : public QWidget
{
public:
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
QWizardPrivate *wizardPrivate;
QWizardAntiFlickerWidget(QWizard *wizard, QWizardPrivate *wizardPrivate)
: QWidget(wizard)
@@ -572,7 +573,7 @@ public:
, titleLabel(0)
, subTitleLabel(0)
, bottomRuler(0)
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
, vistaHelper(0)
, vistaInitPending(false)
, vistaState(QVistaHelper::Dirty)
@@ -586,7 +587,7 @@ public:
{
std::fill(btns, btns + QWizard::NButtons, static_cast<QAbstractButton *>(0));
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
vistaInitPending = true;
@@ -611,7 +612,7 @@ public:
void setButtonLayout(const QWizard::WizardButton *array, int size);
bool buttonLayoutContains(QWizard::WizardButton which);
void updatePixmap(QWizard::WizardPixmap which);
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
bool vistaDisabled() const;
bool isVistaThemeEnabled(QVistaHelper::VistaState state) const;
bool handleAeroStyleChange();
@@ -677,7 +678,7 @@ public:
QHBoxLayout *buttonLayout;
QGridLayout *mainLayout;
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
QVistaHelper *vistaHelper;
bool vistaInitPending;
QVistaHelper::VistaState vistaState;
@@ -692,7 +693,7 @@ public:
static QString buttonDefaultText(int wstyle, int which, const QWizardPrivate *wizardPrivate)
{
-#if defined(QT_NO_STYLE_WINDOWSVISTA)
+#if !QT_CONFIG(style_windowsvista)
Q_UNUSED(wizardPrivate);
#endif
const bool macStyle = (wstyle == QWizard::MacStyle);
@@ -730,7 +731,7 @@ void QWizardPrivate::init()
opts = QWizard::HelpButtonOnRight;
}
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
vistaHelper = new QVistaHelper(q);
#endif
@@ -959,7 +960,7 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage()
info.wizStyle = wizStyle;
if (info.wizStyle == QWizard::AeroStyle
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
&& (QVistaHelper::vistaState() == QVistaHelper::Classic || vistaDisabled())
#endif
)
@@ -1337,7 +1338,7 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info)
Q_Q(QWizard);
int extraHeight = 0;
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (isVistaThemeEnabled())
extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset();
#endif
@@ -1560,7 +1561,7 @@ void QWizardPrivate::updatePixmap(QWizard::WizardPixmap which)
}
}
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
bool QWizardPrivate::vistaDisabled() const
{
Q_Q(const QWizard);
@@ -1642,7 +1643,7 @@ bool QWizardPrivate::handleAeroStyleChange()
bool QWizardPrivate::isVistaThemeEnabled() const
{
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
return isVistaThemeEnabled(QVistaHelper::VistaAero)
|| isVistaThemeEnabled(QVistaHelper::VistaBasic);
#else
@@ -1720,7 +1721,7 @@ void QWizardPrivate::_q_updateButtonStates()
if (QPushButton *finishPush = qobject_cast<QPushButton *>(btn.finish))
finishPush->setDefault(!canContinue && useDefault);
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (isVistaThemeEnabled()) {
vistaHelper->backButton()->setEnabled(btn.back->isEnabled());
vistaHelper->backButton()->setVisible(backButtonVisible);
@@ -1788,7 +1789,7 @@ QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
#endif
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
void QWizardAntiFlickerWidget::paintEvent(QPaintEvent *)
{
if (wizardPrivate->isVistaThemeEnabled()) {
@@ -2556,7 +2557,7 @@ void QWizard::setWizardStyle(WizardStyle style)
const bool styleChange = style != d->wizStyle;
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
const bool aeroStyleChange =
d->vistaInitPending || d->vistaStateChanged || (styleChange && (style == AeroStyle || d->wizStyle == AeroStyle));
d->vistaStateChanged = false;
@@ -2564,14 +2565,14 @@ void QWizard::setWizardStyle(WizardStyle style)
#endif
if (styleChange
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
|| aeroStyleChange
#endif
) {
d->disableUpdates();
d->wizStyle = style;
d->updateButtonTexts();
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (aeroStyleChange) {
//Send a resizeevent since the antiflicker widget probably needs a new size
//because of the backbutton in the window title
@@ -2582,7 +2583,7 @@ void QWizard::setWizardStyle(WizardStyle style)
d->updateLayout();
updateGeometry();
d->enableUpdates();
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
// Delay initialization when activating Aero style fails due to missing native window.
if (aeroStyleChange && !d->handleAeroStyleChange() && d->wizStyle == AeroStyle)
d->vistaInitPending = true;
@@ -2816,7 +2817,7 @@ void QWizard::setButton(WizardButton which, QAbstractButton *button)
QAbstractButton *QWizard::button(WizardButton which) const
{
Q_D(const QWizard);
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (d->wizStyle == AeroStyle && which == BackButton)
return d->vistaHelper->backButton();
#endif
@@ -3176,7 +3177,7 @@ bool QWizard::event(QEvent *event)
d->setStyle(style());
d->updateLayout();
}
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
else if (event->type() == QEvent::Show && d->vistaInitPending) {
d->vistaInitPending = false;
// Do not force AeroStyle when in Classic theme.
@@ -3211,7 +3212,7 @@ void QWizard::resizeEvent(QResizeEvent *event)
{
Q_D(QWizard);
int heightOffset = 0;
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (d->isVistaThemeEnabled()) {
heightOffset = d->vistaHelper->topOffset();
if (d->isVistaThemeEnabled(QVistaHelper::VistaAero))
@@ -3219,7 +3220,7 @@ void QWizard::resizeEvent(QResizeEvent *event)
}
#endif
d->antiFlickerWidget->resize(event->size().width(), event->size().height() - heightOffset);
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
if (d->isVistaThemeEnabled())
d->vistaHelper->resizeEvent(event);
#endif
@@ -3240,7 +3241,7 @@ void QWizard::paintEvent(QPaintEvent * event)
QPainter painter(this);
painter.drawPixmap(0, (height() - backgroundPixmap.height()) / 2, backgroundPixmap);
}
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
else if (d->isVistaThemeEnabled()) {
if (d->isVistaThemeEnabled(QVistaHelper::VistaBasic)) {
QPainter painter(this);
@@ -3260,7 +3261,7 @@ void QWizard::paintEvent(QPaintEvent * event)
*/
bool QWizard::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
Q_D(QWizard);
if (d->isVistaThemeEnabled() && eventType == "windows_generic_MSG") {
MSG *windowsMessage = static_cast<MSG *>(message);
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 9d8e7c4b66..80e37dab25 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -38,7 +38,10 @@
****************************************************************************/
#ifndef QT_NO_WIZARD
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
+
+#if QT_CONFIG(style_windowsvista)
#include "qwizard_win_p.h"
#include <private/qapplication_p.h>
@@ -722,6 +725,6 @@ int QVistaHelper::topOffset()
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_WINDOWSVISTA
+#endif // style_windowsvista
#endif // QT_NO_WIZARD
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index 288e7adaf5..bbba53b879 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -54,7 +54,7 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#ifndef QT_NO_WIZARD
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
#include <qobject.h>
#include <qwidget.h>
@@ -156,6 +156,6 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_WINDOWSVISTA
+#endif // style_windowsvista
#endif // QT_NO_WIZARD
#endif // QWIZARD_WIN_P_H
diff --git a/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp b/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp
index 284a4ce404..7d003e4886 100644
--- a/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_util_qcompleter.cpp
@@ -62,7 +62,7 @@ lineEdit->setCompleter(completer);
//! [1]
QCompleter *completer = new QCompleter(this);
-completer->setModel(new QDirModel(completer));
+completer->setModel(new QFileSystemModel(completer));
lineEdit->setCompleter(completer);
//! [1]
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index e727d7fe56..84819e8c1a 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -2070,9 +2070,22 @@
Normally, the begin and end functions are capable of informing other components
about changes to the model's underlying structure. For more complex changes to the
- model's structure, perhaps involving internal reorganization or sorting of data,
- it is necessary to emit the \l{QAbstractItemModel::layoutChanged()}{layoutChanged()}
- signal to cause any attached views to be updated.
+ model's structure, perhaps involving internal reorganization, sorting of data or
+ any other structural change, it is necessary to perform the following sequence:
+
+ \li Emit the \l{QAbstractItemModel::layoutAboutToBeChanged()}{layoutAboutToBeChanged()} signal
+ \li Update internal data which represents the structure of the model.
+ \li Update persistent indexes using \l{QAbstractItemModel::changePersistentIndexList()}{changePersistentIndexList()}
+ \li Emit the \l{QAbstractItemModel::layoutChanged()}{layoutChanged()} signal.
+
+ This sequence can be used for any structural update in lieu of the more
+ high-level and convenient protected methods. For example, if a model of
+ two million rows needs to have all odd numbered rows removed, that
+ is 1 million discountiguous ranges of 1 element each. It would be
+ possible to use beginRemoveRows and endRemoveRows 1 million times, but
+ that would obviously be inefficient. Instead, this can be signalled as a
+ single layout change which updates all necessary persistent indexes at
+ once.
\section3 Lazy population of model data
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
index 0797ba7066..4624772993 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
@@ -80,7 +80,7 @@ public:
void embedSubWindow(QWidget *);
void unembedSubWindow(QWidget *);
- bool isProxyWidget() const;
+ bool isProxyWidget() const override;
QPointer<QWidget> widget;
QPointer<QWidget> lastWidgetUnderMouse;
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index 46d2a4c1aa..660620a5d9 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -52,7 +52,7 @@
#include <QtWidgets/qstyleoption.h>
#include <QtWidgets/QStyleOptionTitleBar>
#include <QtWidgets/QGraphicsSceneMouseEvent>
-#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(style_mac)
# include <private/qmacstyle_mac_p.h>
#endif
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index f8ada6df08..d21ae573cd 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -93,12 +93,12 @@ class QEmptyModel : public QAbstractItemModel
{
public:
explicit QEmptyModel(QObject *parent = 0) : QAbstractItemModel(parent) {}
- QModelIndex index(int, int, const QModelIndex &) const { return QModelIndex(); }
- QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
- int rowCount(const QModelIndex &) const { return 0; }
- int columnCount(const QModelIndex &) const { return 0; }
- bool hasChildren(const QModelIndex &) const { return false; }
- QVariant data(const QModelIndex &, int) const { return QVariant(); }
+ QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); }
+ QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+ int rowCount(const QModelIndex &) const override { return 0; }
+ int columnCount(const QModelIndex &) const override { return 0; }
+ bool hasChildren(const QModelIndex &) const override { return false; }
+ QVariant data(const QModelIndex &, int) const override { return QVariant(); }
};
class Q_AUTOTEST_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
@@ -323,7 +323,7 @@ public:
}
// reimplemented from QAbstractScrollAreaPrivate
- virtual QPoint contentsOffset() const {
+ QPoint contentsOffset() const override {
Q_Q(const QAbstractItemView);
return QPoint(q->horizontalOffset(), q->verticalOffset());
}
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 837383f016..1310a060ea 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3857,6 +3857,20 @@ bool QHeaderViewPrivate::read(QDataStream &in)
if (sectionItemsLengthTotal != lengthIn)
return false;
+ const int currentCount = (orient == Qt::Horizontal ? model->columnCount(root) : model->rowCount(root));
+ if (newSectionItems.count() < currentCount) {
+ // we have sections not in the saved state, give them default settings
+ for (int i = newSectionItems.count(); i < currentCount; ++i) {
+ visualIndicesIn.append(i);
+ logicalIndicesIn.append(i);
+ }
+ const int insertCount = currentCount - newSectionItems.count();
+ const int insertLength = defaultSectionSizeIn * insertCount;
+ lengthIn += insertLength;
+ SectionItem section(defaultSectionSizeIn, globalResizeMode);
+ newSectionItems.insert(newSectionItems.count(), insertCount, section); // append
+ }
+
orientation = static_cast<Qt::Orientation>(orient);
sortIndicatorOrder = static_cast<Qt::SortOrder>(order);
sortIndicatorSection = sortIndicatorSectionIn;
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index 0356d79ff7..6affe7af95 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -117,7 +117,7 @@ public:
void resizeSections(QHeaderView::ResizeMode globalMode, bool useGlobalMode = false);
void _q_sectionsRemoved(const QModelIndex &,int,int);
void _q_layoutAboutToBeChanged();
- void _q_layoutChanged();
+ void _q_layoutChanged() override;
bool isSectionSelected(int section) const;
bool isFirstVisibleSection(int section) const;
diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h
index 785d4d84ea..dea9bce794 100644
--- a/src/widgets/itemviews/qitemeditorfactory.h
+++ b/src/widgets/itemviews/qitemeditorfactory.h
@@ -81,8 +81,8 @@ public:
inline QStandardItemEditorCreator()
: propertyName(T::staticMetaObject.userProperty().name())
{}
- inline QWidget *createWidget(QWidget *parent) const { return new T(parent); }
- inline QByteArray valuePropertyName() const { return propertyName; }
+ inline QWidget *createWidget(QWidget *parent) const override { return new T(parent); }
+ inline QByteArray valuePropertyName() const override { return propertyName; }
private:
QByteArray propertyName;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 42cb6b4eef..47effcdfd9 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -69,28 +69,28 @@ class QListViewItem
friend class QListModeViewBase;
friend class QIconModeViewBase;
public:
- inline QListViewItem()
+ Q_DECL_CONSTEXPR QListViewItem()
: x(-1), y(-1), w(0), h(0), indexHint(-1), visited(0xffff) {}
- inline QListViewItem(QRect r, int i)
+ Q_DECL_CONSTEXPR QListViewItem(QRect r, int i)
: x(r.x()), y(r.y()), w(qMin(r.width(), SHRT_MAX)), h(qMin(r.height(), SHRT_MAX)),
indexHint(i), visited(0xffff) {}
- inline bool operator==(const QListViewItem &other) const {
+ Q_DECL_CONSTEXPR bool operator==(const QListViewItem &other) const {
return (x == other.x && y == other.y && w == other.w && h == other.h &&
indexHint == other.indexHint); }
- inline bool operator!=(const QListViewItem &other) const
+ Q_DECL_CONSTEXPR bool operator!=(const QListViewItem &other) const
{ return !(*this == other); }
- inline bool isValid() const
+ Q_DECL_CONSTEXPR bool isValid() const
{ return rect().isValid() && (indexHint > -1); }
- inline void invalidate()
+ Q_DECL_RELAXED_CONSTEXPR void invalidate()
{ x = -1; y = -1; w = 0; h = 0; }
- inline void resize(const QSize &size)
+ Q_DECL_RELAXED_CONSTEXPR void resize(QSize size)
{ w = qMin(size.width(), SHRT_MAX); h = qMin(size.height(), SHRT_MAX); }
- inline void move(const QPoint &position)
+ Q_DECL_RELAXED_CONSTEXPR void move(QPoint position)
{ x = position.x(); y = position.y(); }
- inline int width() const { return w; }
- inline int height() const { return h; }
+ Q_DECL_CONSTEXPR int width() const { return w; }
+ Q_DECL_CONSTEXPR int height() const { return h; }
private:
- inline QRect rect() const
+ Q_DECL_CONSTEXPR QRect rect() const
{ return QRect(x, y, w, h); }
int x, y;
short w, h;
@@ -209,24 +209,24 @@ public:
int batchSavedPosition;
//reimplementations
- int itemIndex(const QListViewItem &item) const { return item.indexHint; }
- QListViewItem indexToListViewItem(const QModelIndex &index) const;
- bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max);
- void clear();
- void setRowCount(int rowCount) { flowPositions.resize(rowCount); }
- QVector<QModelIndex> intersectingSet(const QRect &area) const;
- void dataChanged(const QModelIndex &, const QModelIndex &);
+ int itemIndex(const QListViewItem &item) const override { return item.indexHint; }
+ QListViewItem indexToListViewItem(const QModelIndex &index) const override;
+ bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override;
+ void clear() override;
+ void setRowCount(int rowCount) override { flowPositions.resize(rowCount); }
+ QVector<QModelIndex> intersectingSet(const QRect &area) const override;
+ void dataChanged(const QModelIndex &, const QModelIndex &) override;
int horizontalScrollToValue(int index, QListView::ScrollHint hint,
- bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const;
+ bool leftOf, bool rightOf,const QRect &area, const QRect &rect) const override;
int verticalScrollToValue(int index, QListView::ScrollHint hint,
- bool above, bool below, const QRect &area, const QRect &rect) const;
- void scrollContentsBy(int dx, int dy, bool scrollElasticBand);
- QRect mapToViewport(const QRect &rect) const;
- int horizontalOffset() const;
- int verticalOffset() const;
- void updateHorizontalScrollBar(const QSize &step);
- void updateVerticalScrollBar(const QSize &step);
+ bool above, bool below, const QRect &area, const QRect &rect) const override;
+ void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override;
+ QRect mapToViewport(const QRect &rect) const override;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
+ void updateHorizontalScrollBar(const QSize &step) override;
+ void updateVerticalScrollBar(const QSize &step) override;
#ifndef QT_NO_DRAGANDDROP
// The next two methods are to be used on LefToRight flow only.
@@ -261,24 +261,24 @@ public:
QVector<QModelIndex> *interSectingVector; //used from within intersectingSet
//reimplementations
- int itemIndex(const QListViewItem &item) const;
- QListViewItem indexToListViewItem(const QModelIndex &index) const;
- bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max);
- void clear();
- void setRowCount(int rowCount);
- QVector<QModelIndex> intersectingSet(const QRect &area) const;
-
- void scrollContentsBy(int dx, int dy, bool scrollElasticBand);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- void appendHiddenRow(int row);
- void removeHiddenRow(int row);
- void setPositionForIndex(const QPoint &position, const QModelIndex &index);
+ int itemIndex(const QListViewItem &item) const override;
+ QListViewItem indexToListViewItem(const QModelIndex &index) const override;
+ bool doBatchedItemLayout(const QListViewLayoutInfo &info, int max) override;
+ void clear() override;
+ void setRowCount(int rowCount) override;
+ QVector<QModelIndex> intersectingSet(const QRect &area) const override;
+
+ void scrollContentsBy(int dx, int dy, bool scrollElasticBand) override;
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) override;
+ void appendHiddenRow(int row) override;
+ void removeHiddenRow(int row) override;
+ void setPositionForIndex(const QPoint &position, const QModelIndex &index) override;
#ifndef QT_NO_DRAGANDDROP
- bool filterDragMoveEvent(QDragMoveEvent *);
- bool filterDragLeaveEvent(QDragLeaveEvent *);
- bool filterDropEvent(QDropEvent *e);
- bool filterStartDrag(Qt::DropActions);
+ bool filterDragMoveEvent(QDragMoveEvent *) override;
+ bool filterDragLeaveEvent(QDragLeaveEvent *) override;
+ bool filterDropEvent(QDropEvent *e) override;
+ bool filterStartDrag(Qt::DropActions) override;
#endif
private:
@@ -349,18 +349,18 @@ public:
QModelIndex closestIndex(const QRect &target, const QVector<QModelIndex> &candidates) const;
QSize itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const;
- bool selectionAllowed(const QModelIndex &index) const
+ bool selectionAllowed(const QModelIndex &index) const override
{ if (viewMode == QListView::ListMode && !showElasticBand) return index.isValid(); return true; }
int horizontalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const;
int verticalScrollToValue(const QModelIndex &index, const QRect &rect, QListView::ScrollHint hint) const;
QItemSelection selection(const QRect &rect) const;
- void selectAll(QItemSelectionModel::SelectionFlags command);
+ void selectAll(QItemSelectionModel::SelectionFlags command) override;
#ifndef QT_NO_DRAGANDDROP
- virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const;
- bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index);
+ QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const override;
+ bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index) override;
#endif
inline void setGridSize(const QSize &size) { grid = size; }
@@ -383,7 +383,7 @@ public:
void scrollElasticBandBy(int dx, int dy);
- QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
+ QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override;
void emitIndexesMoved(const QModelIndexList &indexes) { emit q_func()->indexesMoved(indexes); }
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index eaddfc6e6e..0594fd511e 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -93,22 +93,22 @@ public:
QListWidgetItem *take(int row);
void move(int srcRow, int dstRow);
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QModelIndex index(QListWidgetItem *item) const;
- QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
- QMap<int, QVariant> itemData(const QModelIndex &index) const;
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override;
- bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex());
- bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex());
+ bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override;
+ bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override;
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- void sort(int column, Qt::SortOrder order);
+ void sort(int column, Qt::SortOrder order) override;
void ensureSorted(int column, Qt::SortOrder order, int start, int end);
static bool itemLessThan(const QPair<QListWidgetItem*,int> &left,
const QPair<QListWidgetItem*,int> &right);
@@ -122,12 +122,12 @@ public:
void itemChanged(QListWidgetItem *item);
// dnd
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &indexes) const;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
#ifndef QT_NO_DRAGANDDROP
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent);
- Qt::DropActions supportedDropActions() const;
+ int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
#endif
QMimeData *internalMimeData() const;
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index 313577befe..2db7337cd6 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -99,11 +99,11 @@ public:
QTableModel(int rows, int columns, QTableWidget *parent);
~QTableModel();
- bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex());
- bool insertColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex());
+ bool insertRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override;
+ bool insertColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()) override;
- bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex());
- bool removeColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex());
+ bool removeRows(int row, int count = 1, const QModelIndex &parent = QModelIndex()) override;
+ bool removeColumns(int column, int count = 1, const QModelIndex &parent = QModelIndex()) override;
void setItem(int row, int column, QTableWidgetItem *item);
QTableWidgetItem *takeItem(int row, int column);
@@ -118,7 +118,7 @@ public:
QTableWidgetItem *horizontalHeaderItem(int section);
QTableWidgetItem *verticalHeaderItem(int section);
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override
{ return QAbstractTableModel::index(row, column, parent); }
QModelIndex index(const QTableWidgetItem *item) const;
@@ -126,21 +126,21 @@ public:
void setRowCount(int rows);
void setColumnCount(int columns);
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+ bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
- QMap<int, QVariant> itemData(const QModelIndex &index) const;
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role);
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override;
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- void sort(int column, Qt::SortOrder order);
+ void sort(int column, Qt::SortOrder order) override;
static bool itemLessThan(const QPair<QTableWidgetItem*,int> &left,
const QPair<QTableWidgetItem*,int> &right);
static bool itemGreaterThan(const QPair<QTableWidgetItem*,int> &left,
@@ -167,11 +167,11 @@ public:
void setItemPrototype(const QTableWidgetItem *item);
// dnd
- QStringList mimeTypes() const;
- QMimeData *mimeData(const QModelIndexList &indexes) const;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent);
- Qt::DropActions supportedDropActions() const;
+ int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
QMimeData *internalMimeData() const;
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 2d1d1f43d0..9583dd9657 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -2194,7 +2194,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
return QModelIndex();
}
int vi = -1;
-#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(style_mac)
// Selection behavior is slightly different on the Mac.
if (d->selectionMode == QAbstractItemView::ExtendedSelection
&& d->selectionModel
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index 56f3340966..63af41292b 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -102,8 +102,8 @@ public:
return logicalIndex == logicalIndexForTree();
}
- QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
- void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex &current) const;
+ QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override;
+ void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex &current) const override;
#ifndef QT_NO_ANIMATION
struct AnimatedOperation : public QVariantAnimation
@@ -115,8 +115,8 @@ public:
AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); }
int top() const { return startValue().toInt(); }
QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; }
- void updateCurrentValue(const QVariant &) { viewport->update(rect()); }
- void updateState(State state, State) { if (state == Stopped) before = after = QPixmap(); }
+ void updateCurrentValue(const QVariant &) override { viewport->update(rect()); }
+ void updateState(State state, State) override { if (state == Stopped) before = after = QPixmap(); }
} animatedOperation;
void prepareAnimatedOperation(int item, QVariantAnimation::Direction d);
void beginAnimatedOperation();
@@ -128,11 +128,11 @@ public:
void expand(int item, bool emitSignal);
void collapse(int item, bool emitSignal);
- void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int);
- void _q_columnsRemoved(const QModelIndex &, int, int);
+ void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int) override;
+ void _q_columnsRemoved(const QModelIndex &, int, int) override;
void _q_modelAboutToBeReset();
void _q_sortIndicatorChanged(int column, Qt::SortOrder order);
- void _q_modelDestroyed();
+ void _q_modelDestroyed() override;
void layout(int item, bool recusiveExpanding = false, bool afterIsUninitialized = false);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 358838b4e9..128b5dc2b8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3305,7 +3305,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(),
wheel->modifiers(), phase, wheel->source(), wheel->inverted());
bool eventAccepted;
- while (w) {
+ do {
we.spont = spontaneous && w == receiver;
we.ignore();
res = d->notify_helper(w, &we);
@@ -3323,7 +3323,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
we.p += w->pos();
w = w->parentWidget();
- }
+ } while (w);
wheel->setAccepted(eventAccepted);
} else if (!spontaneous) {
// wheel_widget may forward the wheel event to a delegate widget,
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 3bef773187..73c75bbc14 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -164,6 +164,7 @@ public:
#endif
static bool inPopupMode();
+ bool popupActive() Q_DECL_OVERRIDE { return inPopupMode(); }
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index 6f701b9f82..059ff2d470 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -101,14 +101,14 @@ public:
void changeSize(int w, int h,
QSizePolicy::Policy hData = QSizePolicy::Minimum,
QSizePolicy::Policy vData = QSizePolicy::Minimum);
- QSize sizeHint() const;
- QSize minimumSize() const;
- QSize maximumSize() const;
- Qt::Orientations expandingDirections() const;
- bool isEmpty() const;
- void setGeometry(const QRect&);
- QRect geometry() const;
- QSpacerItem *spacerItem();
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
+ Qt::Orientations expandingDirections() const override;
+ bool isEmpty() const override;
+ void setGeometry(const QRect&) override;
+ QRect geometry() const override;
+ QSpacerItem *spacerItem() override;
QSizePolicy sizePolicy() const { return sizeP; }
private:
@@ -126,18 +126,18 @@ public:
explicit QWidgetItem(QWidget *w) : wid(w) { }
~QWidgetItem();
- QSize sizeHint() const;
- QSize minimumSize() const;
- QSize maximumSize() const;
- Qt::Orientations expandingDirections() const;
- bool isEmpty() const;
- void setGeometry(const QRect&);
- QRect geometry() const;
- virtual QWidget *widget();
-
- bool hasHeightForWidth() const;
- int heightForWidth(int) const;
- QSizePolicy::ControlTypes controlTypes() const;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
+ Qt::Orientations expandingDirections() const override;
+ bool isEmpty() const override;
+ void setGeometry(const QRect&) override;
+ QRect geometry() const override;
+ QWidget *widget() override;
+
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int) const override;
+ QSizePolicy::ControlTypes controlTypes() const override;
protected:
QWidget *wid;
};
@@ -148,10 +148,10 @@ public:
explicit QWidgetItemV2(QWidget *widget);
~QWidgetItemV2();
- QSize sizeHint() const;
- QSize minimumSize() const;
- QSize maximumSize() const;
- int heightForWidth(int width) const;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
+ int heightForWidth(int width) const override;
private:
enum { Dirty = -123, HfwCacheMaxSize = 3 };
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp
index 743166549b..110153d0f6 100644
--- a/src/widgets/styles/qandroidstyle.cpp
+++ b/src/widgets/styles/qandroidstyle.cpp
@@ -39,7 +39,7 @@
#include "qandroidstyle_p.h"
-#if !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_android) || defined(QT_PLUGIN)
#include <QFile>
#include <QFont>
@@ -1606,15 +1606,14 @@ void QAndroidStyle::AndroidProgressBarControl::drawControl(const QStyleOption *o
if (!m_progressDrawable)
return;
- if (const QStyleOptionProgressBar *progressBarOption =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
+ if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
if (m_progressDrawable->type() == QAndroidStyle::Layer) {
- const double fraction = progressBarOption->progress / double(progressBarOption->maximum - progressBarOption->minimum);
+ const double fraction = double(qint64(pb->progress) - pb->minimum) / (qint64(pb->maximum) - pb->minimum);
QAndroidStyle::AndroidDrawable *clipDrawable = static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->layer(m_progressId);
if (clipDrawable->type() == QAndroidStyle::Clip)
- static_cast<AndroidClipDrawable *>(clipDrawable)->setFactor(fraction, progressBarOption->orientation);
+ static_cast<AndroidClipDrawable *>(clipDrawable)->setFactor(fraction, pb->orientation);
else
- static_cast<AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, fraction, progressBarOption->orientation);
+ static_cast<AndroidLayerDrawable *>(m_progressDrawable)->setFactor(m_progressId, fraction, pb->orientation);
}
m_progressDrawable->draw(p, option);
}
@@ -1807,4 +1806,4 @@ QRect QAndroidStyle::AndroidSpinnerControl::subControlRect(const QStyleOptionCom
QT_END_NAMESPACE
-#endif // !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN)
+#endif // QT_CONFIG(style_android) || defined(QT_PLUGIN)
diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/widgets/styles/qandroidstyle_p.h
index 4649d90852..caff0afada 100644
--- a/src/widgets/styles/qandroidstyle_p.h
+++ b/src/widgets/styles/qandroidstyle_p.h
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_ANDROID)
+#if QT_CONFIG(style_android)
class Q_WIDGETS_EXPORT QAndroidStyle : public QFusionStyle
{
@@ -388,7 +388,7 @@ private:
AndroidCompoundButtonControl *checkBoxControl;
};
-#endif // QT_NO_STYLE_ANDROID
+#endif // style_android
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 3473ec7fb0..c2b4ef382b 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -40,7 +40,7 @@
#include "qfusionstyle_p.h"
#include "qfusionstyle_p_p.h"
-#if !defined(QT_NO_STYLE_FUSION) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_fusion) || defined(QT_PLUGIN)
#include "qcommonstyle_p.h"
#include <qcombobox.h>
#include <qpushbutton.h>
@@ -1352,10 +1352,11 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
}
int maxWidth = rect.width();
- int minWidth = 0;
- qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
- int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
- int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
+ const auto progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
+ const auto totalSteps = qMax(Q_INT64_C(1), qint64(bar->maximum) - bar->minimum);
+ const auto progressSteps = qint64(progress) - bar->minimum;
+ const auto progressBarWidth = progressSteps * maxWidth / totalSteps;
+ int width = indeterminate ? maxWidth : progressBarWidth;
bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
if (inverted)
@@ -1450,8 +1451,9 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
inverted = bar->invertedAppearance;
if (vertical)
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
- qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
+ const auto totalSteps = qMax(Q_INT64_C(1), qint64(bar->maximum) - bar->minimum);
+ const auto progressSteps = qint64(bar->progress) - bar->minimum;
+ const auto progressIndicatorPos = progressSteps * rect.width() / totalSteps;
if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
if (vertical)
@@ -3746,4 +3748,4 @@ QT_END_NAMESPACE
#include "moc_qfusionstyle_p.cpp"
-#endif // QT_NO_STYLE_FUSION || QT_PLUGIN
+#endif // style_fusion|| QT_PLUGIN
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index 126fb96e78..aac27e51ab 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_FUSION)
+#if QT_CONFIG(style_fusion)
class QFusionStylePrivate;
class QFusionStyle : public QCommonStyle
@@ -110,7 +110,7 @@ protected:
};
-#endif // QT_NO_STYLE_FUSION
+#endif // style_fusion
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h
index 8d1d27d244..169fd9a407 100644
--- a/src/widgets/styles/qfusionstyle_p_p.h
+++ b/src/widgets/styles/qfusionstyle_p_p.h
@@ -57,7 +57,7 @@
#include <qpa/qplatformtheme.h>
#include "private/qguiapplication_p.h"
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
QT_BEGIN_NAMESPACE
@@ -147,6 +147,6 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_FUSION
+#endif // style_fusion
#endif //QFUSIONSTYLE_P_P_H
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 459784c538..3642424a14 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
class QPalette;
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index e973a96a91..ce37065fb6 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -819,11 +819,14 @@ void QPixmapStyle::drawProgressBarFill(const QStyleOption *option,
drawCachedPixmap(vertical ? PB_VComplete : PB_HComplete, option->rect, painter);
} else {
- if (pbar->progress == 0)
+ if (pbar->progress == pbar->minimum)
return;
- const int maximum = pbar->maximum;
- const qreal ratio = qreal(vertical?option->rect.height():option->rect.width())/maximum;
- const int progress = pbar->progress*ratio;
+ const auto totalSteps = qint64(pbar->maximum) - pbar->minimum;
+ const auto progressSteps = qint64(pbar->progress) - pbar->minimum;
+ const auto availablePixels = vertical ? option->rect.height() : option->rect.width();
+ const auto pixelsPerStep = double(availablePixels) / totalSteps;
+
+ const auto progress = static_cast<int>(progressSteps * pixelsPerStep); // width in pixels
QRect optRect = option->rect;
if (vertical) {
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index 09cccff4e8..8dc603f8e6 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -44,20 +44,20 @@
#include "qapplication.h"
#include "qwindowsstyle_p.h"
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
#include "qfusionstyle_p.h"
-#ifndef QT_NO_STYLE_ANDROID
+#if QT_CONFIG(style_android)
#include "qandroidstyle_p.h"
#endif
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
+#if QT_CONFIG(style_windowsxp)
#include "qwindowsxpstyle_p.h"
#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
#include "qwindowsvistastyle_p.h"
#endif
-#if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC)
+#if QT_CONFIG(style_mac)
# include "qmacstyle_mac_p.h"
#endif
@@ -103,32 +103,32 @@ QStyle *QStyleFactory::create(const QString& key)
{
QStyle *ret = 0;
QString style = key.toLower();
-#ifndef QT_NO_STYLE_WINDOWS
+#if QT_CONFIG(style_windows)
if (style == QLatin1String("windows"))
ret = new QWindowsStyle;
else
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
+#if QT_CONFIG(style_windowsxp)
if (style == QLatin1String("windowsxp"))
ret = new QWindowsXPStyle;
else
#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
if (style == QLatin1String("windowsvista"))
ret = new QWindowsVistaStyle;
else
#endif
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
if (style == QLatin1String("fusion"))
ret = new QFusionStyle;
else
#endif
-#ifndef QT_NO_STYLE_ANDROID
+#if QT_CONFIG(style_android)
if (style == QLatin1String("android"))
ret = new QAndroidStyle;
else
#endif
-#ifndef QT_NO_STYLE_MAC
+#if QT_CONFIG(style_mac)
if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
# if 0 // Used to be included in Qt4 for Q_WS_MAC
@@ -160,29 +160,29 @@ QStringList QStyleFactory::keys()
const PluginKeyMap::const_iterator cend = keyMap.constEnd();
for (PluginKeyMap::const_iterator it = keyMap.constBegin(); it != cend; ++it)
list.append(it.value());
-#ifndef QT_NO_STYLE_WINDOWS
+#if QT_CONFIG(style_windows)
if (!list.contains(QLatin1String("Windows")))
list << QLatin1String("Windows");
#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
+#if QT_CONFIG(style_windowsxp)
if (!list.contains(QLatin1String("WindowsXP")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsXP");
#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
+#if QT_CONFIG(style_windowsvista)
if (!list.contains(QLatin1String("WindowsVista")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsVista");
#endif
-#ifndef QT_NO_STYLE_ANDROID
+#if QT_CONFIG(style_android)
if (!list.contains(QLatin1String("Android")))
list << QLatin1String("Android");
#endif
-#ifndef QT_NO_STYLE_FUSION
+#if QT_CONFIG(style_fusion)
if (!list.contains(QLatin1String("Fusion")))
list << QLatin1String("Fusion");
#endif
-#ifndef QT_NO_STYLE_MAC
+#if QT_CONFIG(style_mac)
QString mstyle = QLatin1String("Macintosh");
# if 0 // Used to be included in Qt4 for Q_WS_MAC
mstyle += QLatin1String(" (aqua)");
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 83739655af..c12b3285f1 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -37,9 +37,10 @@
**
****************************************************************************/
+#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qstyleoption.h"
#include "qapplication.h"
-#ifdef Q_OS_MAC
+#if QT_CONFIG(style_mac)
# include "qmacstyle_mac_p.h"
#endif
#include <qdebug.h>
@@ -204,7 +205,7 @@ void QStyleOption::init(const QWidget *widget)
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
state &= ~QStyle::State_Enabled;
#endif
-#if defined(Q_OS_OSX) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
switch (QMacStyle::widgetSizePolicy(widget)) {
case QMacStyle::SizeSmall:
state |= QStyle::State_Small;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 8e77ae0e44..68ee8c22d3 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3903,8 +3903,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (inverted)
reverse = !reverse;
const bool indeterminate = pb->minimum == pb->maximum;
- qreal fillRatio = indeterminate ? 0.50 : qreal(progress - minimum)/(maximum - minimum);
- int fillWidth = int(rect.width() * fillRatio);
+ const auto fillRatio = indeterminate ? 0.50 : double(progress - minimum) / (maximum - minimum);
+ const auto fillWidth = static_cast<int>(rect.width() * fillRatio);
int chunkWidth = fillWidth;
if (subRule.hasContentsSize()) {
QSize sz = subRule.size();
@@ -5542,9 +5542,9 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
} else {
sliderlen = maxlen;
}
-
+ const int sliderPosition = sb->orientation == Qt::Horizontal && sb->direction == Qt::RightToLeft ? sb->maximum - sb->sliderPosition + sb->minimum : sb->sliderPosition;
int sliderstart = (styleOptionSlider.orientation == Qt::Horizontal ? contentRect.left() : contentRect.top())
- + sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition,
+ + sliderPositionFromValue(sb->minimum, sb->maximum, sliderPosition,
maxlen - sliderlen, sb->upsideDown);
QRect sr = (sb->orientation == Qt::Horizontal)
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index e3bf28608c..a8ee881a30 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -40,7 +40,7 @@
#include "qwindowsstyle_p.h"
#include "qwindowsstyle_p_p.h"
-#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_windows) || defined(QT_PLUGIN)
#include "qapplication.h"
#include "qbitmap.h"
@@ -2407,4 +2407,4 @@ QT_END_NAMESPACE
#include "moc_qwindowsstyle_p.cpp"
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 5d68bfeba0..a1d65610ff 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_WINDOWS)
+#if QT_CONFIG(style_windows)
class QWindowsStylePrivate;
@@ -106,7 +106,7 @@ private:
Q_DECLARE_PRIVATE(QWindowsStyle)
};
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index 0c23f4b4a8..5023fd1042 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -55,7 +55,7 @@
#include "qwindowsstyle_p.h"
#include "qcommonstyle_p.h"
-#ifndef QT_NO_STYLE_WINDOWS
+#if QT_CONFIG(style_windows)
#include <qlist.h>
QT_BEGIN_NAMESPACE
@@ -103,7 +103,7 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
#endif //QWINDOWSSTYLE_P_P_H
;
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index bf5aad0187..7f52d3d2f3 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -46,7 +46,7 @@
#include <private/qapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
-#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_windowsvista) || defined(QT_PLUGIN)
QT_BEGIN_NAMESPACE
@@ -1871,8 +1871,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
case CT_MenuBarItem:
if (!sz.isEmpty())
sz += QSize(windowsItemHMargin * 5 + 1, 5);
- return sz;
- break;
+ return sz;
#endif
case CT_ItemViewItem:
sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h
index 0289f404dd..8fbd1dc380 100644
--- a/src/widgets/styles/qwindowsvistastyle_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
class QWindowsVistaStylePrivate;
class QWindowsVistaStyle : public QWindowsXPStyle
@@ -103,7 +103,7 @@ private:
Q_DECLARE_PRIVATE(QWindowsVistaStyle)
friend class QStyleFactory;
};
-#endif //QT_NO_STYLE_WINDOWSVISTA
+#endif // style_windowsvista
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index 4ca47fec2c..18b6f9c3f7 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -54,7 +54,7 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qwindowsvistastyle_p.h"
-#if !defined(QT_NO_STYLE_WINDOWSVISTA)
+#if QT_CONFIG(style_windowsvista)
#include <private/qwindowsxpstyle_p_p.h>
#include <private/qstyleanimation_p.h>
#include <private/qpaintengine_raster_p.h>
@@ -177,6 +177,6 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_STYLE_WINDOWSVISTA
+#endif // style_windowsvista
#endif // QWINDOWSVISTASTYLE_P_P_H
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 4ce359a7c4..f999d823e0 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -39,7 +39,7 @@
#include "qwindowsxpstyle_p.h"
#include "qwindowsxpstyle_p_p.h"
-#if !defined(QT_NO_STYLE_WINDOWSXP) || defined(QT_PLUGIN)
+#if QT_CONFIG(style_windowsxp) || defined(QT_PLUGIN)
#include <private/qobject_p.h>
#include <private/qpaintengine_raster_p.h>
diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h
index 088178cb5a..62e3af927c 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_STYLE_WINDOWSXP)
+#if QT_CONFIG(style_windowsxp)
class QWindowsXPStylePrivate;
class QWindowsXPStyle : public QWindowsStyle
@@ -102,7 +102,7 @@ private:
friend class QStyleFactory;
};
-#endif // QT_NO_STYLE_WINDOWSXP
+#endif // style_windowsxp
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index d6702c8803..fb5210cb07 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -94,7 +94,7 @@ QT_BEGIN_NAMESPACE
// Uncomment define below to build debug assisting code, and output
// #define DEBUG_XP_STYLE
-#if !defined(QT_NO_STYLE_WINDOWSXP)
+#if QT_CONFIG(style_windowsxp)
// Declarations -----------------------------------------------------------------------------------
class XPThemeData
@@ -338,7 +338,7 @@ inline QMarginsF XPThemeData::themeMargins(const QWidget *w, QPainter *p, int th
return theme.margins(propId);
}
-#endif // QT_NO_STYLE_WINDOWS
+#endif // style_windows
QT_END_NAMESPACE
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 69e13fb6ec..481123f0d4 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -37,51 +37,35 @@ RESOURCES += styles/qstyle.qrc
include($$OUT_PWD/qtwidgets-config.pri)
-contains( styles, mac ) {
+qtConfig(style-mac) {
HEADERS += \
styles/qmacstyle_mac_p.h \
styles/qmacstyle_mac_p_p.h
OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm
LIBS_PRIVATE += -framework Carbon
-} else {
- DEFINES += QT_NO_STYLE_MAC
}
-contains( styles, windowsvista ) {
- HEADERS += styles/qwindowsvistastyle_p.h
- HEADERS += styles/qwindowsvistastyle_p_p.h
+qtConfig(style-windowsvista) {
+ HEADERS += styles/qwindowsvistastyle_p.h styles/qwindowsvistastyle_p_p.h
SOURCES += styles/qwindowsvistastyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWSVISTA
}
-contains( styles, windowsxp ) {
- HEADERS += styles/qwindowsxpstyle_p.h
- HEADERS += styles/qwindowsxpstyle_p_p.h
+qtConfig(style-windowsxp) {
+ HEADERS += styles/qwindowsxpstyle_p.h styles/qwindowsxpstyle_p_p.h
SOURCES += styles/qwindowsxpstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWSXP
}
-contains( styles, windows ) {
- HEADERS += styles/qwindowsstyle_p.h
- HEADERS += styles/qwindowsstyle_p_p.h
+qtConfig(style-windows) {
+ HEADERS += styles/qwindowsstyle_p.h styles/qwindowsstyle_p_p.h
SOURCES += styles/qwindowsstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWS
}
-contains( styles, fusion ) {
- HEADERS += styles/qfusionstyle_p.h
- HEADERS += styles/qfusionstyle_p_p.h
- SOURCES += styles/qfusionstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_FUSION
+qtConfig(style-fusion) {
+ HEADERS += styles/qfusionstyle_p.h styles/qfusionstyle_p_p.h
+ SOURCES += styles/qfusionstyle.cpp
}
-contains( styles, android ) {
+qtConfig(style-android) {
HEADERS += styles/qandroidstyle_p.h
SOURCES += styles/qandroidstyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_ANDROID
}
diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h
index fa70806ef7..74a0f2a0f3 100644
--- a/src/widgets/util/qflickgesture_p.h
+++ b/src/widgets/util/qflickgesture_p.h
@@ -97,9 +97,9 @@ class QFlickGestureRecognizer : public QGestureRecognizer
public:
QFlickGestureRecognizer(Qt::MouseButton button);
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event);
- void reset(QGesture *state);
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
+ void reset(QGesture *state) override;
private:
Qt::MouseButton button; // NoButton == Touch
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 224ffeb6e2..630524aadb 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -436,7 +436,10 @@ bool QBalloonTip::isBalloonVisible()
QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title,
const QString& message, QSystemTrayIcon *ti)
- : QWidget(0, Qt::ToolTip), trayIcon(ti), timerId(-1)
+ : QWidget(0, Qt::ToolTip),
+ trayIcon(ti),
+ timerId(-1),
+ showArrow(true)
{
setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 59d517e77b..033d4e9e05 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -654,10 +654,12 @@ void QUndoStack::setClean()
This method resets the clean index to -1.
This is typically called in the following cases, when a document has been:
+ \list
\li created basing on some template and has not been saved,
so no filename has been associated with the document yet.
\li restored from a backup file.
\li changed outside of the editor and the user did not reload it.
+ \endlist
\sa isClean(), setClean(), cleanIndex()
*/
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index d93489e663..ac46894a27 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -117,12 +117,12 @@ public:
void setGroupSeparatorShown(bool shown);
bool isGroupSeparatorShown() const;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void interpretText();
- bool event(QEvent *event);
+ bool event(QEvent *event) override;
- QVariant inputMethodQuery(Qt::InputMethodQuery) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
virtual QValidator::State validate(QString &input, int &pos) const;
virtual void fixup(QString &input) const;
@@ -134,24 +134,24 @@ public Q_SLOTS:
void selectAll();
virtual void clear();
protected:
- void resizeEvent(QResizeEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
#ifndef QT_NO_WHEELEVENT
- void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) override;
#endif
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
- void contextMenuEvent(QContextMenuEvent *event);
- void changeEvent(QEvent *event);
- void closeEvent(QCloseEvent *event);
- void hideEvent(QHideEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void timerEvent(QTimerEvent *event);
- void paintEvent(QPaintEvent *event);
- void showEvent(QShowEvent *event);
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void contextMenuEvent(QContextMenuEvent *event) override;
+ void changeEvent(QEvent *event) override;
+ void closeEvent(QCloseEvent *event) override;
+ void hideEvent(QHideEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void showEvent(QShowEvent *event) override;
void initStyleOption(QStyleOptionSpinBox *option) const;
QLineEdit *lineEdit() const;
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index 47ca10a183..5ec59d899b 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -156,8 +156,8 @@ class QSpinBoxValidator : public QValidator
{
public:
QSpinBoxValidator(QAbstractSpinBox *qptr, QAbstractSpinBoxPrivate *dptr);
- QValidator::State validate(QString &input, int &) const;
- void fixup(QString &) const;
+ QValidator::State validate(QString &input, int &) const override;
+ void fixup(QString &) const override;
private:
QAbstractSpinBox *qptr;
QAbstractSpinBoxPrivate *dptr;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 4358e568bf..4519265fb8 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -66,7 +66,7 @@
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
#include <qdebug.h>
-#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_EFFECTS) && QT_CONFIG(style_mac)
#include <private/qcore_mac_p.h>
#include <private/qmacstyle_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
@@ -1841,7 +1841,7 @@ QLineEdit *QComboBox::lineEdit() const
Sets the \a validator to use instead of the current validator.
- \note The validator is removed when the editable property becomes \c false.
+ \note The validator is removed when the \l editable property becomes \c false.
*/
void QComboBox::setValidator(const QValidator *v)
@@ -1876,7 +1876,7 @@ const QValidator *QComboBox::validator() const
By default, for an editable combo box, a QCompleter that
performs case insensitive inline completion is automatically created.
- \note The completer is removed when the \a editable property becomes \c false.
+ \note The completer is removed when the \l editable property becomes \c false.
*/
void QComboBox::setCompleter(QCompleter *c)
{
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 7ca077abf9..6c36359f81 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -86,13 +86,13 @@ public:
QComboBoxListView(QComboBox *cmb = 0) : combo(cmb) {}
protected:
- void resizeEvent(QResizeEvent *event)
+ void resizeEvent(QResizeEvent *event) override
{
resizeContents(viewport()->width(), contentsSize().height());
QListView::resizeEvent(event);
}
- QStyleOptionViewItem viewOptions() const
+ QStyleOptionViewItem viewOptions() const override
{
QStyleOptionViewItem option = QListView::viewOptions();
option.showDecorationSelected = true;
@@ -101,7 +101,7 @@ protected:
return option;
}
- void paintEvent(QPaintEvent *e)
+ void paintEvent(QPaintEvent *e) override
{
if (combo) {
QStyleOptionComboBox opt;
@@ -142,7 +142,7 @@ public:
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
setAttribute(Qt::WA_NoMousePropagation);
}
- QSize sizeHint() const {
+ QSize sizeHint() const override {
return QSize(20, style()->pixelMetric(QStyle::PM_MenuScrollerHeight));
}
@@ -156,14 +156,14 @@ protected:
fast = false;
}
- void enterEvent(QEvent *) {
+ void enterEvent(QEvent *) override {
startTimer();
}
- void leaveEvent(QEvent *) {
+ void leaveEvent(QEvent *) override {
stopTimer();
}
- void timerEvent(QTimerEvent *e) {
+ void timerEvent(QTimerEvent *e) override {
if (e->timerId() == timer.timerId()) {
emit doScroll(sliderAction);
if (fast) {
@@ -172,11 +172,11 @@ protected:
}
}
}
- void hideEvent(QHideEvent *) {
+ void hideEvent(QHideEvent *) override {
stopTimer();
}
- void mouseMoveEvent(QMouseEvent *e)
+ void mouseMoveEvent(QMouseEvent *e) override
{
// Enable fast scrolling if the cursor is directly above or below the popup.
const int mouseX = e->pos().x();
@@ -188,7 +188,7 @@ protected:
fast = horizontallyInside && verticallyOutside;
}
- void paintEvent(QPaintEvent *) {
+ void paintEvent(QPaintEvent *) override {
QPainter p(this);
QStyleOptionMenuItem menuOpt;
menuOpt.init(this);
@@ -235,15 +235,15 @@ public Q_SLOTS:
void viewDestroyed();
protected:
- void changeEvent(QEvent *e);
- bool eventFilter(QObject *o, QEvent *e);
- void mousePressEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void showEvent(QShowEvent *e);
- void hideEvent(QHideEvent *e);
- void timerEvent(QTimerEvent *timerEvent);
- void leaveEvent(QEvent *e);
- void resizeEvent(QResizeEvent *e);
+ void changeEvent(QEvent *e) override;
+ bool eventFilter(QObject *o, QEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void showEvent(QShowEvent *e) override;
+ void hideEvent(QHideEvent *e) override;
+ void timerEvent(QTimerEvent *timerEvent) override;
+ void leaveEvent(QEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
QStyleOptionComboBox comboStyleOption() const;
Q_SIGNALS:
@@ -270,13 +270,13 @@ public:
protected:
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const {
+ const QModelIndex &index) const override {
QStyleOptionMenuItem opt = getStyleOption(option, index);
painter->fillRect(option.rect, opt.palette.background());
mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo);
}
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const {
+ const QModelIndex &index) const override {
QStyleOptionMenuItem opt = getStyleOption(option, index);
return mCombo->style()->sizeFromContents(
QStyle::CT_MenuItem, &opt, option.rect.size(), mCombo);
@@ -309,7 +309,7 @@ public:
protected:
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const {
+ const QModelIndex &index) const override {
if (isSeparator(index)) {
QRect rect = option.rect;
if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(option.widget))
@@ -323,7 +323,7 @@ protected:
}
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const {
+ const QModelIndex &index) const override {
if (isSeparator(index)) {
int pm = mCombo->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, mCombo);
return QSize(pm, pm);
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index c261ce369b..5c9f4e0f9d 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -159,12 +159,12 @@ public:
Qt::TimeSpec timeSpec() const;
void setTimeSpec(Qt::TimeSpec spec);
- QSize sizeHint() const;
+ QSize sizeHint() const override;
- virtual void clear();
- virtual void stepBy(int steps);
+ void clear() override;
+ void stepBy(int steps) override;
- bool event(QEvent *event);
+ bool event(QEvent *event) override;
Q_SIGNALS:
void dateTimeChanged(const QDateTime &dateTime);
void timeChanged(const QTime &time);
@@ -176,20 +176,20 @@ public Q_SLOTS:
void setTime(const QTime &time);
protected:
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) override;
#endif
- virtual void focusInEvent(QFocusEvent *event);
- virtual bool focusNextPrevChild(bool next);
- virtual QValidator::State validate(QString &input, int &pos) const;
- virtual void fixup(QString &input) const;
+ void focusInEvent(QFocusEvent *event) override;
+ bool focusNextPrevChild(bool next) override;
+ QValidator::State validate(QString &input, int &pos) const override;
+ void fixup(QString &input) const override;
virtual QDateTime dateTimeFromText(const QString &text) const;
virtual QString textFromDateTime(const QDateTime &dt) const;
- virtual StepEnabled stepEnabled() const;
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void paintEvent(QPaintEvent *event);
+ StepEnabled stepEnabled() const override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
void initStyleOption(QStyleOptionSpinBox *option) const;
QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = Q_NULLPTR);
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 6889bda041..730aa0f0b2 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -167,10 +167,10 @@ private Q_SLOTS:
void dateSelectionChanged();
protected:
- void hideEvent(QHideEvent *);
- void mousePressEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *);
- bool event(QEvent *e);
+ void hideEvent(QHideEvent *) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ bool event(QEvent *e) override;
private:
QCalendarWidget *verifyCalendarInstance();
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 63f8172bf6..ad19e5d5f9 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -266,6 +266,16 @@ bool QDockAreaLayoutInfo::isEmpty() const
return next(-1) == -1;
}
+bool QDockAreaLayoutInfo::onlyHasPlaceholders() const
+{
+ for (const QDockAreaLayoutItem &item : item_list) {
+ if (!item.placeHolderItem)
+ return false;
+ }
+
+ return true;
+}
+
QSize QDockAreaLayoutInfo::minimumSize() const
{
if (isEmpty())
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h
index f22a3d2de2..21787283f4 100644
--- a/src/widgets/widgets/qdockarealayout_p.h
+++ b/src/widgets/widgets/qdockarealayout_p.h
@@ -167,6 +167,7 @@ public:
void clear();
bool isEmpty() const;
+ bool onlyHasPlaceholders() const;
bool hasFixedSize() const;
QList<int> findSeparator(const QPoint &pos) const;
int next(int idx) const;
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 1df7259aba..53cb21186f 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -219,8 +219,10 @@ QDockWidgetLayout::~QDockWidgetLayout()
bool QDockWidgetLayout::nativeWindowDeco() const
{
bool floating = parentWidget()->isWindow();
- if (!floating && qobject_cast<QDockWidgetGroupWindow*>(parentWidget()->parentWidget()))
- return wmSupportsNativeWindowDeco();
+ if (!floating) {
+ if (auto groupWindow = qobject_cast<const QDockWidgetGroupWindow*>(parentWidget()->parentWidget()))
+ return groupWindow->hasNativeDecos();
+ }
return nativeWindowDeco(floating);
}
@@ -797,8 +799,10 @@ void QDockWidgetPrivate::endDrag(bool abort)
if (abort || !mwLayout->plug(state->widgetItem)) {
if (hasFeature(this, QDockWidget::DockWidgetFloatable)) {
// This QDockWidget will now stay in the floating state.
- if (state->ownWidgetItem)
+ if (state->ownWidgetItem) {
delete state->widgetItem;
+ state->widgetItem = nullptr;
+ }
mwLayout->restore();
QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout);
if (!dwLayout->nativeWindowDeco()) {
diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
index 84389f16df..a8faffd6be 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -54,11 +54,11 @@ public:
QMacNativeWidget(NSView *parentView = Q_NULLPTR);
~QMacNativeWidget();
- QSize sizeHint() const;
+ QSize sizeHint() const override;
NSView *nativeView() const;
protected:
- bool event(QEvent *ev);
+ bool event(QEvent *ev) override;
};
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 8df197e05c..14d7f3d835 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -183,7 +183,7 @@ class QDockWidgetGroupLayout : public QLayout {
QDockAreaLayoutInfo info;
QWidgetResizeHandler *resizer;
public:
- QDockWidgetGroupLayout(QWidget* parent) : QLayout(parent) {
+ QDockWidgetGroupLayout(QDockWidgetGroupWindow* parent) : QLayout(parent) {
setSizeConstraint(QLayout::SetMinAndMaxSize);
resizer = new QWidgetResizeHandler(parent);
resizer->setMovingEnabled(false);
@@ -221,7 +221,7 @@ public:
}
void setGeometry(const QRect&r) Q_DECL_OVERRIDE
{
- static_cast<QDockWidgetGroupWindow *>(parent())->destroyOrHideIfEmpty();
+ groupWindow()->destroyOrHideIfEmpty();
QDockAreaLayoutInfo *li = layoutInfo();
if (li->isEmpty())
return;
@@ -239,7 +239,7 @@ public:
bool nativeWindowDeco() const
{
- return QDockWidgetLayout::wmSupportsNativeWindowDeco();
+ return groupWindow()->hasNativeDecos();
}
int frameWidth() const
@@ -247,6 +247,11 @@ public:
return nativeWindowDeco() ? 0 :
parentWidget()->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, parentWidget());
}
+
+ QDockWidgetGroupWindow *groupWindow() const
+ {
+ return static_cast<QDockWidgetGroupWindow *>(parent());
+ }
};
bool QDockWidgetGroupWindow::event(QEvent *e)
@@ -390,16 +395,49 @@ void QDockWidgetGroupWindow::adjustFlags()
flags.setFlag(Qt::WindowCloseButtonHint, top->features() & QDockWidget::DockWidgetClosable);
flags &= ~Qt::FramelessWindowHint;
} else {
+ flags &= ~(Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
flags |= Qt::FramelessWindowHint;
}
+
if (oldFlags != flags) {
setWindowFlags(flags);
+ const bool gainedNativeDecos = (oldFlags & Qt::FramelessWindowHint) && !(flags & Qt::FramelessWindowHint);
+ const bool lostNativeDecos = !(oldFlags & Qt::FramelessWindowHint) && (flags & Qt::FramelessWindowHint);
+
+ // Adjust the geometry after gaining/losing decos, so that the client area appears always
+ // at the same place when tabbing
+ if (lostNativeDecos) {
+ QRect newGeometry = geometry();
+ newGeometry.setTop(frameGeometry().top());
+ const int bottomFrame = geometry().top() - frameGeometry().top();
+ m_removedFrameSize = QSize((frameSize() - size()).width(), bottomFrame);
+ setGeometry(newGeometry);
+ } else if (gainedNativeDecos && m_removedFrameSize.isValid()) {
+ QRect r = geometry();
+ r.adjust(-m_removedFrameSize.width() / 2, 0,
+ -m_removedFrameSize.width() / 2, -m_removedFrameSize.height());
+ setGeometry(r);
+ m_removedFrameSize = QSize();
+ }
+
show(); // setWindowFlags hides the window
}
setWindowTitle(top->windowTitle());
setWindowIcon(top->windowIcon());
}
+
+bool QDockWidgetGroupWindow::hasNativeDecos() const
+{
+ if (!QDockWidgetLayout::wmSupportsNativeWindowDeco())
+ return false;
+
+ if (QDockWidget *dw = topDockWidget())
+ return dw->titleBarWidget() == nullptr;
+
+ return true;
+}
+
#endif
/******************************************************************************
@@ -992,12 +1030,19 @@ bool QMainWindowLayoutState::restoreState(QDataStream &_stream,
Qt::Horizontal, QTabBar::RoundedSouth, mainWindow);
QRect geometry;
stream >> geometry;
- if (!floatingTab->layoutInfo()->restoreState(stream, dockWidgets, false))
+ QDockAreaLayoutInfo *info = floatingTab->layoutInfo();
+ if (!info->restoreState(stream, dockWidgets, false))
return false;
geometry = QDockAreaLayout::constrainedRect(geometry, floatingTab);
floatingTab->move(geometry.topLeft());
floatingTab->resize(geometry.size());
- floatingTab->show();
+
+ // Don't show an empty QDockWidgetGroupWindow if no dock widget is available yet.
+ // reparentWidgets() would be triggered by show(), so do it explicitly here.
+ if (info->onlyHasPlaceholders())
+ info->reparentWidgets(floatingTab);
+ else
+ floatingTab->show();
}
break;
#endif // QT_NO_TABBAR
@@ -1704,6 +1749,9 @@ void QMainWindowLayout::tabChanged()
if (activated)
emit static_cast<QMainWindow *>(parentWidget())->tabifiedDockWidgetActivated(activated);
+ if (auto dwgw = qobject_cast<QDockWidgetGroupWindow*>(tb->parentWidget()))
+ dwgw->adjustFlags();
+
if (QWidget *w = centralWidget())
w->raise();
}
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 6e8b965431..40336caeba 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -83,9 +83,14 @@ public:
QDockWidget *topDockWidget() const;
void destroyOrHideIfEmpty();
void adjustFlags();
+ bool hasNativeDecos() const;
+
protected:
bool event(QEvent *) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
+
+private:
+ QSize m_removedFrameSize;
};
// This item will be used in the layout for the gap item. We cannot use QWidgetItem directly
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 183f1c2848..9b39743281 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -160,7 +160,7 @@
#include <QApplication>
#include <QStyle>
-#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && !defined(QT_NO_STYLE_MAC)
+#if 0 /* Used to be included in Qt4 for Q_WS_MAC */ && QT_CONFIG(style_mac)
#include <private/qmacstyle_mac_p.h>
#endif
#include <QChildEvent>
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 2fff2fc729..a627c86871 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -158,7 +158,7 @@
#include <QMainWindow>
#include <QScrollBar>
#include <QDebug>
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
#include <private/qmacstyle_mac_p.h>
#endif
#include <QMdiArea>
@@ -295,7 +295,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti
Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
Q_ASSERT(widget);
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
// Native Mac windows don't show tool tip.
if (qobject_cast<QMacStyle *>(widget->style()))
return;
@@ -1076,7 +1076,7 @@ void QMdiSubWindowPrivate::updateCursor()
{
#ifndef QT_NO_CURSOR
Q_Q(QMdiSubWindow);
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(q->style()))
return;
#endif
@@ -1504,7 +1504,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
q->showNormal();
break;
case QStyle::SC_TitleBarMinButton:
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(q->style())) {
if (q->isMinimized())
q->showNormal();
@@ -1521,7 +1521,7 @@ void QMdiSubWindowPrivate::processClickedSubControl()
q->showNormal();
break;
case QStyle::SC_TitleBarMaxButton:
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(q->style())) {
if (q->isMaximized())
q->showNormal();
@@ -1568,7 +1568,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const
}
QRegion region;
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(q->style()))
return region;
#endif
@@ -1775,7 +1775,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (isChildOfTabbedQMdiArea(q))
return false;
-#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
Q_UNUSED(isChildOfQMdiSubWindow);
return true;
#else
@@ -2191,7 +2191,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip)
return;
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
bool putSizeGripInLayout = layout ? true : false;
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(q->style()))
putSizeGripInLayout = false;
#endif
@@ -2843,7 +2843,7 @@ bool QMdiSubWindow::event(QEvent *event)
d->isMaximizeMode = false;
d->isWidgetHiddenByUs = false;
if (!parent()) {
-#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(style()))
delete d->sizeGrip;
#endif
@@ -2938,7 +2938,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent)
return;
}
-#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
&& !(windowFlags() & Qt::FramelessWindowHint)) {
d->setSizeGrip(new QSizeGrip(this));
@@ -3333,7 +3333,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
d->hoveredSubControl, this);
}
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty())
hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
#endif
@@ -3543,7 +3543,7 @@ QSize QMdiSubWindow::minimumSizeHint() const
int sizeGripHeight = 0;
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
sizeGripHeight = d->sizeGrip->height();
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
+#if QT_CONFIG(style_mac)
else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip)
sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
#endif
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 650d3b0bfb..33fa73eb0d 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -80,7 +80,7 @@ public:
mdiChild = child;
}
- void *qt_metacast(const char *classname)
+ void *qt_metacast(const char *classname) override
{
if (classname && strcmp(classname, "ControlElement") == 0)
return this;
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 36a8a96b79..2917083415 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1507,7 +1507,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
When inserting action items you usually specify a receiver and a
slot. The receiver will be notifed whenever the item is
\l{QAction::triggered()}{triggered()}. In addition, QMenu provides
- two signals, activated() and highlighted(), which signal the
+ two signals, triggered() and hovered(), which signal the
QAction that was triggered from the menu.
You clear a menu with clear() and remove individual action items
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index ec15155710..7ad205b77a 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -86,9 +86,9 @@ public:
void setDefaultUp(bool);
bool isDefaultUp() const;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
- int heightForWidth(int) const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
+ int heightForWidth(int) const override;
QRect actionGeometry(QAction *) const;
QAction *actionAt(const QPoint &) const;
@@ -104,27 +104,27 @@ public:
void setNativeMenuBar(bool nativeMenuBar);
QPlatformMenuBar *platformMenuBar();
public Q_SLOTS:
- virtual void setVisible(bool visible);
+ void setVisible(bool visible) override;
Q_SIGNALS:
void triggered(QAction *action);
void hovered(QAction *action);
protected:
- void changeEvent(QEvent *);
- void keyPressEvent(QKeyEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void leaveEvent(QEvent *);
- void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
- void actionEvent(QActionEvent *);
- void focusOutEvent(QFocusEvent *);
- void focusInEvent(QFocusEvent *);
- void timerEvent(QTimerEvent *);
- bool eventFilter(QObject *, QEvent *);
- bool event(QEvent *);
+ void changeEvent(QEvent *) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void leaveEvent(QEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void actionEvent(QActionEvent *) override;
+ void focusOutEvent(QFocusEvent *) override;
+ void focusInEvent(QFocusEvent *) override;
+ void timerEvent(QTimerEvent *) override;
+ bool eventFilter(QObject *, QEvent *) override;
+ bool event(QEvent *) override;
void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const;
private:
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index 10f005e6d3..64f19047b6 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -144,16 +144,17 @@ bool QProgressBarPrivate::repaintRequired() const
if (value == lastPaintedValue)
return false;
- int valueDifference = qAbs(value - lastPaintedValue);
-
+ const auto valueDifference = qAbs(qint64(value) - lastPaintedValue);
// Check if the text needs to be repainted
if (value == minimum || value == maximum)
return true;
+
+ const auto totalSteps = qint64(maximum) - minimum;
if (textVisible) {
if ((format.contains(QLatin1String("%v"))))
return true;
if ((format.contains(QLatin1String("%p"))
- && valueDifference >= qAbs((maximum - minimum) / 100)))
+ && valueDifference >= qAbs(totalSteps / 100)))
return true;
}
@@ -166,7 +167,7 @@ bool QProgressBarPrivate::repaintRequired() const
// (valueDifference / (maximum - minimum) > cw / groove.width())
// transformed to avoid integer division.
int grooveBlock = (q->orientation() == Qt::Horizontal) ? groove.width() : groove.height();
- return (valueDifference * grooveBlock > cw * (maximum - minimum));
+ return valueDifference * grooveBlock > cw * totalSteps;
}
/*!
@@ -260,9 +261,10 @@ QProgressBar::~QProgressBar()
void QProgressBar::reset()
{
Q_D(QProgressBar);
- d->value = d->minimum - 1;
if (d->minimum == INT_MIN)
d->value = INT_MIN;
+ else
+ d->value = d->minimum - 1;
repaint();
}
@@ -358,7 +360,7 @@ void QProgressBar::setRange(int minimum, int maximum)
d->minimum = minimum;
d->maximum = qMax(minimum, maximum);
- if (d->value < (d->minimum - 1) || d->value > d->maximum)
+ if (d->value < qint64(d->minimum) - 1 || d->value > d->maximum)
reset();
else
update();
@@ -479,11 +481,11 @@ QString QProgressBar::text() const
// progress bar has one step and that we are on that step. Return
// 100% here in order to avoid division by zero further down.
if (totalSteps == 0) {
- result.replace(QLatin1String("%p"), locale.toString(int(100)));
+ result.replace(QLatin1String("%p"), locale.toString(100));
return result;
}
- int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps;
+ const auto progress = static_cast<int>((qint64(d->value) - d->minimum) * 100.0 / totalSteps);
result.replace(QLatin1String("%p"), locale.toString(progress));
return result;
}
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index 2e77f0be7a..2eb12fd90d 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -91,11 +91,11 @@ public:
void setDisplayIntegerBase(int base);
protected:
- bool event(QEvent *event);
- virtual QValidator::State validate(QString &input, int &pos) const;
+ bool event(QEvent *event) override;
+ QValidator::State validate(QString &input, int &pos) const override;
virtual int valueFromText(const QString &text) const;
virtual QString textFromValue(int val) const;
- virtual void fixup(QString &str) const;
+ void fixup(QString &str) const override;
public Q_SLOTS:
@@ -151,10 +151,10 @@ public:
int decimals() const;
void setDecimals(int prec);
- virtual QValidator::State validate(QString &input, int &pos) const;
+ QValidator::State validate(QString &input, int &pos) const override;
virtual double valueFromText(const QString &text) const;
virtual QString textFromValue(double val) const;
- virtual void fixup(QString &str) const;
+ void fixup(QString &str) const override;
public Q_SLOTS:
void setValue(double val);
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 9b65dc43d1..a862274a3d 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1924,19 +1924,15 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
unknown = false;
}
- // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
- if (unknown && !isReadOnly()
- && event->modifiers() != Qt::ControlModifier
- && event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) {
- QString t = event->text();
- if (!t.isEmpty() && t.at(0).isPrint()) {
- insert(t);
+ if (unknown
+ && !isReadOnly()
+ && isAcceptableInput(event)) {
+ insert(event->text());
#ifndef QT_NO_COMPLETER
- complete(event->key());
+ complete(event->key());
#endif
- event->accept();
- return;
- }
+ event->accept();
+ return;
}
if (unknown)
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index d4a4534fb5..b9340c0aff 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -64,6 +64,7 @@
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"
#include "QtCore/qthread.h"
+#include "QtGui/private/qinputcontrol_p.h"
#include "qplatformdefs.h"
@@ -76,13 +77,14 @@
QT_BEGIN_NAMESPACE
-class Q_WIDGETS_EXPORT QWidgetLineControl : public QObject
+class Q_WIDGETS_EXPORT QWidgetLineControl : public QInputControl
{
Q_OBJECT
public:
QWidgetLineControl(const QString &txt = QString())
- : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
+ : QInputControl(LineEdit)
+ , m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
m_hideCursor(false), m_separator(0), m_readOnly(0),
m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0),
m_validInput(1), m_blinkStatus(0), m_blinkEnabled(false), m_blinkTimer(0), m_deleteAllTimer(0),
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 47806a194e..f5672bd87a 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -848,21 +848,21 @@ void QWidgetTextControl::redo()
}
QWidgetTextControl::QWidgetTextControl(QObject *parent)
- : QObject(*new QWidgetTextControlPrivate, parent)
+ : QInputControl(QInputControl::TextEdit, *new QWidgetTextControlPrivate, parent)
{
Q_D(QWidgetTextControl);
d->init();
}
QWidgetTextControl::QWidgetTextControl(const QString &text, QObject *parent)
- : QObject(*new QWidgetTextControlPrivate, parent)
+ : QInputControl(QInputControl::TextEdit, *new QWidgetTextControlPrivate, parent)
{
Q_D(QWidgetTextControl);
d->init(Qt::RichText, text);
}
QWidgetTextControl::QWidgetTextControl(QTextDocument *doc, QObject *parent)
- : QObject(*new QWidgetTextControlPrivate, parent)
+ : QInputControl(QInputControl::TextEdit, *new QWidgetTextControlPrivate, parent)
{
Q_D(QWidgetTextControl);
d->init(Qt::RichText, QString(), doc);
@@ -1361,14 +1361,7 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
process:
{
- // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
- if (e->modifiers() == Qt::ControlModifier
- || e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
- e->ignore();
- return;
- }
- QString text = e->text();
- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
+ if (q->isAcceptableInput(e)) {
if (overwriteMode
// no need to call deleteChar() if we have a selection, insertText
// does it already
@@ -1376,7 +1369,7 @@ process:
&& !cursor.atBlockEnd())
cursor.deleteChar();
- cursor.insertText(text);
+ cursor.insertText(e->text());
selectionChanged();
} else {
e->ignore();
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index b45f4fff74..f540a3c9ad 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -63,6 +63,7 @@
#include <QtGui/qtextdocumentfragment.h>
#include <QtGui/qclipboard.h>
#include <QtCore/qmimedata.h>
+#include <QtGui/private/qinputcontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -75,7 +76,7 @@ class QAbstractScrollArea;
class QEvent;
class QTimerEvent;
-class Q_WIDGETS_EXPORT QWidgetTextControl : public QObject
+class Q_WIDGETS_EXPORT QWidgetTextControl : public QInputControl
{
Q_OBJECT
Q_DECLARE_PRIVATE(QWidgetTextControl)