summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/double-conversion/include/double-conversion/utils.h2
-rw-r--r--src/3rdparty/freetype_dependency.pri8
-rw-r--r--src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro4
-rw-r--r--src/3rdparty/harfbuzz_dependency.pri6
-rw-r--r--src/3rdparty/pcre/pcre.pro2
-rw-r--r--src/corelib/arch/arch.pri2
-rw-r--r--src/corelib/arch/qatomic_msvc.h42
-rw-r--r--src/corelib/codecs/codecs.pri23
-rw-r--r--src/corelib/codecs/qicucodec.cpp10
-rw-r--r--src/corelib/codecs/qtextcodec.cpp6
-rw-r--r--src/corelib/codecs/qutfcodec.cpp87
-rw-r--r--src/corelib/codecs/qwindowscodec.cpp2
-rw-r--r--src/corelib/corelib.pro16
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp36
-rw-r--r--src/corelib/global/qcompilerdetection.h30
-rw-r--r--src/corelib/global/qconfig-large.h140
-rw-r--r--src/corelib/global/qconfig-medium.h241
-rw-r--r--src/corelib/global/qconfig-minimal.h463
-rw-r--r--src/corelib/global/qconfig-nacl.h233
-rw-r--r--src/corelib/global/qconfig-small.h281
-rw-r--r--src/corelib/global/qflags.h9
-rw-r--r--src/corelib/global/qglobal.cpp359
-rw-r--r--src/corelib/global/qglobal.h19
-rw-r--r--src/corelib/global/qhooks.cpp2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp33
-rw-r--r--src/corelib/global/qlibraryinfo.h11
-rw-r--r--src/corelib/global/qlogging.cpp4
-rw-r--r--src/corelib/global/qnamespace.h8
-rw-r--r--src/corelib/global/qnamespace.qdoc35
-rw-r--r--src/corelib/global/qnumeric_p.h2
-rw-r--r--src/corelib/global/qprocessordetection.h2
-rw-r--r--src/corelib/global/qsysinfo.h18
-rw-r--r--src/corelib/global/qsystemdetection.h22
-rw-r--r--src/corelib/global/qt_windows.h17
-rw-r--r--src/corelib/io/io.pri37
-rw-r--r--src/corelib/io/qdatastream.h5
-rw-r--r--src/corelib/io/qdir.cpp2
-rw-r--r--src/corelib/io/qfileselector.cpp13
-rw-r--r--src/corelib/io/qfileselector_p.h2
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp250
-rw-r--r--src/corelib/io/qfilesystemiterator_win.cpp2
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h3
-rw-r--r--src/corelib/io/qfilesystemwatcher.cpp4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm8
-rw-r--r--src/corelib/io/qfilesystemwatcher_win.cpp10
-rw-r--r--src/corelib/io/qfsfileengine.cpp8
-rw-r--r--src/corelib/io/qfsfileengine_p.h9
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp141
-rw-r--r--src/corelib/io/qiodevice.cpp33
-rw-r--r--src/corelib/io/qlockfile_unix.cpp4
-rw-r--r--src/corelib/io/qlockfile_win.cpp4
-rw-r--r--src/corelib/io/qprocess.cpp14
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qprocess_wince.cpp308
-rw-r--r--src/corelib/io/qsettings.cpp12
-rw-r--r--src/corelib/io/qsettings_mac.cpp26
-rw-r--r--src/corelib/io/qsettings_win.cpp8
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm4
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp42
-rw-r--r--src/corelib/io/qstorageinfo_p.h2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp27
-rw-r--r--src/corelib/io/qtemporaryfile_p.h5
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qurl.cpp30
-rw-r--r--src/corelib/io/qurl.h16
-rw-r--r--src/corelib/io/qwindowspipereader.cpp17
-rw-r--r--src/corelib/io/qwindowspipewriter.cpp5
-rw-r--r--src/corelib/json/qjson_p.h4
-rw-r--r--src/corelib/kernel/kernel.pri17
-rw-r--r--src/corelib/kernel/qcore_foundation.mm537
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm4
-rw-r--r--src/corelib/kernel/qcore_unix_p.h4
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp41
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp36
-rw-r--r--src/corelib/kernel/qcorecmdlineargs_p.h88
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf.mm12
-rw-r--r--src/corelib/kernel/qeventdispatcher_cf_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp259
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h2
-rw-r--r--src/corelib/kernel/qfunctions_p.h4
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp407
-rw-r--r--src/corelib/kernel/qfunctions_wince.h473
-rw-r--r--src/corelib/kernel/qmath.h22
-rw-r--r--src/corelib/kernel/qmetaobject.h10
-rw-r--r--src/corelib/kernel/qmetaobject_p.h10
-rw-r--r--src/corelib/kernel/qmetatype.cpp6
-rw-r--r--src/corelib/kernel/qmetatype.h13
-rw-r--r--src/corelib/kernel/qobject.h4
-rw-r--r--src/corelib/kernel/qobject_impl.h16
-rw-r--r--src/corelib/kernel/qppsobject.cpp24
-rw-r--r--src/corelib/kernel/qsharedmemory_win.cpp8
-rw-r--r--src/corelib/kernel/qsystemerror.cpp22
-rw-r--r--src/corelib/kernel/qsystemsemaphore_p.h4
-rw-r--r--src/corelib/kernel/qsystemsemaphore_posix.cpp4
-rw-r--r--src/corelib/kernel/qsystemsemaphore_systemv.cpp3
-rw-r--r--src/corelib/kernel/qsystemsemaphore_win.cpp4
-rw-r--r--src/corelib/kernel/qtimer.h6
-rw-r--r--src/corelib/plugin/plugin.pri4
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp12
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp16
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp21
-rw-r--r--src/corelib/plugin/qmachparser.cpp3
-rw-r--r--src/corelib/plugin/qpluginloader.cpp5
-rw-r--r--src/corelib/plugin/qsystemlibrary.cpp16
-rw-r--r--src/corelib/plugin/qsystemlibrary_p.h4
-rw-r--r--src/corelib/plugin/quuid.cpp33
-rw-r--r--src/corelib/plugin/quuid.h6
-rw-r--r--src/corelib/plugin/quuid_darwin.mm75
-rw-r--r--src/corelib/statemachine/qsignaltransition.h1
-rw-r--r--src/corelib/statemachine/qstate.h1
-rw-r--r--src/corelib/thread/qmutex_win.cpp4
-rw-r--r--src/corelib/thread/qthread_win.cpp44
-rw-r--r--src/corelib/thread/qwaitcondition_win.cpp5
-rw-r--r--src/corelib/tools/qalgorithms.h204
-rw-r--r--src/corelib/tools/qbytearray.cpp85
-rw-r--r--src/corelib/tools/qbytearray.h8
-rw-r--r--src/corelib/tools/qbytearray_mac.mm99
-rw-r--r--src/corelib/tools/qbytearraylist.h2
-rw-r--r--src/corelib/tools/qchar.h12
-rw-r--r--src/corelib/tools/qcommandlineoption.cpp58
-rw-r--r--src/corelib/tools/qcommandlineoption.h16
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp28
-rw-r--r--src/corelib/tools/qcryptographichash.h3
-rw-r--r--src/corelib/tools/qdatetime.cpp889
-rw-r--r--src/corelib/tools/qdatetime.h69
-rw-r--r--src/corelib/tools/qdatetime_mac.mm74
-rw-r--r--src/corelib/tools/qdatetime_p.h70
-rw-r--r--src/corelib/tools/qelapsedtimer_win.cpp49
-rw-r--r--src/corelib/tools/qline.cpp23
-rw-r--r--src/corelib/tools/qline.h14
-rw-r--r--src/corelib/tools/qlist.h5
-rw-r--r--src/corelib/tools/qlocale.cpp1
-rw-r--r--src/corelib/tools/qlocale_mac.mm3
-rw-r--r--src/corelib/tools/qlocale_win.cpp78
-rw-r--r--src/corelib/tools/qpoint.h13
-rw-r--r--src/corelib/tools/qrect.h13
-rw-r--r--src/corelib/tools/qscopedpointer.cpp42
-rw-r--r--src/corelib/tools/qscopedpointer.h45
-rw-r--r--src/corelib/tools/qsharedpointer.cpp112
-rw-r--r--src/corelib/tools/qsharedpointer.h14
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h116
-rw-r--r--src/corelib/tools/qsimd.cpp29
-rw-r--r--src/corelib/tools/qsimd_p.h61
-rw-r--r--src/corelib/tools/qsize.h13
-rw-r--r--src/corelib/tools/qstring.cpp151
-rw-r--r--src/corelib/tools/qstring.h189
-rw-r--r--src/corelib/tools/qstringlist.h2
-rw-r--r--src/corelib/tools/qtimezoneprivate_win.cpp6
-rw-r--r--src/corelib/tools/tools.pri17
-rw-r--r--src/dbus/dbus.pro10
-rw-r--r--src/dbus/qdbusconnection.cpp35
-rw-r--r--src/dbus/qdbusservicewatcher.h1
-rw-r--r--src/gui/image/image.pri10
-rw-r--r--src/gui/image/qgifhandler.pri3
-rw-r--r--src/gui/image/qiconloader.cpp22
-rw-r--r--src/gui/image/qimage.cpp9
-rw-r--r--src/gui/image/qimage_conversions.cpp31
-rw-r--r--src/gui/image/qimage_sse4.cpp2
-rw-r--r--src/gui/image/qimagereader.cpp50
-rw-r--r--src/gui/image/qimagewriter.cpp25
-rw-r--r--src/gui/image/qjpeghandler.pri11
-rw-r--r--src/gui/image/qpixmap.cpp12
-rw-r--r--src/gui/image/qpixmap_blitter.cpp8
-rw-r--r--src/gui/image/qpixmap_raster.cpp4
-rw-r--r--src/gui/image/qpixmap_win.cpp170
-rw-r--r--src/gui/image/qpnghandler.cpp28
-rw-r--r--src/gui/image/qpnghandler.pri4
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp17
-rw-r--r--src/gui/kernel/qclipboard.cpp4
-rw-r--r--src/gui/kernel/qevent.cpp125
-rw-r--r--src/gui/kernel/qevent.h26
-rw-r--r--src/gui/kernel/qevent_p.h5
-rw-r--r--src/gui/kernel/qguiapplication.cpp52
-rw-r--r--src/gui/kernel/qguiapplication.h3
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp9
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h8
-rw-r--r--src/gui/kernel/qopenglcontext.cpp15
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp95
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h69
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp14
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h5
-rw-r--r--src/gui/opengl/qopengl.h19
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp4
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp9
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.cpp20
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.cpp30
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.cpp40
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.cpp50
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.cpp55
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp60
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp65
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp70
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.cpp50
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp80
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.cpp55
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp90
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.cpp60
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp95
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.cpp65
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp100
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.cpp70
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp105
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.cpp75
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp110
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.cpp80
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp115
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.cpp85
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp125
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.cpp90
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp6
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp17
-rw-r--r--src/gui/opengl/qopengltexture.cpp2
-rw-r--r--src/gui/painting/painting.pri4
-rw-r--r--src/gui/painting/qbrush.cpp48
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp100
-rw-r--r--src/gui/painting/qdrawhelper.cpp324
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp4
-rw-r--r--src/gui/painting/qdrawhelper_p.h10
-rw-r--r--src/gui/painting/qdrawhelper_sse4.cpp16
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp18
-rw-r--r--src/gui/painting/qpainter.cpp10
-rw-r--r--src/gui/painting/qpainterpath.cpp7
-rw-r--r--src/gui/painting/qpdf.cpp5
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp9
-rw-r--r--src/gui/painting/qplatformbackingstore.h2
-rw-r--r--src/gui/painting/qregion.cpp160
-rw-r--r--src/gui/painting/qregion.h16
-rw-r--r--src/gui/painting/qrgba64_p.h100
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp28
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h3
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qdistancefield.cpp85
-rw-r--r--src/gui/text/qdistancefield_p.h27
-rw-r--r--src/gui/text/qfontengine.cpp12
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextdocument_p.cpp5
-rw-r--r--src/gui/text/qtextdocument_p.h2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp6
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp5
-rw-r--r--src/gui/text/qtextengine.cpp10
-rw-r--r--src/gui/text/qtextlayout.cpp6
-rw-r--r--src/gui/text/qtextodfwriter.cpp4
-rw-r--r--src/gui/util/qvalidator.cpp15
-rw-r--r--src/network/access/access.pri7
-rw-r--r--src/network/access/http2/bitstreams.cpp336
-rw-r--r--src/network/access/http2/bitstreams_p.h185
-rw-r--r--src/network/access/http2/hpack.cpp551
-rw-r--r--src/network/access/http2/hpack_p.h155
-rw-r--r--src/network/access/http2/hpacktable.cpp533
-rw-r--r--src/network/access/http2/hpacktable_p.h237
-rw-r--r--src/network/access/http2/http2.pri11
-rw-r--r--src/network/access/http2/huffman.cpp573
-rw-r--r--src/network/access/http2/huffman_p.h182
-rw-r--r--src/network/access/qhttpnetworkreply.cpp5
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp40
-rw-r--r--src/network/access/qnetworkaccessmanager.h1
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h7
-rw-r--r--src/network/access/qnetworkdiskcache.cpp2
-rw-r--r--src/network/access/qnetworkfile.cpp (renamed from src/corelib/tools/qstring_mac.mm)65
-rw-r--r--src/network/access/qnetworkfile_p.h (renamed from src/corelib/io/qurl_mac.mm)59
-rw-r--r--src/network/access/qnetworkreplyfileimpl.cpp150
-rw-r--r--src/network/access/qnetworkreplyfileimpl_p.h12
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp15
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp8
-rw-r--r--src/network/kernel/kernel.pri4
-rw-r--r--src/network/kernel/qauthenticator.cpp6
-rw-r--r--src/network/kernel/qhostaddress.cpp120
-rw-r--r--src/network/kernel/qhostaddress.h12
-rw-r--r--src/network/kernel/qhostinfo_win.cpp11
-rw-r--r--src/network/kernel/qnetworkfunctions_wince.h96
-rw-r--r--src/network/kernel/qnetworkinterface_win.cpp8
-rw-r--r--src/network/kernel/qnetworkproxy_mac.cpp97
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp19
-rw-r--r--src/network/socket/qabstractsocket.cpp79
-rw-r--r--src/network/socket/qabstractsocket_p.h4
-rw-r--r--src/network/socket/qnativesocketengine_p.h14
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp46
-rw-r--r--src/network/socket/qsocks5socketengine.cpp4
-rw-r--r--src/network/socket/qtcpserver.cpp5
-rw-r--r--src/network/socket/qudpsocket.cpp3
-rw-r--r--src/network/socket/socket.pri11
-rw-r--r--src/network/ssl/qsslconfiguration.cpp77
-rw-r--r--src/network/ssl/qsslconfiguration.h7
-rw-r--r--src/network/ssl/qsslconfiguration_p.h7
-rw-r--r--src/network/ssl/qsslcontext_openssl.cpp61
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.cpp307
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters.h117
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_dummy.cpp (renamed from src/corelib/global/qconfig-dist.h)31
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_openssl.cpp164
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_p.h (renamed from src/widgets/kernel/qwidgetsfunctions_wince.h)54
-rw-r--r--src/network/ssl/qsslsocket.cpp28
-rw-r--r--src/network/ssl/qsslsocket.h2
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp187
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp73
-rw-r--r--src/network/ssl/qsslsocket_openssl_android.cpp1
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h1
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp30
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h37
-rw-r--r--src/network/ssl/qsslsocket_p.h5
-rw-r--r--src/network/ssl/qsslsocket_winrt.cpp4
-rw-r--r--src/network/ssl/ssl.pri62
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp6
-rw-r--r--src/opengl/qgl.cpp3
-rw-r--r--src/platformsupport/cglconvenience/cglconvenience.mm23
-rw-r--r--src/platformsupport/clipboard/qmacmime.mm7
-rw-r--r--src/platformsupport/eventdispatchers/eventdispatchers.pri4
-rw-r--r--src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp4
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore.cpp7
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore_p.h1
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp10
-rw-r--r--src/platformsupport/fontdatabases/basic/basic.pri2
-rw-r--r--src/platformsupport/fontdatabases/mac/coretext.pri5
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm259
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h9
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm19
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h9
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore.cpp4
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp8
-rw-r--r--src/platformsupport/platformsupport.pro2
-rw-r--r--src/plugins/bearer/bearer.pro2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp38
-rw-r--r--src/plugins/bearer/nla/nla.pro6
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp257
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler_p.h8
-rw-r--r--src/plugins/generic/tuiotouch/qtuiotoken_p.h144
-rw-r--r--src/plugins/generic/tuiotouch/tuiotouch.pro3
-rw-r--r--src/plugins/imageformats/gif/gif.pro7
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp (renamed from src/gui/image/qgifhandler.cpp)0
-rw-r--r--src/plugins/imageformats/gif/qgifhandler_p.h (renamed from src/gui/image/qgifhandler_p.h)0
-rw-r--r--src/plugins/imageformats/ico/ico.pro7
-rw-r--r--src/plugins/imageformats/imageformats.pro4
-rw-r--r--src/plugins/imageformats/jpeg/jpeg.pro16
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp (renamed from src/gui/image/qjpeghandler.cpp)0
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler_p.h (renamed from src/gui/image/qjpeghandler_p.h)0
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp2
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp14
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp18
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h2
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp3
-rw-r--r--src/plugins/platforms/bsdfb/bsdfb.json3
-rw-r--r--src/plugins/platforms/bsdfb/bsdfb.pro15
-rw-r--r--src/plugins/platforms/bsdfb/main.cpp60
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbintegration.cpp142
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbintegration.h81
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbscreen.cpp276
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbscreen.h74
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplication.mm8
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h5
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm7
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm59
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm90
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm24
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm65
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm5
-rw-r--r--src/plugins/platforms/direct2d/direct2d.pro2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp10
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbbackingstore.cpp16
-rw-r--r--src/plugins/platforms/directfb/qdirectfbbackingstore.h2
-rw-r--r--src/plugins/platforms/eglfs/api/api.pri15
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor.cpp (renamed from src/plugins/platforms/eglfs/qeglfscursor.cpp)4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfscursor_p.h (renamed from src/plugins/platforms/eglfs/qeglfscursor.h)0
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp (renamed from src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp)118
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h (renamed from src/plugins/platforms/eglfs/qeglfsdeviceintegration.h)18
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsglobal.h (renamed from src/plugins/platforms/eglfs/qeglfsglobal.h)9
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfshooks.cpp (renamed from src/plugins/platforms/eglfs/qeglfshooks.cpp)16
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfshooks_p.h (renamed from src/plugins/platforms/eglfs/qeglfshooks.h)17
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen.cpp (renamed from src/plugins/platforms/eglfs/qeglfsscreen.cpp)6
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsscreen_p.h (renamed from src/plugins/platforms/eglfs/qeglfsscreen.h)13
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow.cpp (renamed from src/plugins/platforms/eglfs/qeglfswindow.cpp)9
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h (renamed from src/plugins/platforms/eglfs/qeglfswindow.h)13
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp8
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h4
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp8
-rw-r--r--src/plugins/platforms/eglfs/eglfs-plugin.pro2
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro2
-rw-r--r--src/plugins/platforms/eglfs/eglfsdeviceintegration.pro (renamed from src/plugins/platforms/eglfs/eglfs_device_lib.pro)17
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.cpp6
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp26
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp2
-rw-r--r--src/plugins/platforms/ios/ios.pro36
-rw-r--r--src/plugins/platforms/ios/plugin.mm4
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.mm2
-rw-r--r--src/plugins/platforms/ios/qiosfileenginefactory.h4
-rw-r--r--src/plugins/platforms/ios/qiosglobal.h7
-rw-r--r--src/plugins/platforms/ios/qiosglobal.mm22
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm14
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h7
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm10
-rw-r--r--src/plugins/platforms/ios/qiosmenu.mm2
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm19
-rw-r--r--src/plugins/platforms/ios/qiostextinputoverlay.mm22
-rw-r--r--src/plugins/platforms/ios/qiostextresponder.mm12
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm12
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.h4
-rw-r--r--src/plugins/platforms/ios/qiosviewcontroller.mm66
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm2
-rw-r--r--src/plugins/platforms/ios/quiview.mm23
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp6
-rw-r--r--src/plugins/platforms/mirclient/qmirclientbackingstore.cpp4
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp5
-rw-r--r--src/plugins/platforms/platforms.pro10
-rw-r--r--src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp12
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp3
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.cpp5
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp13
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp4
-rw-r--r--src/plugins/platforms/windows/accessible/accessible.pri14
-rw-r--r--src/plugins/platforms/windows/accessible/comutils.cpp24
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp36
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp2
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h2
-rw-r--r--src/plugins/platforms/windows/qplatformfunctions_wince.h371
-rw-r--r--src/plugins/platforms/windows/qtwindows_additional.h179
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h23
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp39
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp208
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h46
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp70
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp340
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp333
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp124
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp49
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.cpp1
-rw-r--r--src/plugins/platforms/windows/qwindowsinternalmimedata.h2
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp34
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp128
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeimage.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeimage.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsole.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp25
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h4
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp82
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp176
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h22
-rw-r--r--src/plugins/platforms/windows/windows.pri40
-rw-r--r--src/plugins/platforms/windows/windows.pro2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp19
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp18
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp5
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro10
-rw-r--r--src/plugins/platformthemes/gtk3/gtk3.pro6
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.cpp489
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.h162
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.cpp11
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.h3
-rw-r--r--src/plugins/sqldrivers/db2/db2.pro11
-rw-r--r--src/plugins/sqldrivers/db2/main.cpp2
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp (renamed from src/sql/drivers/db2/qsql_db2.cpp)0
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2_p.h (renamed from src/sql/drivers/db2/qsql_db2_p.h)0
-rw-r--r--src/plugins/sqldrivers/ibase/ibase.pro13
-rw-r--r--src/plugins/sqldrivers/ibase/main.cpp2
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp (renamed from src/sql/drivers/ibase/qsql_ibase.cpp)0
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase_p.h (renamed from src/sql/drivers/ibase/qsql_ibase_p.h)0
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp2
-rw-r--r--src/plugins/sqldrivers/mysql/mysql.pro19
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp (renamed from src/sql/drivers/mysql/qsql_mysql.cpp)0
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql_p.h (renamed from src/sql/drivers/mysql/qsql_mysql_p.h)0
-rw-r--r--src/plugins/sqldrivers/oci/main.cpp2
-rw-r--r--src/plugins/sqldrivers/oci/oci.pro12
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp (renamed from src/sql/drivers/oci/qsql_oci.cpp)0
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci_p.h (renamed from src/sql/drivers/oci/qsql_oci_p.h)0
-rw-r--r--src/plugins/sqldrivers/odbc/main.cpp2
-rw-r--r--src/plugins/sqldrivers/odbc/odbc.pro15
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp (renamed from src/sql/drivers/odbc/qsql_odbc.cpp)0
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc_p.h (renamed from src/sql/drivers/odbc/qsql_odbc_p.h)0
-rw-r--r--src/plugins/sqldrivers/psql/main.cpp2
-rw-r--r--src/plugins/sqldrivers/psql/psql.pro13
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp (renamed from src/sql/drivers/psql/qsql_psql.cpp)0
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql_p.h (renamed from src/sql/drivers/psql/qsql_psql_p.h)0
-rw-r--r--src/plugins/sqldrivers/sqldrivers.pro18
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp (renamed from src/sql/drivers/sqlite/qsql_sqlite.cpp)81
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h (renamed from src/sql/drivers/sqlite/qsql_sqlite_p.h)6
-rw-r--r--src/plugins/sqldrivers/sqlite/smain.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro12
-rw-r--r--src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp (renamed from src/sql/drivers/sqlite2/qsql_sqlite2.cpp)0
-rw-r--r--src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h (renamed from src/sql/drivers/sqlite2/qsql_sqlite2_p.h)0
-rw-r--r--src/plugins/sqldrivers/sqlite2/smain.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite2/sqlite2.pro7
-rw-r--r--src/plugins/sqldrivers/tds/main.cpp2
-rw-r--r--src/plugins/sqldrivers/tds/qsql_tds.cpp (renamed from src/sql/drivers/tds/qsql_tds.cpp)0
-rw-r--r--src/plugins/sqldrivers/tds/qsql_tds_p.h (renamed from src/sql/drivers/tds/qsql_tds_p.h)0
-rw-r--r--src/plugins/sqldrivers/tds/tds.pro13
-rw-r--r--src/printsupport/kernel/qprint_p.h4
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp4
-rw-r--r--src/sql/drivers/db2/qsql_db2.pri8
-rw-r--r--src/sql/drivers/drivers.pri11
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.pri10
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.pri16
-rw-r--r--src/sql/drivers/oci/qsql_oci.pri9
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.pri12
-rw-r--r--src/sql/drivers/psql/qsql_psql.pri10
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.pri9
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.pri4
-rw-r--r--src/sql/drivers/tds/qsql_tds.pri10
-rw-r--r--src/sql/kernel/qsqldatabase.cpp117
-rw-r--r--src/sql/sql.pro1
-rw-r--r--src/src.pro8
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp9
-rw-r--r--src/testlib/qabstracttestlogger.cpp2
-rw-r--r--src/testlib/qbenchmarkmetric.cpp5
-rw-r--r--src/testlib/qbenchmarkmetric.h3
-rw-r--r--src/testlib/qbenchmarkperfevents.cpp9
-rw-r--r--src/testlib/qplaintestlogger.cpp15
-rw-r--r--src/testlib/qtest.h5
-rw-r--r--src/testlib/qtestblacklist.cpp6
-rw-r--r--src/testlib/qtestcase.cpp87
-rw-r--r--src/testlib/qtestcase.h31
-rw-r--r--src/testlib/qtestcase.qdoc22
-rw-r--r--src/testlib/qtesttouch.h1
-rw-r--r--src/testlib/qxctestlogger.mm2
-rw-r--r--src/testlib/qxunittestlogger.cpp2
-rw-r--r--src/testlib/testlib.pro7
-rw-r--r--src/tools/bootstrap/bootstrap.pro6
-rw-r--r--src/tools/moc/main.cpp10
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.cpp40
-rw-r--r--src/widgets/accessible/complexwidgets.cpp24
-rw-r--r--src/widgets/accessible/itemviews.cpp4
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp16
-rw-r--r--src/widgets/dialogs/qdialog.cpp25
-rw-r--r--src/widgets/dialogs/qdialog.h7
-rw-r--r--src/widgets/dialogs/qdialog_p.h4
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp28
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp14
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h4
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp13
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h2
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp10
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp74
-rw-r--r--src/widgets/dialogs/qmessagebox.h4
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp19
-rw-r--r--src/widgets/dialogs/qwizard.cpp8
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp252
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h2
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp13
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp7
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp15
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp4
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp20
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.cpp3
-rw-r--r--src/widgets/itemviews/qtreeview.cpp9
-rw-r--r--src/widgets/kernel/qaction.cpp17
-rw-r--r--src/widgets/kernel/qapplication.cpp56
-rw-r--r--src/widgets/kernel/qapplication.h13
-rw-r--r--src/widgets/kernel/qapplication_p.h9
-rw-r--r--src/widgets/kernel/qformlayout.cpp323
-rw-r--r--src/widgets/kernel/qformlayout.h15
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp2
-rw-r--r--src/widgets/kernel/qgridlayout.cpp10
-rw-r--r--src/widgets/kernel/qlayout.cpp5
-rw-r--r--src/widgets/kernel/qshortcut.cpp3
-rw-r--r--src/widgets/kernel/qwidget.cpp27
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp29
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h3
-rw-r--r--src/widgets/kernel/qwidgetsfunctions_wince.cpp120
-rw-r--r--src/widgets/kernel/win.pri6
-rw-r--r--src/widgets/styles/qcommonstyle.cpp27
-rw-r--r--src/widgets/styles/qfusionstyle.cpp18
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm27
-rw-r--r--src/widgets/styles/qproxystyle.cpp11
-rw-r--r--src/widgets/styles/qstyle.cpp5
-rw-r--r--src/widgets/styles/qstyle.h3
-rw-r--r--src/widgets/styles/qstyle_wince.qrc97
-rw-r--r--src/widgets/styles/qstylefactory.cpp24
-rw-r--r--src/widgets/styles/qwindowscestyle.cpp2429
-rw-r--r--src/widgets/styles/qwindowscestyle_p.h108
-rw-r--r--src/widgets/styles/qwindowscestyle_p_p.h116
-rw-r--r--src/widgets/styles/qwindowsmobilestyle.cpp7272
-rw-r--r--src/widgets/styles/qwindowsmobilestyle_p.h121
-rw-r--r--src/widgets/styles/qwindowsmobilestyle_p_p.h133
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp50
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp62
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp298
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h163
-rw-r--r--src/widgets/styles/styles.pri22
-rw-r--r--src/widgets/util/qcompleter.cpp12
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp24
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp10
-rw-r--r--src/widgets/util/qsystemtrayicon_wince.cpp301
-rw-r--r--src/widgets/util/qundostack.cpp4
-rw-r--r--src/widgets/util/util.pri2
-rw-r--r--src/widgets/widgets.pro1
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp8
-rw-r--r--src/widgets/widgets/qcheckbox.cpp4
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp9
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp10
-rw-r--r--src/widgets/widgets/qdockwidget.cpp6
-rw-r--r--src/widgets/widgets/qeffects.cpp12
-rw-r--r--src/widgets/widgets/qgroupbox.cpp4
-rw-r--r--src/widgets/widgets/qkeysequenceedit.cpp12
-rw-r--r--src/widgets/widgets/qlabel.cpp4
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp5
-rw-r--r--src/widgets/widgets/qlineedit.cpp14
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm5
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm5
-rw-r--r--src/widgets/widgets/qmdiarea.cpp5
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp12
-rw-r--r--src/widgets/widgets/qmenu.cpp14
-rw-r--r--src/widgets/widgets/qmenu.h16
-rw-r--r--src/widgets/widgets/qmenu_mac.mm5
-rw-r--r--src/widgets/widgets/qmenu_p.h42
-rw-r--r--src/widgets/widgets/qmenu_wince.cpp666
-rw-r--r--src/widgets/widgets/qmenu_wince.rc231
-rw-r--r--src/widgets/widgets/qmenu_wince_resource_p.h89
-rw-r--r--src/widgets/widgets/qmenubar.cpp85
-rw-r--r--src/widgets/widgets/qmenubar.h11
-rw-r--r--src/widgets/widgets/qmenubar_p.h53
-rw-r--r--src/widgets/widgets/qpushbutton.cpp8
-rw-r--r--src/widgets/widgets/qradiobutton.cpp4
-rw-r--r--src/widgets/widgets/qscrollbar.cpp10
-rw-r--r--src/widgets/widgets/qslider.cpp4
-rw-r--r--src/widgets/widgets/qsplitter.cpp5
-rw-r--r--src/widgets/widgets/qstatusbar.cpp3
-rw-r--r--src/widgets/widgets/qtabbar.cpp28
-rw-r--r--src/widgets/widgets/qtabbar.h5
-rw-r--r--src/widgets/widgets/qtabbar_p.h3
-rw-r--r--src/widgets/widgets/qtoolbar.cpp15
-rw-r--r--src/widgets/widgets/qtoolbar.h6
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--src/widgets/widgets/widgets.pri16
-rw-r--r--src/winmain/qtmain_win.cpp59
-rw-r--r--src/winmain/winmain.pro4
696 files changed, 12955 insertions, 24653 deletions
diff --git a/src/3rdparty/double-conversion/include/double-conversion/utils.h b/src/3rdparty/double-conversion/include/double-conversion/utils.h
index a89b284eda..20bfd36c84 100644
--- a/src/3rdparty/double-conversion/include/double-conversion/utils.h
+++ b/src/3rdparty/double-conversion/include/double-conversion/utils.h
@@ -74,8 +74,6 @@
#else
#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#endif // _WIN32
-#elif defined(WINCE) || defined(_WIN32_WCE)
-#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__ghs)
// Green Hills toolchain uses a 64bit wide floating point stack
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
diff --git a/src/3rdparty/freetype_dependency.pri b/src/3rdparty/freetype_dependency.pri
index 39280deb2f..7513e40bfd 100644
--- a/src/3rdparty/freetype_dependency.pri
+++ b/src/3rdparty/freetype_dependency.pri
@@ -1,7 +1,7 @@
-contains(QT_CONFIG, freetype) {
- INCLUDEPATH += $$PWD/freetype/include
- LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
-} else:contains(QT_CONFIG, system-freetype) {
+contains(QT_CONFIG, system-freetype) {
# pull in the proper freetype2 include directory
include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri)
+} else: contains(QT_CONFIG, freetype) {
+ INCLUDEPATH += $$PWD/freetype/include
+ LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtfreetype$$qtPlatformTargetSuffix()
}
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
index 163842e8fc..99c32ea672 100644
--- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
+++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
@@ -143,8 +143,8 @@ contains(SHAPERS, coretext) {
HEADERS += \
$$PWD/src/hb-coretext.h
- ios: \
- # On iOS CoreText and CoreGraphics are stand-alone frameworks
+ uikit: \
+ # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/3rdparty/harfbuzz_dependency.pri b/src/3rdparty/harfbuzz_dependency.pri
index 74433688f6..36abbfbe35 100644
--- a/src/3rdparty/harfbuzz_dependency.pri
+++ b/src/3rdparty/harfbuzz_dependency.pri
@@ -1,6 +1,6 @@
-contains(QT_CONFIG, harfbuzz) {
+contains(QT_CONFIG, system-harfbuzz) {
+ LIBS_PRIVATE += -lharfbuzz
+} else: contains(QT_CONFIG, harfbuzz) {
INCLUDEPATH += $$PWD/harfbuzz-ng/include
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtharfbuzzng$$qtPlatformTargetSuffix()
-} else:contains(QT_CONFIG, system-harfbuzz) {
- LIBS_PRIVATE += -lharfbuzz
}
diff --git a/src/3rdparty/pcre/pcre.pro b/src/3rdparty/pcre/pcre.pro
index 53405e0e46..fad82b80b1 100644
--- a/src/3rdparty/pcre/pcre.pro
+++ b/src/3rdparty/pcre/pcre.pro
@@ -11,7 +11,7 @@ DEFINES += HAVE_CONFIG_H
# platform/compiler specific definitions
win32: DEFINES += PCRE_STATIC
-ios|qnx|winrt: DEFINES += PCRE_DISABLE_JIT
+uikit|qnx|winrt: DEFINES += PCRE_DISABLE_JIT
SOURCES += \
$$PWD/pcre16_byte_order.c \
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri
index ec617386a4..0f7c2b887b 100644
--- a/src/corelib/arch/arch.pri
+++ b/src/corelib/arch/arch.pri
@@ -1,4 +1,4 @@
-win32|wince:HEADERS += arch/qatomic_msvc.h
+win32:HEADERS += arch/qatomic_msvc.h
HEADERS += \
arch/qatomic_bootstrap.h \
diff --git a/src/corelib/arch/qatomic_msvc.h b/src/corelib/arch/qatomic_msvc.h
index 62d54ded55..5eae2bdc48 100644
--- a/src/corelib/arch/qatomic_msvc.h
+++ b/src/corelib/arch/qatomic_msvc.h
@@ -45,8 +45,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-#ifndef Q_OS_WINCE
-
// use compiler intrinsics for all atomic functions
# define QT_INTERLOCKED_PREFIX _
# define QT_INTERLOCKED_PROTOTYPE
@@ -58,36 +56,6 @@
# define Q_ATOMIC_INT64_IS_SUPPORTED
# endif
-#else // Q_OS_WINCE
-
-# if _WIN32_WCE < 0x600 && defined(_X86_)
-// For X86 Windows CE, include winbase.h to catch inline functions which
-// override the regular definitions inside of coredll.dll.
-// Though one could use the original version of Increment/Decrement, others are
-// not exported at all.
-# include <winbase.h>
-
-// It's safer to remove the volatile and let the compiler add it as needed.
-# define QT_INTERLOCKED_VOLATILE
-
-# else // _WIN32_WCE >= 0x600 || !_X86_
-
-# define QT_INTERLOCKED_PROTOTYPE __cdecl
-# define QT_INTERLOCKED_DECLARE_PROTOTYPES
-
-# if _WIN32_WCE >= 0x600
-# if defined(_X86_)
-# define QT_INTERLOCKED_PREFIX _
-# define QT_INTERLOCKED_INTRINSIC
-# endif
-# else
-# define QT_INTERLOCKED_VOLATILE
-# endif
-
-# endif // _WIN32_WCE >= 0x600 || !_X86_
-
-#endif // Q_OS_WINCE
-
////////////////////////////////////////////////////////////////////////////////////////////////////
// Prototype declaration
@@ -128,7 +96,7 @@ extern "C" {
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long);
long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
-# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+# if !defined(__i386__) && !defined(_M_IX86)
void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
__int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
@@ -165,7 +133,7 @@ extern "C" {
# pragma intrinsic (_InterlockedCompareExchange)
# pragma intrinsic (_InterlockedExchangeAdd)
-# if !defined(Q_OS_WINCE) && !defined(_M_IX86)
+# if !defined(_M_IX86)
# pragma intrinsic (_InterlockedCompareExchangePointer)
# pragma intrinsic (_InterlockedExchangePointer)
# pragma intrinsic (_InterlockedExchangeAdd64)
@@ -176,7 +144,7 @@ extern "C" {
////////////////////////////////////////////////////////////////////////////////////////////////////
// Interlocked* replacement macros
-#if defined(Q_OS_WINCE) || defined(__i386__) || defined(_M_IX86)
+#if defined(__i386__) || defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
reinterpret_cast<void *>( \
@@ -195,7 +163,7 @@ extern "C" {
reinterpret_cast<long QT_INTERLOCKED_VOLATILE *>(value), \
(valueToAdd))
-#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+#else // !defined(__i386__) && !defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
QT_INTERLOCKED_FUNCTION(CompareExchangePointer)( \
@@ -213,7 +181,7 @@ extern "C" {
reinterpret_cast<qint64 QT_INTERLOCKED_VOLATILE *>(value), \
(valueToAdd))
-#endif // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
+#endif // !defined(__i386__) && !defined(_M_IX86)
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index bfb677e6fb..fdaec33c5a 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -40,20 +40,17 @@ contains(QT_CONFIG,icu) {
codecs/qeuckrcodec.cpp \
codecs/qbig5codec.cpp
- unix:!qnx:!mac:!ios:!linux-android-* {
- contains(QT_CONFIG,iconv) {
- HEADERS += codecs/qiconvcodec_p.h
- SOURCES += codecs/qiconvcodec.cpp
- } else:contains(QT_CONFIG,gnu-libiconv) {
- HEADERS += codecs/qiconvcodec_p.h
- SOURCES += codecs/qiconvcodec.cpp
- DEFINES += GNU_LIBICONV
- LIBS_PRIVATE *= -liconv
- } else:contains(QT_CONFIG,sun-libiconv) {
- HEADERS += codecs/qiconvcodec_p.h
- SOURCES += codecs/qiconvcodec.cpp
- DEFINES += GNU_LIBICONV
+ unix:!qnx:!darwin:!linux-android-* {
+ contains(QT_CONFIG, iconv) {
+ HEADERS += codecs/qiconvcodec_p.h
+ SOURCES += codecs/qiconvcodec.cpp
+ contains(QT_CONFIG, gnu-libiconv) {
+ DEFINES += GNU_LIBICONV
+ LIBS_PRIVATE *= -liconv
+ } else: contains(QT_CONFIG, sun-libiconv) {
+ DEFINES += GNU_LIBICONV
}
+ }
} else:!win32-msvc* {
DEFINES += QT_NO_ICONV
}
diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp
index aa2095d9da..ee9f1d0048 100644
--- a/src/corelib/codecs/qicucodec.cpp
+++ b/src/corelib/codecs/qicucodec.cpp
@@ -527,7 +527,7 @@ QTextCodec *QIcuCodec::codecForNameUnlocked(const char *name)
// check whether there is really a converter for the name available.
UConverter *conv = ucnv_open(standardName, &error);
if (!conv) {
- qDebug() << "codecForName: ucnv_open failed" << standardName << u_errorName(error);
+ qDebug("codecForName: ucnv_open failed %s %s", standardName, u_errorName(error));
return 0;
}
//qDebug() << "QIcuCodec: Standard name for " << name << "is" << standardName;
@@ -577,7 +577,7 @@ UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const
ucnv_setSubstChars(static_cast<UConverter *>(state->d),
state->flags & QTextCodec::ConvertInvalidToNull ? "\0" : "?", 1, &error);
if (U_FAILURE(error))
- qDebug() << "getConverter(state) ucnv_open failed" << m_name << u_errorName(error);
+ qDebug("getConverter(state) ucnv_open failed %s %s", m_name, u_errorName(error));
}
conv = static_cast<UConverter *>(state->d);
}
@@ -587,7 +587,7 @@ UConverter *QIcuCodec::getConverter(QTextCodec::ConverterState *state) const
conv = ucnv_open(m_name, &error);
ucnv_setSubstChars(conv, "?", 1, &error);
if (U_FAILURE(error))
- qDebug() << "getConverter(no state) ucnv_open failed" << m_name << u_errorName(error);
+ qDebug("getConverter(no state) ucnv_open failed %s %s", m_name, u_errorName(error));
}
return conv;
}
@@ -610,7 +610,7 @@ QString QIcuCodec::convertToUnicode(const char *chars, int length, QTextCodec::C
&chars, end,
0, false, &error);
if (!U_SUCCESS(error) && error != U_BUFFER_OVERFLOW_ERROR) {
- qDebug() << "convertToUnicode failed:" << u_errorName(error);
+ qDebug("convertToUnicode failed: %s", u_errorName(error));
break;
}
@@ -647,7 +647,7 @@ QByteArray QIcuCodec::convertFromUnicode(const QChar *unicode, int length, QText
&uc, end,
0, false, &error);
if (!U_SUCCESS(error))
- qDebug() << "convertFromUnicode failed:" << u_errorName(error);
+ qDebug("convertFromUnicode failed: %s", u_errorName(error));
convertedChars = ch - string.data();
if (uc >= end)
break;
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index edb03af447..5098ac4242 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -132,7 +132,7 @@ bool qTextCodecNameMatch(const char *n, const char *h)
}
-#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined(QT_LOCALE_IS_UTF8)
+#if !defined(Q_OS_WIN32) && !defined(QT_LOCALE_IS_UTF8)
static QTextCodec *checkForCodec(const QByteArray &name) {
QTextCodec *c = QTextCodec::codecForName(name);
if (!c) {
@@ -169,7 +169,7 @@ static QTextCodec *setupLocaleMapper()
#if defined(QT_LOCALE_IS_UTF8)
locale = QTextCodec::codecForName("UTF-8");
-#elif defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#elif defined(Q_OS_WIN)
locale = QTextCodec::codecForName("System");
#else
@@ -289,7 +289,7 @@ static void setup()
#if !defined(QT_NO_ICONV)
(void) new QIconvCodec;
#endif
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN32)
(void) new QWindowsLocalCodec;
#endif // Q_OS_WIN32
#endif // !QT_NO_CODECS && !QT_BOOTSTRAPPED
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index f1054ceb98..74a716db4a 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -52,6 +52,19 @@ enum { Endian = 0, Data = 1 };
static const uchar utf8bom[] = { 0xef, 0xbb, 0xbf };
+#if (defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)) \
+ || (defined(__ARM_NEON__) && defined(Q_PROCESSOR_ARM_64))
+static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) Q_DECL_NOTHROW
+{
+ uint result = qCountLeadingZeroBits(v);
+ // Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
+ // and the lsb index is 0. The result for _bit_scan_reverse is expected to be the index when
+ // counting up: msb index is 0 (because it starts there), and the lsb index is 31.
+ result ^= sizeof(unsigned) * 8 - 1;
+ return result;
+}
+#endif
+
#if defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)
static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const ushort *&src, const ushort *end)
{
@@ -81,9 +94,9 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
// find the next probable ASCII character
// we don't want to load 32 bytes again in this loop if we know there are non-ASCII
// characters still coming
- nextAscii = src + _bit_scan_reverse(n) + 1;
+ nextAscii = src + qBitScanReverse(n) + 1;
- n = _bit_scan_forward(n);
+ n = qCountTrailingZeroBits(n);
dst += n;
src += n;
return false;
@@ -132,13 +145,81 @@ static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const
// find the next probable ASCII character
// we don't want to load 16 bytes again in this loop if we know there are non-ASCII
// characters still coming
- n = _bit_scan_reverse(n);
+ n = qBitScanReverse(n);
nextAscii = src + (n / BitSpacing) + 1;
return false;
}
return src == end;
}
+#elif defined(__ARM_NEON__) && defined(Q_PROCESSOR_ARM_64) // vaddv is only available on Aarch64
+static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const ushort *&src, const ushort *end)
+{
+ uint16x8_t maxAscii = vdupq_n_u16(0x7f);
+ uint16x8_t mask1 = { 1, 1 << 2, 1 << 4, 1 << 6, 1 << 8, 1 << 10, 1 << 12, 1 << 14 };
+ uint16x8_t mask2 = vshlq_n_u16(mask1, 1);
+
+ // do sixteen characters at a time
+ for ( ; end - src >= 16; src += 16, dst += 16) {
+ // load 2 lanes (or: "load interleaved")
+ uint16x8x2_t in = vld2q_u16(src);
+
+ // check if any of the elements > 0x7f, select 1 bit per element (element 0 -> bit 0, element 1 -> bit 1, etc),
+ // add those together into a scalar, and merge the scalars.
+ uint16_t nonAscii = vaddvq_u16(vandq_u16(vcgtq_u16(in.val[0], maxAscii), mask1))
+ | vaddvq_u16(vandq_u16(vcgtq_u16(in.val[1], maxAscii), mask2));
+
+ // merge the two lanes by shifting the values of the second by 8 and inserting them
+ uint16x8_t out = vsliq_n_u16(in.val[0], in.val[1], 8);
+
+ // store, even if there are non-ASCII characters here
+ vst1q_u8(dst, vreinterpretq_u8_u16(out));
+
+ if (nonAscii) {
+ // find the next probable ASCII character
+ // we don't want to load 32 bytes again in this loop if we know there are non-ASCII
+ // characters still coming
+ nextAscii = src + qBitScanReverse(nonAscii) + 1;
+
+ nonAscii = qCountTrailingZeroBits(nonAscii);
+ dst += nonAscii;
+ src += nonAscii;
+ return false;
+ }
+ }
+ return src == end;
+}
+
+static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const uchar *&src, const uchar *end)
+{
+ // do eight characters at a time
+ uint8x8_t msb_mask = vdup_n_u8(0x80);
+ uint8x8_t add_mask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 };
+ for ( ; end - src >= 8; src += 8, dst += 8) {
+ uint8x8_t c = vld1_u8(src);
+ uint8_t n = vaddv_u8(vand_u8(vcge_u8(c, msb_mask), add_mask));
+ if (!n) {
+ // store
+ vst1q_u16(dst, vmovl_u8(c));
+ continue;
+ }
+
+ // copy the front part that is still ASCII
+ while (!(n & 1)) {
+ *dst++ = *src++;
+ n >>= 1;
+ }
+
+ // find the next probable ASCII character
+ // we don't want to load 16 bytes again in this loop if we know there are non-ASCII
+ // characters still coming
+ n = qBitScanReverse(n);
+ nextAscii = src + n + 1;
+ return false;
+
+ }
+ return src == end;
+}
#else
static inline bool simdEncodeAscii(uchar *, const ushort *, const ushort *, const ushort *)
{
diff --git a/src/corelib/codecs/qwindowscodec.cpp b/src/corelib/codecs/qwindowscodec.cpp
index b802ab7249..813d3c8153 100644
--- a/src/corelib/codecs/qwindowscodec.cpp
+++ b/src/corelib/codecs/qwindowscodec.cpp
@@ -157,7 +157,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le
state->remainingChars = 0;
}
const char *mb = mbcs;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
const char *next = 0;
QString s;
while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) {
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 42fd5d1a61..ccf9aaa612 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -47,11 +47,19 @@ include(statemachine/statemachine.pri)
include(mimetypes/mimetypes.pri)
include(xml/xml.pri)
-# otherwise mingw headers do not declare common functions like putenv
-mingw: CONFIG -= strict_c++
+win32 {
+ mingw {
+ # otherwise mingw headers do not declare common functions like putenv
+ CONFIG -= strict_c++
+ # Override MinGW's definition in _mingw.h
+ DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
+ }
+
+ !winrt: LIBS_PRIVATE += -lwinmm
+}
-mac|darwin {
- !ios {
+darwin {
+ osx {
LIBS_PRIVATE += -framework ApplicationServices
LIBS_PRIVATE += -framework CoreServices
}
diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
index a022187c21..ae969ca269 100644
--- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp
@@ -131,26 +131,46 @@ absoluteValue = qAbs(myValue);
//! [10]
-//! [11]
-qreal valueA = 2.3;
-qreal valueB = 2.7;
+//! [11A]
+double valueA = 2.3;
+double valueB = 2.7;
int roundedValueA = qRound(valueA);
// roundedValueA = 2
int roundedValueB = qRound(valueB);
// roundedValueB = 3
-//! [11]
+//! [11A]
+//! [11B]
+float valueA = 2.3;
+float valueB = 2.7;
-//! [12]
-qreal valueA = 42949672960.3;
-qreal valueB = 42949672960.7;
+int roundedValueA = qRound(valueA);
+// roundedValueA = 2
+int roundedValueB = qRound(valueB);
+// roundedValueB = 3
+//! [11B]
+
+
+//! [12A]
+double valueA = 42949672960.3;
+double valueB = 42949672960.7;
+
+qint64 roundedValueA = qRound64(valueA);
+// roundedValueA = 42949672960
+qint64 roundedValueB = qRound64(valueB);
+// roundedValueB = 42949672961
+//! [12A]
+
+//! [12B]
+float valueA = 42949672960.3;
+float valueB = 42949672960.7;
qint64 roundedValueA = qRound64(valueA);
// roundedValueA = 42949672960
qint64 roundedValueB = qRound64(valueB);
// roundedValueB = 42949672961
-//! [12]
+//! [12B]
//! [13]
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 669ab136ac..c5424be035 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -650,14 +650,6 @@
/* General C++ features */
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_THREADSAFE_STATICS
-# if !__has_feature(cxx_exceptions)
-# ifndef QT_NO_EXCEPTIONS
-# define QT_NO_EXCEPTIONS
-# endif
-# endif
-# if !__has_feature(cxx_rtti)
-# define QT_NO_RTTI
-# endif
# if __has_feature(attribute_deprecated_with_message)
# define Q_DECL_DEPRECATED_X(text) __attribute__ ((__deprecated__(text)))
# endif
@@ -1073,16 +1065,18 @@
# define Q_COMPILER_DEFAULT_DELETE_MEMBERS
#endif
-#if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
-# define Q_DECL_CONSTEXPR constexpr
-# define Q_DECL_RELAXED_CONSTEXPR constexpr
-# define Q_CONSTEXPR constexpr
-# define Q_RELAXED_CONSTEXPR constexpr
-#elif defined Q_COMPILER_CONSTEXPR
-# define Q_DECL_CONSTEXPR constexpr
-# define Q_DECL_RELAXED_CONSTEXPR
-# define Q_CONSTEXPR constexpr
-# define Q_RELAXED_CONSTEXPR const
+#if defined Q_COMPILER_CONSTEXPR
+# if defined(__cpp_constexpr) && __cpp_constexpr-0 >= 201304
+# define Q_DECL_CONSTEXPR constexpr
+# define Q_DECL_RELAXED_CONSTEXPR constexpr
+# define Q_CONSTEXPR constexpr
+# define Q_RELAXED_CONSTEXPR constexpr
+# else
+# define Q_DECL_CONSTEXPR constexpr
+# define Q_DECL_RELAXED_CONSTEXPR
+# define Q_CONSTEXPR constexpr
+# define Q_RELAXED_CONSTEXPR const
+# endif
#else
# define Q_DECL_CONSTEXPR
# define Q_DECL_RELAXED_CONSTEXPR
diff --git a/src/corelib/global/qconfig-large.h b/src/corelib/global/qconfig-large.h
deleted file mode 100644
index 270858e65b..0000000000
--- a/src/corelib/global/qconfig-large.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/* Dialogs */
-#ifndef QT_NO_FILEDIALOG
-# define QT_NO_FILEDIALOG
-#endif
-#ifndef QT_NO_FONTDIALOG
-# define QT_NO_FONTDIALOG
-#endif
-#ifndef QT_NO_INPUTDIALOG
-# define QT_NO_INPUTDIALOG
-#endif
-#ifndef QT_NO_PRINTDIALOG
-# define QT_NO_PRINTDIALOG
-#endif
-#ifndef QT_NO_PROGRESSDIALOG
-# define QT_NO_PROGRESSDIALOG
-#endif
-
-/* Images */
-#ifndef QT_NO_IMAGEFORMAT_BMP
-# define QT_NO_IMAGEFORMAT_BMP
-#endif
-#ifndef QT_NO_IMAGEFORMAT_PPM
-# define QT_NO_IMAGEFORMAT_PPM
-#endif
-
-/* Internationalization */
-#ifndef QT_NO_CODECS
-# define QT_NO_CODECS
-#endif
-#ifndef QT_NO_TRANSLATION
-# define QT_NO_TRANSLATION
-#endif
-
-/* ItemViews */
-#ifndef QT_NO_TABLEVIEW
-# define QT_NO_TABLEVIEW
-#endif
-#ifndef QT_NO_TREEVIEW
-# define QT_NO_TREEVIEW
-#endif
-
-/* Kernel */
-#ifndef QT_NO_CLIPBOARD
-# define QT_NO_CLIPBOARD
-#endif
-#ifndef QT_NO_DRAGANDDROP
-# define QT_NO_DRAGANDDROP
-#endif
-#ifndef QT_NO_EFFECTS
-# define QT_NO_EFFECTS
-#endif
-#ifndef QT_NO_PROPERTIES
-# define QT_NO_PROPERTIES
-#endif
-
-/* Networking */
-#ifndef QT_NO_HTTP
-# define QT_NO_HTTP
-#endif
-#ifndef QT_NO_UDPSOCKET
-# define QT_NO_UDPSOCKET
-#endif
-#ifndef QT_NO_FTP
-# define QT_NO_FTP
-#endif
-
-/* Painting */
-#ifndef QT_NO_COLORNAMES
-# define QT_NO_COLORNAMES
-#endif
-#ifndef QT_NO_PICTURE
-# define QT_NO_PICTURE
-#endif
-#ifndef QT_NO_PRINTER
-# define QT_NO_PRINTER
-#endif
-#ifndef QT_NO_CUPS
-# define QT_NO_CUPS
-#endif
-
-/* Styles */
-#ifndef QT_NO_STYLE_STYLESHEET
-# define QT_NO_STYLE_STYLESHEET
-#endif
-
-/* Widgets */
-#ifndef QT_NO_CALENDARWIDGET
-# define QT_NO_CALENDARWIDGET
-#endif
-#ifndef QT_NO_DATETIMEEDIT
-# define QT_NO_DATETIMEEDIT
-#endif
-#ifndef QT_NO_DIAL
-# define QT_NO_DIAL
-#endif
-#ifndef QT_NO_TABLEWIDGET
-# define QT_NO_TABLEWIDGET
-#endif
-#ifndef QT_NO_TREEWIDGET
-# define QT_NO_TREEWIDGET
-#endif
diff --git a/src/corelib/global/qconfig-medium.h b/src/corelib/global/qconfig-medium.h
deleted file mode 100644
index 830e936924..0000000000
--- a/src/corelib/global/qconfig-medium.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/* Dialogs */
-#ifndef QT_NO_COLORDIALOG
-# define QT_NO_COLORDIALOG
-#endif
-#ifndef QT_NO_FILEDIALOG
-# define QT_NO_FILEDIALOG
-#endif
-#ifndef QT_NO_FONTDIALOG
-# define QT_NO_FONTDIALOG
-#endif
-#ifndef QT_NO_INPUTDIALOG
-# define QT_NO_INPUTDIALOG
-#endif
-#ifndef QT_NO_PRINTDIALOG
-# define QT_NO_PRINTDIALOG
-#endif
-#ifndef QT_NO_PROGRESSDIALOG
-# define QT_NO_PROGRESSDIALOG
-#endif
-
-/* Images */
-#ifndef QT_NO_IMAGEFORMAT_BMP
-# define QT_NO_IMAGEFORMAT_BMP
-#endif
-#ifndef QT_NO_IMAGEFORMAT_PPM
-# define QT_NO_IMAGEFORMAT_PPM
-#endif
-#ifndef QT_NO_MOVIE
-# define QT_NO_MOVIE
-#endif
-
-/* Internationalization */
-#ifndef QT_NO_BIG_CODECS
-# define QT_NO_BIG_CODECS
-#endif
-#ifndef QT_NO_TEXTCODEC
-# define QT_NO_TEXTCODEC
-#endif
-#ifndef QT_NO_CODECS
-# define QT_NO_CODECS
-#endif
-#ifndef QT_NO_TRANSLATION
-# define QT_NO_TRANSLATION
-#endif
-
-/* ItemViews */
-#ifndef QT_NO_TABLEVIEW
-# define QT_NO_TABLEVIEW
-#endif
-#ifndef QT_NO_TREEVIEW
-# define QT_NO_TREEVIEW
-#endif
-
-/* Kernel */
-#ifndef QT_NO_ACTION
-# define QT_NO_ACTION
-#endif
-#ifndef QT_NO_CLIPBOARD
-# define QT_NO_CLIPBOARD
-#endif
-#ifndef QT_NO_DRAGANDDROP
-# define QT_NO_DRAGANDDROP
-#endif
-#ifndef QT_NO_EFFECTS
-# define QT_NO_EFFECTS
-#endif
-#ifndef QT_NO_PROPERTIES
-# define QT_NO_PROPERTIES
-#endif
-#ifndef QT_NO_SESSIONMANAGER
-# define QT_NO_SESSIONMANAGER
-#endif
-#ifndef QT_NO_SHORTCUT
-# define QT_NO_SHORTCUT
-#endif
-#ifndef QT_NO_WHEELEVENT
-# define QT_NO_WHEELEVENT
-#endif
-
-/* Networking */
-#ifndef QT_NO_HTTP
-# define QT_NO_HTTP
-#endif
-#ifndef QT_NO_NETWORKPROXY
-# define QT_NO_NETWORKPROXY
-#endif
-#ifndef QT_NO_SOCKS5
-# define QT_NO_SOCKS5
-#endif
-#ifndef QT_NO_UDPSOCKET
-# define QT_NO_UDPSOCKET
-#endif
-#ifndef QT_NO_FTP
-# define QT_NO_FTP
-#endif
-
-/* Painting */
-#ifndef QT_NO_COLORNAMES
-# define QT_NO_COLORNAMES
-#endif
-#ifndef QT_NO_PICTURE
-# define QT_NO_PICTURE
-#endif
-#ifndef QT_NO_PRINTER
-# define QT_NO_PRINTER
-#endif
-#ifndef QT_NO_CUPS
-# define QT_NO_CUPS
-#endif
-
-/* Styles */
-#ifndef QT_NO_STYLE_STYLESHEET
-# define QT_NO_STYLE_STYLESHEET
-#endif
-
-/* Utilities */
-#ifndef QT_NO_UNDOCOMMAND
-# define QT_NO_UNDOCOMMAND
-#endif
-#ifndef QT_NO_UNDOGROUP
-# define QT_NO_UNDOGROUP
-#endif
-#ifndef QT_NO_UNDOSTACK
-# define QT_NO_UNDOSTACK
-#endif
-#ifndef QT_NO_UNDOVIEW
-# define QT_NO_UNDOVIEW
-#endif
-#ifndef QT_NO_GESTURES
-# define QT_NO_GESTURES
-#endif
-
-/* Widgets */
-#ifndef QT_NO_LCDNUMBER
-# define QT_NO_LCDNUMBER
-#endif
-#ifndef QT_NO_CALENDARWIDGET
-# define QT_NO_CALENDARWIDGET
-#endif
-#ifndef QT_NO_DATETIMEEDIT
-# define QT_NO_DATETIMEEDIT
-#endif
-#ifndef QT_NO_MENU
-# define QT_NO_MENU
-#endif
-#ifndef QT_NO_CONTEXTMENU
-# define QT_NO_CONTEXTMENU
-#endif
-#ifndef QT_NO_MAINWINDOW
-# define QT_NO_MAINWINDOW
-#endif
-#ifndef QT_NO_DOCKWIDGET
-# define QT_NO_DOCKWIDGET
-#endif
-#ifndef QT_NO_TOOLBAR
-# define QT_NO_TOOLBAR
-#endif
-#ifndef QT_NO_MENUBAR
-# define QT_NO_MENUBAR
-#endif
-#ifndef QT_NO_PROGRESSBAR
-# define QT_NO_PROGRESSBAR
-#endif
-#ifndef QT_NO_SIZEGRIP
-# define QT_NO_SIZEGRIP
-#endif
-#ifndef QT_NO_DIAL
-# define QT_NO_DIAL
-#endif
-#ifndef QT_NO_STACKEDWIDGET
-# define QT_NO_STACKEDWIDGET
-#endif
-#ifndef QT_NO_TABWIDGET
-# define QT_NO_TABWIDGET
-#endif
-#ifndef QT_NO_STATUSBAR
-# define QT_NO_STATUSBAR
-#endif
-#ifndef QT_NO_STATUSTIP
-# define QT_NO_STATUSTIP
-#endif
-#ifndef QT_NO_TABLEWIDGET
-# define QT_NO_TABLEWIDGET
-#endif
-#ifndef QT_NO_TOOLBUTTON
-# define QT_NO_TOOLBUTTON
-#endif
-#ifndef QT_NO_TABBAR
-# define QT_NO_TABBAR
-#endif
-#ifndef QT_NO_TOOLBOX
-# define QT_NO_TOOLBOX
-#endif
-#ifndef QT_NO_WHATSTHIS
-# define QT_NO_WHATSTHIS
-#endif
-#ifndef QT_NO_TOOLTIP
-# define QT_NO_TOOLTIP
-#endif
-#ifndef QT_NO_TREEWIDGET
-# define QT_NO_TREEWIDGET
-#endif
diff --git a/src/corelib/global/qconfig-minimal.h b/src/corelib/global/qconfig-minimal.h
deleted file mode 100644
index 305655b1c9..0000000000
--- a/src/corelib/global/qconfig-minimal.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/* Data structures */
-#ifndef QT_NO_TEXTDATE
-# define QT_NO_TEXTDATE
-#endif
-#ifndef QT_NO_DATESTRING
-# define QT_NO_DATESTRING
-#endif
-
-/* Dialogs */
-#ifndef QT_NO_COLORDIALOG
-# define QT_NO_COLORDIALOG
-#endif
-#ifndef QT_NO_ERRORMESSAGE
-# define QT_NO_ERRORMESSAGE
-#endif
-#ifndef QT_NO_FILEDIALOG
-# define QT_NO_FILEDIALOG
-#endif
-#ifndef QT_NO_FONTDIALOG
-# define QT_NO_FONTDIALOG
-#endif
-#ifndef QT_NO_INPUTDIALOG
-# define QT_NO_INPUTDIALOG
-#endif
-#ifndef QT_NO_MESSAGEBOX
-# define QT_NO_MESSAGEBOX
-#endif
-#ifndef QT_NO_PRINTDIALOG
-# define QT_NO_PRINTDIALOG
-#endif
-#ifndef QT_NO_PRINTPREVIEWDIALOG
-# define QT_NO_PRINTPREVIEWDIALOG
-#endif
-#ifndef QT_NO_PROGRESSDIALOG
-# define QT_NO_PROGRESSDIALOG
-#endif
-#ifndef QT_NO_WIZARD
-# define QT_NO_WIZARD
-#endif
-
-/* File I/O */
-#ifndef QT_NO_DOM
-# define QT_NO_DOM
-#endif
-#ifndef QT_NO_FILESYSTEMWATCHER
-# define QT_NO_FILESYSTEMWATCHER
-#endif
-#ifndef QT_NO_FILESYSTEMMODEL
-# define QT_NO_FILESYSTEMMODEL
-#endif
-#ifndef QT_NO_PROCESS
-# define QT_NO_PROCESS
-#endif
-#ifndef QT_NO_TEMPORARYFILE
-# define QT_NO_TEMPORARYFILE
-#endif
-#ifndef QT_NO_SETTINGS
-# define QT_NO_SETTINGS
-#endif
-#ifndef QT_NO_LIBRARY
-# define QT_NO_LIBRARY
-#endif
-
-/* Fonts */
-#ifndef QT_NO_FREETYPE
-# define QT_NO_FREETYPE
-#endif
-
-/* Images */
-#ifndef QT_NO_IMAGEFORMATPLUGIN
-# define QT_NO_IMAGEFORMATPLUGIN
-#endif
-#ifndef QT_NO_IMAGEFORMAT_BMP
-# define QT_NO_IMAGEFORMAT_BMP
-#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
-# define QT_NO_IMAGEFORMAT_JPEG
-#endif
-#ifndef QT_NO_IMAGEFORMAT_PNG
-# define QT_NO_IMAGEFORMAT_PNG
-#endif
-#ifndef QT_NO_IMAGEFORMAT_PPM
-# define QT_NO_IMAGEFORMAT_PPM
-#endif
-#ifndef QT_NO_IMAGEFORMAT_XBM
-# define QT_NO_IMAGEFORMAT_XBM
-#endif
-#ifndef QT_NO_IMAGEFORMAT_XPM
-# define QT_NO_IMAGEFORMAT_XPM
-#endif
-#ifndef QT_NO_IMAGE_HEURISTIC_MASK
-# define QT_NO_IMAGE_HEURISTIC_MASK
-#endif
-#ifndef QT_NO_MOVIE
-# define QT_NO_MOVIE
-#endif
-
-/* Internationalization */
-#ifndef QT_NO_BIG_CODECS
-# define QT_NO_BIG_CODECS
-#endif
-#ifndef QT_NO_TEXTCODEC
-# define QT_NO_TEXTCODEC
-#endif
-#ifndef QT_NO_CODECS
-# define QT_NO_CODECS
-#endif
-#ifndef QT_NO_TRANSLATION
-# define QT_NO_TRANSLATION
-#endif
-
-/* ItemViews */
-#ifndef QT_NO_ITEMVIEWS
-# define QT_NO_ITEMVIEWS
-#endif
-#ifndef QT_NO_DATAWIDGETMAPPER
-# define QT_NO_DATAWIDGETMAPPER
-#endif
-#ifndef QT_NO_DIRMODEL
-# define QT_NO_DIRMODEL
-#endif
-#ifndef QT_NO_LISTVIEW
-# define QT_NO_LISTVIEW
-#endif
-#ifndef QT_NO_COLUMNVIEW
-# define QT_NO_COLUMNVIEW
-#endif
-#ifndef QT_NO_PROXYMODEL
-# define QT_NO_PROXYMODEL
-#endif
-#ifndef QT_NO_SORTFILTERPROXYMODEL
-# define QT_NO_SORTFILTERPROXYMODEL
-#endif
-#ifndef QT_NO_STANDARDITEMMODEL
-# define QT_NO_STANDARDITEMMODEL
-#endif
-#ifndef QT_NO_STRINGLISTMODEL
-# define QT_NO_STRINGLISTMODEL
-#endif
-#ifndef QT_NO_TABLEVIEW
-# define QT_NO_TABLEVIEW
-#endif
-#ifndef QT_NO_TREEVIEW
-# define QT_NO_TREEVIEW
-#endif
-
-/* Kernel */
-#ifndef QT_NO_ACTION
-# define QT_NO_ACTION
-#endif
-#ifndef QT_NO_CLIPBOARD
-# define QT_NO_CLIPBOARD
-#endif
-#ifndef QT_NO_CSSPARSER
-# define QT_NO_CSSPARSER
-#endif
-#ifndef QT_NO_CURSOR
-# define QT_NO_CURSOR
-#endif
-#ifndef QT_NO_DRAGANDDROP
-# define QT_NO_DRAGANDDROP
-#endif
-#ifndef QT_NO_EFFECTS
-# define QT_NO_EFFECTS
-#endif
-#ifndef QT_NO_PROPERTIES
-# define QT_NO_PROPERTIES
-#endif
-#ifndef QT_NO_SESSIONMANAGER
-# define QT_NO_SESSIONMANAGER
-#endif
-#ifndef QT_NO_SHAREDMEMORY
-# define QT_NO_SHAREDMEMORY
-#endif
-#ifndef QT_NO_SHORTCUT
-# define QT_NO_SHORTCUT
-#endif
-#ifndef QT_NO_SYSTEMSEMAPHORE
-# define QT_NO_SYSTEMSEMAPHORE
-#endif
-#ifndef QT_NO_TABLETEVENT
-# define QT_NO_TABLETEVENT
-#endif
-#ifndef QT_NO_TEXTHTMLPARSER
-# define QT_NO_TEXTHTMLPARSER
-#endif
-#ifndef QT_NO_CONCURRENT
-# define QT_NO_CONCURRENT
-#endif
-#ifndef QT_NO_WHEELEVENT
-# define QT_NO_WHEELEVENT
-#endif
-#ifndef QT_NO_XMLSTREAM
-# define QT_NO_XMLSTREAM
-#endif
-#ifndef QT_NO_XMLSTREAMREADER
-# define QT_NO_XMLSTREAMREADER
-#endif
-#ifndef QT_NO_XMLSTREAMWRITER
-# define QT_NO_XMLSTREAMWRITER
-#endif
-
-/* Networking */
-#ifndef QT_NO_HTTP
-# define QT_NO_HTTP
-#endif
-#ifndef QT_NO_NETWORKPROXY
-# define QT_NO_NETWORKPROXY
-#endif
-#ifndef QT_NO_SOCKS5
-# define QT_NO_SOCKS5
-#endif
-#ifndef QT_NO_UDPSOCKET
-# define QT_NO_UDPSOCKET
-#endif
-#ifndef QT_NO_FTP
-# define QT_NO_FTP
-#endif
-
-/* Painting */
-#ifndef QT_NO_COLORNAMES
-# define QT_NO_COLORNAMES
-#endif
-#ifndef QT_NO_PAINT_DEBUG
-# define QT_NO_PAINT_DEBUG
-#endif
-#ifndef QT_NO_PICTURE
-# define QT_NO_PICTURE
-#endif
-#ifndef QT_NO_PRINTER
-# define QT_NO_PRINTER
-#endif
-#ifndef QT_NO_CUPS
-# define QT_NO_CUPS
-#endif
-
-/* Styles */
-#ifndef QT_NO_STYLE_FUSION
-# define QT_NO_STYLE_FUSION
-#endif
-#ifndef QT_NO_STYLE_STYLESHEET
-# define QT_NO_STYLE_STYLESHEET
-#endif
-#ifndef QT_NO_STYLE_WINDOWSCE
-# define QT_NO_STYLE_WINDOWSCE
-#endif
-#ifndef QT_NO_STYLE_WINDOWSMOBILE
-# define QT_NO_STYLE_WINDOWSMOBILE
-#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
-# define QT_NO_STYLE_WINDOWSVISTA
-#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
-# define QT_NO_STYLE_WINDOWSXP
-#endif
-
-/* Utilities */
-#ifndef QT_NO_ACCESSIBILITY
-# define QT_NO_ACCESSIBILITY
-#endif
-#ifndef QT_NO_COMPLETER
-# define QT_NO_COMPLETER
-#endif
-#ifndef QT_NO_DESKTOPSERVICES
-# define QT_NO_DESKTOPSERVICES
-#endif
-#ifndef QT_NO_MIMETYPE
-# define QT_NO_MIMETYPE
-#endif
-#ifndef QT_NO_SYSTEMTRAYICON
-# define QT_NO_SYSTEMTRAYICON
-#endif
-#ifndef QT_NO_UNDOCOMMAND
-# define QT_NO_UNDOCOMMAND
-#endif
-#ifndef QT_NO_UNDOGROUP
-# define QT_NO_UNDOGROUP
-#endif
-#ifndef QT_NO_UNDOSTACK
-# define QT_NO_UNDOSTACK
-#endif
-#ifndef QT_NO_UNDOVIEW
-# define QT_NO_UNDOVIEW
-#endif
-#ifndef QT_NO_GESTURES
-# define QT_NO_GESTURES
-#endif
-
-/* Widgets */
-#ifndef QT_NO_GROUPBOX
-# define QT_NO_GROUPBOX
-#endif
-#ifndef QT_NO_BUTTONGROUP
-# define QT_NO_BUTTONGROUP
-#endif
-#ifndef QT_NO_LCDNUMBER
-# define QT_NO_LCDNUMBER
-#endif
-#ifndef QT_NO_LINEEDIT
-# define QT_NO_LINEEDIT
-#endif
-#ifndef QT_NO_COMBOBOX
-# define QT_NO_COMBOBOX
-#endif
-#ifndef QT_NO_FONTCOMBOBOX
-# define QT_NO_FONTCOMBOBOX
-#endif
-#ifndef QT_NO_SPINBOX
-# define QT_NO_SPINBOX
-#endif
-#ifndef QT_NO_CALENDARWIDGET
-# define QT_NO_CALENDARWIDGET
-#endif
-#ifndef QT_NO_DATETIMEEDIT
-# define QT_NO_DATETIMEEDIT
-#endif
-#ifndef QT_NO_LISTWIDGET
-# define QT_NO_LISTWIDGET
-#endif
-#ifndef QT_NO_MENU
-# define QT_NO_MENU
-#endif
-#ifndef QT_NO_CONTEXTMENU
-# define QT_NO_CONTEXTMENU
-#endif
-#ifndef QT_NO_MAINWINDOW
-# define QT_NO_MAINWINDOW
-#endif
-#ifndef QT_NO_DOCKWIDGET
-# define QT_NO_DOCKWIDGET
-#endif
-#ifndef QT_NO_TOOLBAR
-# define QT_NO_TOOLBAR
-#endif
-#ifndef QT_NO_MENUBAR
-# define QT_NO_MENUBAR
-#endif
-#ifndef QT_NO_PROGRESSBAR
-# define QT_NO_PROGRESSBAR
-#endif
-#ifndef QT_NO_RESIZEHANDLER
-# define QT_NO_RESIZEHANDLER
-#endif
-#ifndef QT_NO_RUBBERBAND
-# define QT_NO_RUBBERBAND
-#endif
-#ifndef QT_NO_SPLITTER
-# define QT_NO_SPLITTER
-#endif
-#ifndef QT_NO_SIZEGRIP
-# define QT_NO_SIZEGRIP
-#endif
-#ifndef QT_NO_SLIDER
-# define QT_NO_SLIDER
-#endif
-#ifndef QT_NO_DIAL
-# define QT_NO_DIAL
-#endif
-#ifndef QT_NO_SCROLLBAR
-# define QT_NO_SCROLLBAR
-#endif
-#ifndef QT_NO_SCROLLAREA
-# define QT_NO_SCROLLAREA
-#endif
-#ifndef QT_NO_GRAPHICSVIEW
-# define QT_NO_GRAPHICSVIEW
-#endif
-#ifndef QT_NO_PRINTPREVIEWWIDGET
-# define QT_NO_PRINTPREVIEWWIDGET
-#endif
-#ifndef QT_NO_MDIAREA
-# define QT_NO_MDIAREA
-#endif
-#ifndef QT_NO_TEXTEDIT
-# define QT_NO_TEXTEDIT
-#endif
-#ifndef QT_NO_SYNTAXHIGHLIGHTER
-# define QT_NO_SYNTAXHIGHLIGHTER
-#endif
-#ifndef QT_NO_TEXTBROWSER
-# define QT_NO_TEXTBROWSER
-#endif
-#ifndef QT_NO_SPINWIDGET
-# define QT_NO_SPINWIDGET
-#endif
-#ifndef QT_NO_SPLASHSCREEN
-# define QT_NO_SPLASHSCREEN
-#endif
-#ifndef QT_NO_STACKEDWIDGET
-# define QT_NO_STACKEDWIDGET
-#endif
-#ifndef QT_NO_TABWIDGET
-# define QT_NO_TABWIDGET
-#endif
-#ifndef QT_NO_STATUSBAR
-# define QT_NO_STATUSBAR
-#endif
-#ifndef QT_NO_STATUSTIP
-# define QT_NO_STATUSTIP
-#endif
-#ifndef QT_NO_TABLEWIDGET
-# define QT_NO_TABLEWIDGET
-#endif
-#ifndef QT_NO_TOOLBUTTON
-# define QT_NO_TOOLBUTTON
-#endif
-#ifndef QT_NO_TABBAR
-# define QT_NO_TABBAR
-#endif
-#ifndef QT_NO_TOOLBOX
-# define QT_NO_TOOLBOX
-#endif
-#ifndef QT_NO_WHATSTHIS
-# define QT_NO_WHATSTHIS
-#endif
-#ifndef QT_NO_TOOLTIP
-# define QT_NO_TOOLTIP
-#endif
-#ifndef QT_NO_TREEWIDGET
-# define QT_NO_TREEWIDGET
-#endif
-#ifndef QT_NO_VALIDATOR
-# define QT_NO_VALIDATOR
-#endif
diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h
deleted file mode 100644
index 10292c05c3..0000000000
--- a/src/corelib/global/qconfig-nacl.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#if 0
-#pragma qt_sync_stop_processing
-#endif
-
-#define QT_FONTS_ARE_RESOURCES
-
-/* Data structures */
-#ifndef QT_NO_TEXTDATE
-# define QT_NO_TEXTDATE
-#endif
-#ifndef QT_NO_DATESTRING
-# define QT_NO_DATESTRING
-#endif
-
-/* Dialogs */
-#ifndef QT_NO_FILEDIALOG
-# define QT_NO_FILEDIALOG
-#endif
-#ifndef QT_NO_PRINTDIALOG
-# define QT_NO_PRINTDIALOG
-#endif
-#ifndef QT_NO_PRINTPREVIEWDIALOG
-# define QT_NO_PRINTPREVIEWDIALOG
-#endif
-
-
-/* File I/O */
-#ifndef QT_NO_DOM
-# define QT_NO_DOM
-#endif
-#ifndef QT_NO_FILESYSTEMWATCHER
-# define QT_NO_FILESYSTEMWATCHER
-#endif
-#ifndef QT_NO_FILESYSTEMMODEL
-# define QT_NO_FILESYSTEMMODEL
-#endif
-#ifndef QT_NO_FILESYSTEMMODEL
-# define QT_NO_FILESYSTEMMODEL
-#endif
-#ifndef QT_NO_PROCESS
-# define QT_NO_PROCESS
-#endif
-#ifndef QT_NO_TEMPORARYFILE
-# define QT_NO_TEMPORARYFILE
-#endif
-#ifndef QT_NO_SETTINGS
-# define QT_NO_SETTINGS
-#endif
-#ifndef QT_NO_LIBRARY
-# define QT_NO_LIBRARY
-#endif
-
-/* Images */
-#ifndef QT_NO_IMAGEFORMATPLUGIN
-# define QT_NO_IMAGEFORMATPLUGIN
-#endif
-#ifndef QT_NO_IMAGE_HEURISTIC_MASK
-# define QT_NO_IMAGE_HEURISTIC_MASK
-#endif
-#ifndef QT_NO_MOVIE
-# define QT_NO_MOVIE
-#endif
-
-/* Internationalization */
-#ifndef QT_NO_BIG_CODECS
-# define QT_NO_BIG_CODECS
-#endif
-#ifndef QT_NO_TEXTCODEC
-# define QT_NO_TEXTCODEC
-#endif
-#ifndef QT_NO_CODECS
-# define QT_NO_CODECS
-#endif
-#ifndef QT_NO_TRANSLATION
-# define QT_NO_TRANSLATION
-#endif
-
-/* ItemViews */
-
-#ifndef QT_NO_DIRMODEL
-# define QT_NO_DIRMODEL
-#endif
-
-/* Kernel */
-#ifndef QT_NO_CLIPBOARD
-# define QT_NO_CLIPBOARD
-#endif
-#ifndef QT_NO_CSSPARSER
-# define QT_NO_CSSPARSER
-#endif
-#ifndef QT_NO_CURSOR
-# define QT_NO_CURSOR
-#endif
-#ifndef QT_NO_DRAGANDDROP
-# define QT_NO_DRAGANDDROP
-#endif
-#ifndef QT_NO_EFFECTS
-# define QT_NO_EFFECTS
-#endif
-#ifndef QT_NO_SESSIONMANAGER
-# define QT_NO_SESSIONMANAGER
-#endif
-#ifndef QT_NO_SHAREDMEMORY
-# define QT_NO_SHAREDMEMORY
-#endif
-#ifndef QT_NO_SYSTEMLOCALE
-# define QT_NO_SYSTEMSEMAPHORE
-#endif
-#ifndef QT_NO_SYSTEMSEMAPHORE
-# define QT_NO_SYSTEMSEMAPHORE
-#endif
-#ifndef QT_NO_TABLETEVENT
-# define QT_NO_TABLETEVENT
-#endif
-#ifndef QT_NO_CRASHHANDLER
-# define QT_NO_CRASHHANDLER
-#endif
-#ifndef QT_NO_CONCURRENT
-# define QT_NO_CONCURRENT
-#endif
-#ifndef QT_NO_XMLSTREAM
-# define QT_NO_XMLSTREAM
-#endif
-#ifndef QT_NO_XMLSTREAMREADER
-# define QT_NO_XMLSTREAMREADER
-#endif
-#ifndef QT_NO_XMLSTREAMWRITER
-# define QT_NO_XMLSTREAMWRITER
-#endif
-
-/* Networking */
-#ifndef QT_NO_HTTP
-# define QT_NO_HTTP
-#endif
-#ifndef QT_NO_NETWORKPROXY
-# define QT_NO_NETWORKPROXY
-#endif
-#ifndef QT_NO_SOCKS5
-# define QT_NO_SOCKS5
-#endif
-#ifndef QT_NO_UDPSOCKET
-# define QT_NO_UDPSOCKET
-#endif
-#ifndef QT_NO_FTP
-# define QT_NO_FTP
-#endif
-
-/* Painting */
-#ifndef QT_NO_COLORNAMES
-# define QT_NO_COLORNAMES
-#endif
-#ifndef QT_NO_PAINT_DEBUG
-# define QT_NO_PAINT_DEBUG
-#endif
-#ifndef QT_NO_PICTURE
-# define QT_NO_PICTURE
-#endif
-#ifndef QT_NO_PRINTER
-# define QT_NO_PRINTER
-#endif
-#ifndef QT_NO_CUPS
-# define QT_NO_CUPS
-#endif
-
-/* Styles */
-#ifndef QT_NO_STYLE_STYLESHEET
-# define QT_NO_STYLE_STYLESHEET
-#endif
-#ifndef QT_NO_STYLE_WINDOWSCE
-# define QT_NO_STYLE_WINDOWSCE
-#endif
-#ifndef QT_NO_STYLE_WINDOWSMOBILE
-# define QT_NO_STYLE_WINDOWSMOBILE
-#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
-# define QT_NO_STYLE_WINDOWSVISTA
-#endif
-#ifndef QT_NO_STYLE_WINDOWSXP
-# define QT_NO_STYLE_WINDOWSXP
-#endif
-
-/* Utilities */
-#ifndef QT_NO_ACCESSIBILITY
-# define QT_NO_ACCESSIBILITY
-#endif
-#ifndef QT_NO_COMPLETER
-# define QT_NO_COMPLETER
-#endif
-#ifndef QT_NO_DESKTOPSERVICES
-# define QT_NO_DESKTOPSERVICES
-#endif
-#ifndef QT_NO_SYSTEMTRAYICON
-# define QT_NO_SYSTEMTRAYICON
-#endif
diff --git a/src/corelib/global/qconfig-small.h b/src/corelib/global/qconfig-small.h
deleted file mode 100644
index 1f1bff91a3..0000000000
--- a/src/corelib/global/qconfig-small.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/* Dialogs */
-#ifndef QT_NO_COLORDIALOG
-# define QT_NO_COLORDIALOG
-#endif
-#ifndef QT_NO_ERRORMESSAGE
-# define QT_NO_ERRORMESSAGE
-#endif
-#ifndef QT_NO_FILEDIALOG
-# define QT_NO_FILEDIALOG
-#endif
-#ifndef QT_NO_FONTDIALOG
-# define QT_NO_FONTDIALOG
-#endif
-#ifndef QT_NO_INPUTDIALOG
-# define QT_NO_INPUTDIALOG
-#endif
-#ifndef QT_NO_MESSAGEBOX
-# define QT_NO_MESSAGEBOX
-#endif
-#ifndef QT_NO_PRINTDIALOG
-# define QT_NO_PRINTDIALOG
-#endif
-#ifndef QT_NO_PROGRESSDIALOG
-# define QT_NO_PROGRESSDIALOG
-#endif
-
-/* File I/O */
-#ifndef QT_NO_SETTINGS
-# define QT_NO_SETTINGS
-#endif
-#ifndef QT_NO_LIBRARY
-# define QT_NO_LIBRARY
-#endif
-
-/* Fonts */
-#ifndef QT_NO_FREETYPE
-# define QT_NO_FREETYPE
-#endif
-
-/* Images */
-#ifndef QT_NO_IMAGEFORMATPLUGIN
-# define QT_NO_IMAGEFORMATPLUGIN
-#endif
-#ifndef QT_NO_IMAGEFORMAT_BMP
-# define QT_NO_IMAGEFORMAT_BMP
-#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
-# define QT_NO_IMAGEFORMAT_JPEG
-#endif
-#ifndef QT_NO_IMAGEFORMAT_PPM
-# define QT_NO_IMAGEFORMAT_PPM
-#endif
-#ifndef QT_NO_IMAGEFORMAT_XBM
-# define QT_NO_IMAGEFORMAT_XBM
-#endif
-#ifndef QT_NO_IMAGEFORMAT_XPM
-# define QT_NO_IMAGEFORMAT_XPM
-#endif
-#ifndef QT_NO_MOVIE
-# define QT_NO_MOVIE
-#endif
-
-/* Internationalization */
-#ifndef QT_NO_TEXTCODEC
-# define QT_NO_TEXTCODEC
-#endif
-#ifndef QT_NO_CODECS
-# define QT_NO_CODECS
-#endif
-#ifndef QT_NO_TRANSLATION
-# define QT_NO_TRANSLATION
-#endif
-
-/* ItemViews */
-#ifndef QT_NO_DIRMODEL
-# define QT_NO_DIRMODEL
-#endif
-#ifndef QT_NO_PROXYMODEL
-# define QT_NO_PROXYMODEL
-#endif
-#ifndef QT_NO_SORTFILTERPROXYMODEL
-# define QT_NO_SORTFILTERPROXYMODEL
-#endif
-#ifndef QT_NO_STRINGLISTMODEL
-# define QT_NO_STRINGLISTMODEL
-#endif
-#ifndef QT_NO_TABLEVIEW
-# define QT_NO_TABLEVIEW
-#endif
-#ifndef QT_NO_TREEVIEW
-# define QT_NO_TREEVIEW
-#endif
-
-/* Kernel */
-#ifndef QT_NO_ACTION
-# define QT_NO_ACTION
-#endif
-#ifndef QT_NO_CLIPBOARD
-# define QT_NO_CLIPBOARD
-#endif
-#ifndef QT_NO_DRAGANDDROP
-# define QT_NO_DRAGANDDROP
-#endif
-#ifndef QT_NO_EFFECTS
-# define QT_NO_EFFECTS
-#endif
-#ifndef QT_NO_PROPERTIES
-# define QT_NO_PROPERTIES
-#endif
-#ifndef QT_NO_SESSIONMANAGER
-# define QT_NO_SESSIONMANAGER
-#endif
-#ifndef QT_NO_SHORTCUT
-# define QT_NO_SHORTCUT
-#endif
-#ifndef QT_NO_WHEELEVENT
-# define QT_NO_WHEELEVENT
-#endif
-
-/* Networking */
-#ifndef QT_NO_HTTP
-# define QT_NO_HTTP
-#endif
-
-/* Painting */
-#ifndef QT_NO_COLORNAMES
-# define QT_NO_COLORNAMES
-#endif
-#ifndef QT_NO_PICTURE
-# define QT_NO_PICTURE
-#endif
-#ifndef QT_NO_PRINTER
-# define QT_NO_PRINTER
-#endif
-#ifndef QT_NO_CUPS
-# define QT_NO_CUPS
-#endif
-
-/* Styles */
-#ifndef QT_NO_STYLE_FUSION
-# define QT_NO_STYLE_FUSION
-#endif
-#ifndef QT_NO_STYLE_STYLESHEET
-# define QT_NO_STYLE_STYLESHEET
-#endif
-#ifndef QT_NO_STYLE_WINDOWSVISTA
-# define QT_NO_STYLE_WINDOWSVISTA
-#endif
-
-/* Utilities */
-#ifndef QT_NO_COMPLETER
-# define QT_NO_COMPLETER
-#endif
-#ifndef QT_NO_DESKTOPSERVICES
-# define QT_NO_DESKTOPSERVICES
-#endif
-#ifndef QT_NO_MIMETYPE
-# define QT_NO_MIMETYPE
-#endif
-#ifndef QT_NO_SYSTEMTRAYICON
-# define QT_NO_SYSTEMTRAYICON
-#endif
-#ifndef QT_NO_GESTURES
-# define QT_NO_GESTURES
-#endif
-
-/* Widgets */
-#ifndef QT_NO_LCDNUMBER
-# define QT_NO_LCDNUMBER
-#endif
-#ifndef QT_NO_FONTCOMBOBOX
-# define QT_NO_FONTCOMBOBOX
-#endif
-#ifndef QT_NO_SPINBOX
-# define QT_NO_SPINBOX
-#endif
-#ifndef QT_NO_CALENDARWIDGET
-# define QT_NO_CALENDARWIDGET
-#endif
-#ifndef QT_NO_DATETIMEEDIT
-# define QT_NO_DATETIMEEDIT
-#endif
-#ifndef QT_NO_MENU
-# define QT_NO_MENU
-#endif
-#ifndef QT_NO_CONTEXTMENU
-# define QT_NO_CONTEXTMENU
-#endif
-#ifndef QT_NO_MAINWINDOW
-# define QT_NO_MAINWINDOW
-#endif
-#ifndef QT_NO_DOCKWIDGET
-# define QT_NO_DOCKWIDGET
-#endif
-#ifndef QT_NO_TOOLBAR
-# define QT_NO_TOOLBAR
-#endif
-#ifndef QT_NO_MENUBAR
-# define QT_NO_MENUBAR
-#endif
-#ifndef QT_NO_PROGRESSBAR
-# define QT_NO_PROGRESSBAR
-#endif
-#ifndef QT_NO_SPLITTER
-# define QT_NO_SPLITTER
-#endif
-#ifndef QT_NO_SIZEGRIP
-# define QT_NO_SIZEGRIP
-#endif
-#ifndef QT_NO_STACKEDWIDGET
-# define QT_NO_STACKEDWIDGET
-#endif
-#ifndef QT_NO_TABWIDGET
-# define QT_NO_TABWIDGET
-#endif
-#ifndef QT_NO_STATUSBAR
-# define QT_NO_STATUSBAR
-#endif
-#ifndef QT_NO_TABLEWIDGET
-# define QT_NO_TABLEWIDGET
-#endif
-#ifndef QT_NO_TOOLBUTTON
-# define QT_NO_TOOLBUTTON
-#endif
-#ifndef QT_NO_TABBAR
-# define QT_NO_TABBAR
-#endif
-#ifndef QT_NO_TOOLBOX
-# define QT_NO_TOOLBOX
-#endif
-#ifndef QT_NO_WHATSTHIS
-# define QT_NO_WHATSTHIS
-#endif
-#ifndef QT_NO_TOOLTIP
-# define QT_NO_TOOLTIP
-#endif
-#ifndef QT_NO_TREEWIDGET
-# define QT_NO_TREEWIDGET
-#endif
-#ifndef QT_NO_VALIDATOR
-# define QT_NO_VALIDATOR
-#endif
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index b907caa9b6..a6bd37c33f 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -111,8 +111,8 @@ public:
typedef Enum enum_type;
// compiler-generated copy/move ctor/assignment operators are fine!
#ifdef Q_QDOC
- inline QFlags(const QFlags &other);
- inline QFlags &operator=(const QFlags &other);
+ Q_DECL_CONSTEXPR inline QFlags(const QFlags &other);
+ Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other);
#endif
Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {}
@@ -163,8 +163,10 @@ private:
Int i;
};
+#ifndef Q_MOC_RUN
#define Q_DECLARE_FLAGS(Flags, Enum)\
typedef QFlags<Enum> Flags;
+#endif
#define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \
Q_DECL_CONSTEXPR inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW \
@@ -179,8 +181,11 @@ Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1,
#else /* Q_NO_TYPESAFE_FLAGS */
+#ifndef Q_MOC_RUN
#define Q_DECLARE_FLAGS(Flags, Enum)\
typedef uint Flags;
+#endif
+
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
#endif /* Q_NO_TYPESAFE_FLAGS */
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6ca2ecff91..3eaec11008 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -47,7 +47,6 @@
#include "qdatetime.h"
#include <private/qlocale_tools_p.h>
-#include <private/qsystemlibrary_p.h>
#include <qmutex.h>
#ifndef QT_NO_QOBJECT
@@ -64,11 +63,9 @@
# include <exception>
#endif
-#if !defined(Q_OS_WINCE)
-# include <errno.h>
-# if defined(Q_CC_MSVC)
-# include <crtdbg.h>
-# endif
+#include <errno.h>
+#if defined(Q_CC_MSVC)
+# include <crtdbg.h>
#endif
#ifdef Q_OS_WINRT
@@ -573,11 +570,11 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
\snippet code/src_corelib_global_qglobal.cpp 4
The remaining functions are qRound() and qRound64(), which both
- accept a \l qreal value as their argument returning the value
- rounded up to the nearest integer and 64-bit integer respectively,
- the qInstallMessageHandler() function which installs the given
- QtMessageHandler, and the qVersion() function which returns the
- version number of Qt at run-time as a string.
+ accept a \c double or \c float value as their argument returning
+ the value rounded up to the nearest integer and 64-bit integer
+ respectively, the qInstallMessageHandler() function which installs
+ the given QtMessageHandler, and the qVersion() function which
+ returns the version number of Qt at run-time as a string.
\section1 Macros
@@ -864,24 +861,44 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
\snippet code/src_corelib_global_qglobal.cpp 10
*/
-/*! \fn int qRound(qreal value)
+/*! \fn int qRound(double value)
+ \relates <QtGlobal>
+
+ Rounds \a value to the nearest integer.
+
+ Example:
+
+ \snippet code/src_corelib_global_qglobal.cpp 11A
+*/
+
+/*! \fn int qRound(float value)
\relates <QtGlobal>
Rounds \a value to the nearest integer.
Example:
- \snippet code/src_corelib_global_qglobal.cpp 11
+ \snippet code/src_corelib_global_qglobal.cpp 11B
+*/
+
+/*! \fn qint64 qRound64(double value)
+ \relates <QtGlobal>
+
+ Rounds \a value to the nearest 64-bit integer.
+
+ Example:
+
+ \snippet code/src_corelib_global_qglobal.cpp 12A
*/
-/*! \fn qint64 qRound64(qreal value)
+/*! \fn qint64 qRound64(float value)
\relates <QtGlobal>
Rounds \a value to the nearest 64-bit integer.
Example:
- \snippet code/src_corelib_global_qglobal.cpp 12
+ \snippet code/src_corelib_global_qglobal.cpp 12B
*/
/*! \fn const T &qMin(const T &value1, const T &value2)
@@ -1016,7 +1033,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
example, "4.1.2"). This may be a different version than the
version the application was compiled against.
- \sa QT_VERSION_STR
+ \sa QT_VERSION_STR, QLibraryInfo::version()
*/
const char *qVersion() Q_DECL_NOTHROW
@@ -1147,19 +1164,11 @@ bool qSharedBuild() Q_DECL_NOTHROW
\value WV_6_3 Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2
\value WV_10_0 Operating system version 10.0, corresponds to Windows 10, introduced in Qt 5.5
- CE-based versions:
-
- \value WV_CE Windows CE
- \value WV_CENET Windows CE .NET
- \value WV_CE_5 Windows CE 5.x
- \value WV_CE_6 Windows CE 6.x
-
The following masks can be used for testing whether a Windows
version is MS-DOS-based, NT-based, or CE-based:
\value WV_DOS_based MS-DOS-based version of Windows
\value WV_NT_based NT-based version of Windows
- \value WV_CE_based CE-based version of Windows
\value WV_None Operating system other than Windows.
@@ -1262,7 +1271,7 @@ bool qSharedBuild() Q_DECL_NOTHROW
\relates <QtGlobal>
Defined on all supported versions of Windows. That is, if
- \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined.
+ \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINRT is defined.
*/
/*!
@@ -1280,13 +1289,6 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
- \macro Q_OS_WINCE
- \relates <QtGlobal>
-
- Defined on Windows CE.
-*/
-
-/*!
\macro Q_OS_WINRT
\relates <QtGlobal>
@@ -1916,13 +1918,33 @@ QSysInfo::MacVersion QSysInfo::macVersion()
return QSysInfo::MacVersion(Q_MV_OSX(version.major, version.minor));
#elif defined(Q_OS_IOS)
return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor));
+#elif defined(Q_OS_TVOS)
+ return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor));
#else
return QSysInfo::MV_Unknown;
#endif
}
const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion();
-#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#ifdef Q_OS_OSX
+static const char *osxVer_helper(QAppleOperatingSystemVersion version = qt_apple_os_version())
+{
+ if (version.major == 10) {
+ switch (version.minor) {
+ case 9:
+ return "Mavericks";
+ case 10:
+ return "Yosemite";
+ case 11:
+ return "El Capitan";
+ }
+ }
+ // unknown, future version
+ return 0;
+}
+#endif
+
+#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT)
QT_BEGIN_INCLUDE_NAMESPACE
#include "qt_windows.h"
@@ -1975,9 +1997,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion()
{
OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0};
-#ifndef Q_OS_WINCE
#define GetProcAddressA GetProcAddress
-#endif
// GetModuleHandle is not supported in WinRT and linking to it at load time
// will not pass the Windows App Certification Kit... but it exists and is functional,
@@ -2026,113 +2046,66 @@ static inline OSVERSIONINFOEX determineWinOsVersion()
static OSVERSIONINFOEX winOsVersion()
{
- static OSVERSIONINFOEX result = determineWinOsVersion();
- return result;
-}
-
-QSysInfo::WinVersion QSysInfo::windowsVersion()
-{
-#ifndef VER_PLATFORM_WIN32s
-#define VER_PLATFORM_WIN32s 0
-#endif
-#ifndef VER_PLATFORM_WIN32_WINDOWS
-#define VER_PLATFORM_WIN32_WINDOWS 1
-#endif
-#ifndef VER_PLATFORM_WIN32_NT
-#define VER_PLATFORM_WIN32_NT 2
-#endif
-#ifndef VER_PLATFORM_WIN32_CE
-#define VER_PLATFORM_WIN32_CE 3
-#endif
-
- static QSysInfo::WinVersion winver;
- if (winver)
- return winver;
- winver = QSysInfo::WV_NT;
- const OSVERSIONINFOEX osver = winOsVersion();
- if (osver.dwMajorVersion == 0)
- return QSysInfo::WV_None;
-#ifdef Q_OS_WINCE
- DWORD qt_cever = 0;
- qt_cever = osver.dwMajorVersion * 100;
- qt_cever += osver.dwMinorVersion * 10;
-#endif
- switch (osver.dwPlatformId) {
- case VER_PLATFORM_WIN32s:
- winver = QSysInfo::WV_32s;
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- // We treat Windows Me (minor 90) the same as Windows 98
- if (osver.dwMinorVersion == 90)
- winver = QSysInfo::WV_Me;
- else if (osver.dwMinorVersion == 10)
- winver = QSysInfo::WV_98;
- else
- winver = QSysInfo::WV_95;
- break;
-#ifdef Q_OS_WINCE
- case VER_PLATFORM_WIN32_CE:
- if (qt_cever >= 600)
- winver = QSysInfo::WV_CE_6;
- if (qt_cever >= 500)
- winver = QSysInfo::WV_CE_5;
- else if (qt_cever >= 400)
- winver = QSysInfo::WV_CENET;
- else
- winver = QSysInfo::WV_CE;
- break;
-#endif
- default: // VER_PLATFORM_WIN32_NT
- if (osver.dwMajorVersion < 5) {
- winver = QSysInfo::WV_NT;
- } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0) {
- winver = QSysInfo::WV_2000;
- } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1) {
- winver = QSysInfo::WV_XP;
- } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2) {
- winver = QSysInfo::WV_2003;
- } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0) {
- winver = QSysInfo::WV_VISTA;
- } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 1) {
- winver = QSysInfo::WV_WINDOWS7;
- } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 2) {
- winver = QSysInfo::WV_WINDOWS8;
- } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 3) {
- winver = QSysInfo::WV_WINDOWS8_1;
- } else if (osver.dwMajorVersion == 10 && osver.dwMinorVersion == 0) {
- winver = QSysInfo::WV_WINDOWS10;
- } else {
- winver = QSysInfo::WV_NT_based;
- }
- }
-
+ OSVERSIONINFOEX realResult = determineWinOsVersion();
#ifdef QT_DEBUG
{
if (Q_UNLIKELY(qEnvironmentVariableIsSet("QT_WINVER_OVERRIDE"))) {
+ OSVERSIONINFOEX result = realResult;
+ result.dwMajorVersion = 0;
+ result.dwMinorVersion = 0;
+
+ // Erase any build number and service pack information
+ result.dwBuildNumber = 0;
+ result.szCSDVersion[0] = L'\0';
+ result.wServicePackMajor = 0;
+ result.wServicePackMinor = 0;
+
const QByteArray winVerOverride = qgetenv("QT_WINVER_OVERRIDE");
- if (winVerOverride == "NT")
- winver = QSysInfo::WV_NT;
- else if (winVerOverride == "2000")
- winver = QSysInfo::WV_2000;
- else if (winVerOverride == "2003")
- winver = QSysInfo::WV_2003;
- else if (winVerOverride == "XP")
- winver = QSysInfo::WV_XP;
- else if (winVerOverride == "VISTA")
- winver = QSysInfo::WV_VISTA;
- else if (winVerOverride == "WINDOWS7")
- winver = QSysInfo::WV_WINDOWS7;
- else if (winVerOverride == "WINDOWS8")
- winver = QSysInfo::WV_WINDOWS8;
- else if (winVerOverride == "WINDOWS8_1")
- winver = QSysInfo::WV_WINDOWS8_1;
- else if (winVerOverride == "WINDOWS10")
- winver = QSysInfo::WV_WINDOWS10;
+ if (winVerOverride == "WINDOWS7" || winVerOverride == "2008_R2") {
+ result.dwMajorVersion = 6;
+ result.dwMinorVersion = 1;
+ } else if (winVerOverride == "WINDOWS8" || winVerOverride == "2012") {
+ result.dwMajorVersion = 6;
+ result.dwMinorVersion = 2;
+ } else if (winVerOverride == "WINDOWS8_1" || winVerOverride == "2012_R2") {
+ result.dwMajorVersion = 6;
+ result.dwMinorVersion = 3;
+ } else if (winVerOverride == "WINDOWS10" || winVerOverride == "2016") {
+ result.dwMajorVersion = 10;
+ } else {
+ return realResult;
+ }
+
+ if (winVerOverride == "2008_R2"
+ || winVerOverride == "2012"
+ || winVerOverride == "2012_R2"
+ || winVerOverride == "2016") {
+ // If the current host OS is a domain controller and the override OS
+ // is also a server type OS, preserve that information
+ if (result.wProductType == VER_NT_WORKSTATION)
+ result.wProductType = VER_NT_SERVER;
+ } else {
+ // Any other OS must be a workstation OS type
+ result.wProductType = VER_NT_WORKSTATION;
+ }
}
}
#endif
+ return realResult;
+}
- return winver;
+QSysInfo::WinVersion QSysInfo::windowsVersion()
+{
+ const OSVERSIONINFOEX osver = winOsVersion();
+ if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 1)
+ return QSysInfo::WV_WINDOWS7;
+ if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 2)
+ return QSysInfo::WV_WINDOWS8;
+ if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 3)
+ return QSysInfo::WV_WINDOWS8_1;
+ if (osver.dwMajorVersion == 10 && osver.dwMinorVersion == 0)
+ return QSysInfo::WV_WINDOWS10;
+ return QSysInfo::WV_NT_based;
}
static QString winSp_helper()
@@ -2151,37 +2124,21 @@ static QString winSp_helper()
static const char *winVer_helper()
{
- const bool workstation = winOsVersion().wProductType == VER_NT_WORKSTATION;
-
- switch (int(QSysInfo::WindowsVersion)) {
- case QSysInfo::WV_NT:
- return "NT";
- case QSysInfo::WV_2000:
- return "2000";
- case QSysInfo::WV_XP:
- return "XP";
- case QSysInfo::WV_2003:
- return "2003";
- case QSysInfo::WV_VISTA:
- return workstation ? "Vista" : "Server 2008";
- case QSysInfo::WV_WINDOWS7:
+ const OSVERSIONINFOEX osver = winOsVersion();
+ const bool workstation = osver.wProductType == VER_NT_WORKSTATION;
+
+#define Q_WINVER(major, minor) (major << 8 | minor)
+ switch (Q_WINVER(osver.dwMajorVersion, osver.dwMinorVersion)) {
+ case Q_WINVER(6, 1):
return workstation ? "7" : "Server 2008 R2";
- case QSysInfo::WV_WINDOWS8:
+ case Q_WINVER(6, 2):
return workstation ? "8" : "Server 2012";
- case QSysInfo::WV_WINDOWS8_1:
+ case Q_WINVER(6, 3):
return workstation ? "8.1" : "Server 2012 R2";
- case QSysInfo::WV_WINDOWS10:
+ case Q_WINVER(10, 0):
return workstation ? "10" : "Server 2016";
-
- case QSysInfo::WV_CE:
- return "CE";
- case QSysInfo::WV_CENET:
- return "CENET";
- case QSysInfo::WV_CE_5:
- return "CE5";
- case QSysInfo::WV_CE_6:
- return "CE6";
}
+#undef Q_WINVER
// unknown, future version
return 0;
}
@@ -2438,7 +2395,7 @@ QString QSysInfo::buildCpuArchitecture()
*/
QString QSysInfo::currentCpuArchitecture()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
// We don't need to catch all the CPU architectures in this function;
// only those where the host CPU might be different than the build target
// (usually, 64-bit platforms).
@@ -2590,9 +2547,7 @@ static QString unknownText()
*/
QString QSysInfo::kernelType()
{
-#if defined(Q_OS_WINCE)
- return QStringLiteral("wince");
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
return QStringLiteral("winnt");
#elif defined(Q_OS_UNIX)
struct utsname u;
@@ -2648,16 +2603,15 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, OS X and iOS note}: this function returns "osx" for OS X
- systems, "ios" for iOS systems and "darwin" in case the system could not be
- determined.
+ \b{Darwin, OS X, iOS and tvOS note}: this function returns "osx" for OS X
+ systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case
+ the system could not be determined.
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
\b{Windows note}: this function returns "winphone" for builds for Windows
- Phone, "winrt" for WinRT builds, "wince" for Windows CE and Embedded
- Compact builds, and "windows" for normal desktop builds.
+ Phone, "winrt" for WinRT builds and "windows" for normal desktop builds.
For other Unix-type systems, this function usually returns "unknown".
@@ -2670,8 +2624,6 @@ QString QSysInfo::productType()
return QStringLiteral("winphone");
#elif defined(Q_OS_WINRT)
return QStringLiteral("winrt");
-#elif defined(Q_OS_WINCE)
- return QStringLiteral("wince");
#elif defined(Q_OS_WIN)
return QStringLiteral("windows");
@@ -2683,6 +2635,8 @@ QString QSysInfo::productType()
#elif defined(Q_OS_IOS)
return QStringLiteral("ios");
+#elif defined(Q_OS_TVOS)
+ return QStringLiteral("tvos");
#elif defined(Q_OS_OSX)
return QStringLiteral("osx");
#elif defined(Q_OS_DARWIN)
@@ -2766,50 +2720,35 @@ QString QSysInfo::prettyProductName()
{
#if defined(Q_OS_IOS)
return QLatin1String("iOS ") + productVersion();
+#elif defined(Q_OS_TVOS)
+ return QLatin1String("tvOS ") + productVersion();
#elif defined(Q_OS_OSX)
- // get the known codenames
- const char *basename = 0;
- switch (int(MacintoshVersion)) {
- case MV_CHEETAH:
- case MV_PUMA:
- case MV_JAGUAR:
- case MV_PANTHER:
- case MV_TIGER:
- // This version of Qt does not run on those versions of OS X
- // so this case label will never be reached
- Q_UNREACHABLE();
- break;
- case MV_LEOPARD:
- basename = "Mac OS X Leopard (";
- break;
- case MV_SNOWLEOPARD:
- basename = "Mac OS X Snow Leopard (";
- break;
- case MV_LION:
- basename = "OS X Lion (";
- break;
- case MV_MOUNTAINLION:
- basename = "OS X Mountain Lion (";
- break;
- case MV_MAVERICKS:
- basename = "OS X Mavericks (";
- break;
- case MV_YOSEMITE:
- basename = "OS X Yosemite (";
- break;
- case MV_ELCAPITAN:
- basename = "OS X El Capitan (";
- break;
+ const QAppleOperatingSystemVersion version = qt_apple_os_version();
+ const char *name = osxVer_helper(version);
+ if (name) {
+ return QLatin1String("OS X ") + QLatin1String(name)
+ + QLatin1String(" (") + QString::number(version.major)
+ + QLatin1Char('.') + QString::number(version.minor)
+ + QLatin1Char(')');
+ } else {
+ return QLatin1String("OS X ")
+ + QString::number(version.major) + QLatin1Char('.')
+ + QString::number(version.minor);
}
- if (basename)
- return QLatin1String(basename) + productVersion() + QLatin1Char(')');
-
- // a future version of OS X
- return QLatin1String("OS X ") + productVersion();
#elif defined(Q_OS_WINPHONE)
return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());
#elif defined(Q_OS_WIN)
- return QLatin1String("Windows ") + QLatin1String(winVer_helper()) + winSp_helper();
+ const char *name = winVer_helper();
+ const OSVERSIONINFOEX osver = winOsVersion();
+ if (name)
+ return QLatin1String("Windows ") + QLatin1String(name) + winSp_helper()
+ + QLatin1String(" (") + QString::number(osver.dwMajorVersion)
+ + QLatin1Char('.') + QString::number(osver.dwMinorVersion)
+ + QLatin1Char(')');
+ else
+ return QLatin1String("Windows ")
+ + QString::number(osver.dwMajorVersion) + QLatin1Char('.')
+ + QString::number(osver.dwMinorVersion);
#elif defined(Q_OS_ANDROID)
return QLatin1String("Android ") + productVersion();
#elif defined(Q_OS_HAIKU)
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 118203f720..f9d7a1c43f 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -469,7 +469,7 @@ typedef qptrdiff qintptr;
# define QT_ASCII_CAST_WARN
#endif
-#if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE)
+#if defined(__i386__) || defined(_WIN32)
# if defined(Q_CC_GNU)
# define QT_FASTCALL __attribute__((regparm(3)))
# elif defined(Q_CC_MSVC)
@@ -529,23 +529,11 @@ Q_DECL_CONSTEXPR inline int qRound(double d)
{ return d >= 0.0 ? int(d + 0.5) : int(d - double(int(d-1)) + 0.5) + int(d-1); }
Q_DECL_CONSTEXPR inline int qRound(float d)
{ return d >= 0.0f ? int(d + 0.5f) : int(d - float(int(d-1)) + 0.5f) + int(d-1); }
-#ifdef Q_QDOC
-/*
- Just for documentation generation
-*/
-int qRound(qreal d);
-#endif
Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - double(qint64(d-1)) + 0.5) + qint64(d-1); }
Q_DECL_CONSTEXPR inline qint64 qRound64(float d)
{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); }
-#ifdef Q_QDOC
-/*
- Just for documentation generation
-*/
-qint64 qRound64(qreal d);
-#endif
template <typename T>
Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
@@ -622,7 +610,7 @@ class QDataStream;
# define QT_NO_SOCKS5
#endif
-#if defined(Q_OS_IOS)
+#if defined(QT_PLATFORM_UIKIT)
# define QT_NO_PROCESS
#endif
@@ -1032,8 +1020,11 @@ Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
#ifdef Q_QDOC
// Just for documentation generation
+template<typename T>
auto qOverload(T functionPointer);
+template<typename T>
auto qConstOverload(T memberFunctionPointer);
+template<typename T>
auto qNonConstOverload(T memberFunctionPointer);
#elif defined(Q_COMPILER_VARIADIC_TEMPLATES)
diff --git a/src/corelib/global/qhooks.cpp b/src/corelib/global/qhooks.cpp
index b91ec64786..7b9a3db30d 100644
--- a/src/corelib/global/qhooks.cpp
+++ b/src/corelib/global/qhooks.cpp
@@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = {
// The required sizes and offsets are tested in tests/auto/other/toolsupport.
// When this fails and the change was intentional, adjust the test and
// adjust this value here.
- 5
+ 15
};
Q_STATIC_ASSERT(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0]));
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 458200180e..c31b6daa00 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -229,30 +229,30 @@ QLibraryInfo::QLibraryInfo()
{ }
/*!
- Returns the person to whom this build of Qt is licensed.
-
- \sa licensedProducts()
+ \deprecated
+ This function used to return the person to whom this build of Qt is licensed, now returns an empty string.
*/
+#if QT_DEPRECATED_SINCE(5, 8)
QString
QLibraryInfo::licensee()
{
- const char * volatile str = QT_CONFIGURE_LICENSEE;
- return QString::fromLocal8Bit(str);
+ return QString();
}
+#endif
/*!
- Returns the products that the license for this build of Qt has access to.
-
- \sa licensee()
+ \deprecated
+ This function used to return the products that the license for this build of Qt has access to, now returns an empty string.
*/
+#if QT_DEPRECATED_SINCE(5, 8)
QString
QLibraryInfo::licensedProducts()
{
- const char * volatile str = QT_CONFIGURE_LICENSED_PRODUCTS;
- return QString::fromLatin1(str);
+ return QString();
}
+#endif
/*!
\since 4.6
@@ -366,6 +366,19 @@ QLibraryInfo::isDebugBuild()
#endif
}
+#ifndef QT_BOOTSTRAPPED
+/*!
+ \since 5.8
+ Returns the version of the Qt library.
+
+ \sa qVersion()
+*/
+QVersionNumber QLibraryInfo::version() Q_DECL_NOTHROW
+{
+ return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
+}
+#endif // QT_BOOTSTRAPPED
+
#endif // QT_BUILD_QMAKE
/*
diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h
index 362d47dea3..55be706382 100644
--- a/src/corelib/global/qlibraryinfo.h
+++ b/src/corelib/global/qlibraryinfo.h
@@ -42,6 +42,7 @@
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
+#include <QtCore/qversionnumber.h>
QT_BEGIN_NAMESPACE
@@ -50,8 +51,10 @@ class QStringList;
class Q_CORE_EXPORT QLibraryInfo
{
public:
- static QString licensee();
- static QString licensedProducts();
+#if QT_DEPRECATED_SINCE(5, 8)
+ static QT_DEPRECATED QString licensee();
+ static QT_DEPRECATED QString licensedProducts();
+#endif
#ifndef QT_NO_DATESTRING
#if QT_DEPRECATED_SINCE(5, 5)
@@ -63,6 +66,10 @@ public:
static bool isDebugBuild();
+#ifndef QT_BOOTSTRAPPED
+ static QVersionNumber version() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION;
+#endif
+
enum LibraryLocation
{
PrefixPath = 0,
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index f2e293c45b..0fe095b8d3 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -170,7 +170,7 @@ static bool isFatal(QtMsgType msgType)
static bool willLogToConsole()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
// these systems have no stderr, so always log to the system log
return false;
#elif defined(QT_BOOTSTRAPPED)
@@ -1176,7 +1176,7 @@ void QMessagePattern::setPattern(const QString &pattern)
else if (inIf)
error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n");
if (!error.isEmpty()) {
-#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
if (0)
#elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 2a0b8461cd..edb568a2d6 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -301,12 +301,7 @@ public:
MacWindowToolBarButtonHint = 0x10000000,
BypassGraphicsProxyWidget = 0x20000000,
NoDropShadowWindowHint = 0x40000000,
- WindowFullscreenButtonHint = 0x80000000,
-
- // The following enums have overlapping values with other enums.
- // This was not intentional, but it's too late to change now.
- WindowOkButtonHint = 0x00080000, // WindowTransparentForInput
- WindowCancelButtonHint = 0x00100000 // WindowOverridesSystemGestures
+ WindowFullscreenButtonHint = 0x80000000
};
Q_DECLARE_FLAGS(WindowFlags, WindowType)
@@ -509,6 +504,7 @@ public:
AA_DontUseNativeDialogs = 23,
AA_SynthesizeMouseForUnhandledTabletEvents = 24,
AA_CompressHighFrequencyEvents = 25,
+ AA_DontCheckOpenGLContextThreadAffinity = 26,
// Add new attributes before this line
AA_AttributeCount
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 3c53a23896..d8a0acabf1 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -250,6 +250,13 @@
If your application needs to handle all events with no compression,
you can unset this attribute. This value has been added in Qt 5.7.
+ \value AA_DontCheckOpenGLContextThreadAffinity When making a context
+ current using QOpenGLContext, do not check that the
+ \l{QObject#Thread Affinity}{QObject thread affinity}
+ of the QOpenGLContext object is the same thread calling
+ \l{QOpenGLContext::makeCurrent}{makeCurrent()}. This value has been
+ added in Qt 5.8.
+
The following values are obsolete:
\value AA_ImmediateWidgetCreation This attribute is no longer fully
@@ -753,27 +760,25 @@
\value MonoOnly The pixmap becomes monochrome. If necessary,
it is dithered using the chosen dithering algorithm.
- Dithering mode preference for RGB channels:
+ Dithering mode preference:
- \value DiffuseDither (default) - A high-quality dither.
- \value OrderedDither A faster, more ordered dither.
+ \value DiffuseDither (default) - A high-quality dither using error diffusion.
+ \value OrderedDither A faster, ordered dither.
\value ThresholdDither No dithering; closest color is used.
- Dithering mode preference for alpha channel:
+ Dithering mode preference for 1-bit alpha masks:
\value ThresholdAlphaDither (default) - No dithering.
- \value OrderedAlphaDither A faster, more ordered dither.
- \value DiffuseAlphaDither A high-quality dither.
+ \value OrderedAlphaDither A faster, ordered dither.
+ \value DiffuseAlphaDither A high-quality dither using error diffusion.
\omitvalue NoAlpha
Color matching versus dithering preference:
- \value PreferDither (default when converting to a pixmap) - Always dither
- 32-bit images when the image is converted to 8 bits.
- \value AvoidDither (default when converting for the purpose of saving to
- file) - Dither 32-bit images only if the image has more than 256
- colors and it is being converted to 8 bits.
- \omitvalue AutoDither
+ \value PreferDither Always dither images when converting to smaller color-spaces.
+ \value AvoidDither Only dither to indexed formats if the source image uses more
+ different colors than the size of the color table of the destination format.
+ \value AutoDither (default) - Only dither when down-converting to 1 or 8-bit indexed formats.
\omitvalue ColorMode_Mask
\omitvalue Dither_Mask
@@ -2221,12 +2226,6 @@
the bottom. This window hint is currently not implemented
for OS X.
- \value WindowOkButtonHint Adds an OK button to the window decoration of a dialog.
- Only supported for Windows CE.
-
- \value WindowCancelButtonHint Adds a Cancel button to the window decoration of a dialog.
- Only supported for Windows CE.
-
\value WindowTransparentForInput Informs the window system that this window
is used only for output (displaying something) and does not take input.
Therefore input events should pass through as if it wasn't there.
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 5705bc29c8..b7f7d5187c 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -56,7 +56,7 @@
#include <cmath>
#include <limits>
-#if defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)
+#if defined(Q_CC_MSVC)
# include <intrin.h>
#elif defined(Q_CC_INTEL)
# include <immintrin.h> // for _addcarry_u<nn>
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 6ecd41bc30..566d76d3d2 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -334,7 +334,7 @@
# elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN)
# define Q_BYTE_ORDER Q_BIG_ENDIAN
# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) \
- || defined(_WIN32_WCE) || defined(WINAPI_FAMILY) // Windows CE is always little-endian according to MSDN.
+ || defined(WINAPI_FAMILY) // WinRT is always little-endian according to MSDN.
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# else
# error "Unable to determine byte order!"
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index b74fc80468..143e00a4c3 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -69,7 +69,7 @@ public:
LittleEndian
# ifdef Q_QDOC
- , ByteOrder = <platform-dependent>
+ , ByteOrder = BigEndian or LittleEndian
# elif Q_BYTE_ORDER == Q_BIG_ENDIAN
, ByteOrder = BigEndian
# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN
@@ -109,13 +109,7 @@ public:
WV_6_1 = WV_WINDOWS7,
WV_6_2 = WV_WINDOWS8,
WV_6_3 = WV_WINDOWS8_1,
- WV_10_0 = WV_WINDOWS10,
-
- WV_CE = 0x0100,
- WV_CENET = 0x0200,
- WV_CE_5 = 0x0300,
- WV_CE_6 = 0x0400,
- WV_CE_based = 0x0f00
+ WV_10_0 = WV_WINDOWS10
};
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
static const WinVersion WindowsVersion;
@@ -127,6 +121,7 @@ public:
#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0))
#define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor)
+#define Q_MV_TVOS(major, minor) (QSysInfo::MV_TVOS | major << 4 | minor)
enum MacVersion {
MV_None = 0xffff,
MV_Unknown = 0x0000,
@@ -174,7 +169,12 @@ public:
MV_IOS_8_2 = Q_MV_IOS(8, 2),
MV_IOS_8_3 = Q_MV_IOS(8, 3),
MV_IOS_8_4 = Q_MV_IOS(8, 4),
- MV_IOS_9_0 = Q_MV_IOS(9, 0)
+ MV_IOS_9_0 = Q_MV_IOS(9, 0),
+
+ /* tvOS */
+ MV_TVOS = 1 << 9,
+ MV_TVOS_9_0 = Q_MV_TVOS(9, 0),
+ MV_TVOS_9_1 = Q_MV_TVOS(9, 1)
};
#if defined(Q_OS_MAC)
static const MacVersion MacintoshVersion;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 1e95d1a2ec..ccf5851d18 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -56,7 +56,6 @@
OS2 - OS/2
OS2EMX - XFree86 on OS/2 (not PM)
WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
- WINCE - WinCE (Windows CE 5.0)
WINRT - WinRT (Windows 8 Runtime)
CYGWIN - Cygwin
SOLARIS - Sun Solaris
@@ -103,14 +102,17 @@
# define Q_OS_DARWIN32
# endif
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
-# if defined(TARGET_OS_TV) && TARGET_OS_TV
-# define Q_OS_TVOS
-# elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
+# if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
# define Q_OS_WATCHOS
# else
-# // TARGET_OS_IOS is only available in newer SDKs,
-# // so assume any other iOS-based platform is iOS for now
-# define Q_OS_IOS
+# define QT_PLATFORM_UIKIT
+# if defined(TARGET_OS_TV) && TARGET_OS_TV
+# define Q_OS_TVOS
+# else
+# // TARGET_OS_IOS is only available in newer SDKs,
+# // so assume any other iOS-based platform is iOS for now
+# define Q_OS_IOS
+# endif
# endif
# else
# // there is no "real" OS X define (rdar://22640089),
@@ -129,9 +131,7 @@
# define Q_OS_WIN32
# define Q_OS_WIN64
#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
-# if defined(WINCE) || defined(_WIN32_WCE)
-# define Q_OS_WINCE
-# elif defined(WINAPI_FAMILY)
+# if defined(WINAPI_FAMILY)
# ifndef WINAPI_FAMILY_PC_APP
# define WINAPI_FAMILY_PC_APP WINAPI_FAMILY_APP
# endif
@@ -209,7 +209,7 @@
# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
#endif
-#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINRT)
# define Q_OS_WIN
#endif
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 8ac3c2135d..7b95501c08 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -48,10 +48,10 @@
#if defined(Q_CC_MINGW)
// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
# ifndef WINVER
-# define WINVER 0x501
+# define WINVER 0x600
# endif
# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
+# define _WIN32_WINNT 0x600
# endif
#endif
@@ -67,10 +67,6 @@
# define _WIN32_IE 0x0501
#endif
-#ifdef _WIN32_WCE
-#include <ceconfig.h>
-#endif
-
// already defined when compiled with WINVER >= 0x0500
#ifndef SPI_SETMENUANIMATION
#define SPI_SETMENUANIMATION 0x1003
@@ -144,13 +140,4 @@
#define CLEARTYPE_QUALITY 5
#endif
-#ifdef Q_OS_WINCE
-#ifndef LR_DEFAULTSIZE
-#define LR_DEFAULTSIZE 0
-#endif
-#ifndef LR_SHARED
-#define LR_SHARED 0
-#endif
-#endif // Q_OS_WINCE
-
#endif // QT_WINDOWS_H
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 1cb2909c2a..ab345e9aae 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -106,25 +106,21 @@ win32 {
SOURCES += io/qfilesystemiterator_win.cpp
!winrt {
- SOURCES += io/qsettings_win.cpp
- SOURCES += io/qstandardpaths_win.cpp
+ HEADERS += \
+ io/qwindowspipereader_p.h \
+ io/qwindowspipewriter_p.h \
+ io/qwinoverlappedionotifier_p.h
- wince* {
- SOURCES += io/qprocess_wince.cpp \
- io/qstorageinfo_stub.cpp
- } else {
- HEADERS += \
- io/qwinoverlappedionotifier_p.h \
- io/qwindowspipereader_p.h \
- io/qwindowspipewriter_p.h
- SOURCES += \
- io/qprocess_win.cpp \
- io/qwinoverlappedionotifier.cpp \
- io/qwindowspipereader.cpp \
- io/qwindowspipewriter.cpp \
- io/qstorageinfo_win.cpp
- LIBS += -lmpr
- }
+ SOURCES += \
+ io/qprocess_win.cpp \
+ io/qsettings_win.cpp \
+ io/qstandardpaths_win.cpp \
+ io/qstorageinfo_win.cpp \
+ io/qwindowspipereader.cpp \
+ io/qwindowspipewriter.cpp \
+ io/qwinoverlappedionotifier.cpp
+
+ LIBS += -lmpr
} else {
SOURCES += \
io/qstandardpaths_winrt.cpp \
@@ -139,7 +135,7 @@ win32 {
io/qprocess_unix.cpp \
io/qfilesystemiterator_unix.cpp
- !integrity {
+ !integrity:!tvos {
SOURCES += io/forkfd_qt.cpp
HEADERS += \
../3rdparty/forkfd/forkfd.h
@@ -147,7 +143,6 @@ win32 {
}
!nacl:mac: {
SOURCES += io/qsettings_mac.cpp
- OBJECTIVE_SOURCES += io/qurl_mac.mm
}
mac {
SOURCES += io/qstorageinfo_mac.cpp
@@ -156,7 +151,7 @@ win32 {
OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm
HEADERS += io/qfilesystemwatcher_fsevents_p.h
LIBS += -framework DiskArbitration -framework IOKit
- } else:ios {
+ } else {
LIBS += -framework MobileCoreServices
}
} else:android {
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index e0a9cccdad..c7f8840a82 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -91,10 +91,11 @@ public:
Qt_5_5 = Qt_5_4,
Qt_5_6 = 17,
Qt_5_7 = Qt_5_6,
-#if QT_VERSION >= 0x050800
+ Qt_5_8 = Qt_5_7,
+#if QT_VERSION >= 0x050900
#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion
#endif
- Qt_DefaultCompiledVersion = Qt_5_7
+ Qt_DefaultCompiledVersion = Qt_5_8
};
enum ByteOrder {
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 9efe2fb90e..af07b52cdb 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -2187,7 +2187,7 @@ QString QDir::cleanPath(const QString &path)
name.replace(dir_separator, QLatin1Char('/'));
bool allowUncPaths = false;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) //allow unc paths
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //allow unc paths
allowUncPaths = true;
#endif
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 4ac12fc9ea..f0db3d1ae3 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -55,8 +55,6 @@ QT_BEGIN_NAMESPACE
//Environment variable to allow tooling full control of file selectors
static const char env_override[] = "QT_NO_BUILTIN_SELECTORS";
-static const ushort selectorIndicator = '+';
-
Q_GLOBAL_STATIC(QFileSelectorSharedData, sharedData);
static QBasicMutex sharedDataMutex;
@@ -267,7 +265,7 @@ QUrl QFileSelector::select(const QUrl &filePath) const
return ret;
}
-static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors)
+QString QFileSelectorPrivate::selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors, const QChar &indicator)
{
/* selectionHelper does a depth-first search of possible selected files. Because there is strict
selector ordering in the API, we can stop checking as soon as we find the file in a directory
@@ -276,12 +274,15 @@ static QString selectionHelper(const QString &path, const QString &fileName, con
Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/')));
for (const QString &s : selectors) {
- QString prospectiveBase = path + QLatin1Char(selectorIndicator) + s + QLatin1Char('/');
+ QString prospectiveBase = path;
+ if (!indicator.isNull())
+ prospectiveBase += indicator;
+ prospectiveBase += s + QLatin1Char('/');
QStringList remainingSelectors = selectors;
remainingSelectors.removeAll(s);
if (!QDir(prospectiveBase).exists())
continue;
- QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors);
+ QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors, indicator);
if (!prospectiveFile.isEmpty())
return prospectiveFile;
}
@@ -369,7 +370,7 @@ QStringList QFileSelectorPrivate::platformSelectors()
#if defined(Q_OS_WIN)
// can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case
ret << QStringLiteral("windows");
- ret << QSysInfo::kernelType(); // "wince" and "winnt"
+ ret << QSysInfo::kernelType(); // "winnt"
# if defined(Q_OS_WINRT)
ret << QStringLiteral("winrt");
# if defined(Q_OS_WINPHONE)
diff --git a/src/corelib/io/qfileselector_p.h b/src/corelib/io/qfileselector_p.h
index f93eb0ccb3..024d0b190d 100644
--- a/src/corelib/io/qfileselector_p.h
+++ b/src/corelib/io/qfileselector_p.h
@@ -70,6 +70,8 @@ public:
static void updateSelectors();
static QStringList platformSelectors();
static void addStatics(const QStringList &); //For loading GUI statics from other Qt modules
+ static QString selectionHelper(const QString &path, const QString &fileName,
+ const QStringList &selectors, const QChar &indicator = QLatin1Char('+'));
QFileSelectorPrivate();
QString select(const QString &filePath) const;
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index 75797e58da..eebe5f1f94 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -61,7 +61,7 @@
#include <CoreServices/CoreServices.h>
#endif
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
#include <MobileCoreServices/MobileCoreServices.h>
#endif
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 85c795fadd..8375dc9b1b 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -53,13 +53,9 @@
#include "qdatetime.h"
#include "qt_windows.h"
-#if !defined(Q_OS_WINCE)
-# include <sys/types.h>
-# include <direct.h>
-# include <winioctl.h>
-#else
-# include <types.h>
-#endif
+#include <sys/types.h>
+#include <direct.h>
+#include <winioctl.h>
#include <objbase.h>
#ifndef Q_OS_WINRT
# include <shlobj.h>
@@ -116,8 +112,7 @@ typedef INT_PTR intptr_t;
# define INVALID_FILE_ATTRIBUTES (DWORD (-1))
#endif
-#if !defined(Q_OS_WINCE)
-# if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
+#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
USHORT ReparseDataLength;
@@ -143,32 +138,31 @@ typedef struct _REPARSE_DATA_BUFFER {
} GenericReparseBuffer;
};
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
-# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
-# endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
+# define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
+#endif // !defined(REPARSE_DATA_BUFFER_HEADER_SIZE)
-# ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
-# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
-# endif
-# ifndef IO_REPARSE_TAG_SYMLINK
-# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
-# endif
-# ifndef FSCTL_GET_REPARSE_POINT
-# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
-# endif
-#endif // !defined(Q_OS_WINCE)
+#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
+# define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
+#endif
+#ifndef IO_REPARSE_TAG_SYMLINK
+# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
+#endif
+#ifndef FSCTL_GET_REPARSE_POINT
+# define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#endif
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0;
-#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
static QString qfsPrivateCurrentDir = QLatin1String("");
-// As none of the functions we try to resolve do exist on Windows CE
+// As none of the functions we try to resolve do exist on WinRT
// we use QT_NO_LIBRARY to shorten everything up a little bit.
-#ifndef QT_NO_LIBRARY
-#define QT_NO_LIBRARY 1
-#endif
-#endif
+# ifndef QT_NO_LIBRARY
+# define QT_NO_LIBRARY 1
+# endif
+#endif // Q_OS_WINRT
#if !defined(QT_NO_LIBRARY)
QT_BEGIN_INCLUDE_NAMESPACE
@@ -182,8 +176,6 @@ typedef DWORD (WINAPI *PtrGetEffectiveRightsFromAclW)(PACL, PTRUSTEE_W, OUT PACC
static PtrGetEffectiveRightsFromAclW ptrGetEffectiveRightsFromAclW = 0;
typedef BOOL (WINAPI *PtrGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD);
static PtrGetUserProfileDirectoryW ptrGetUserProfileDirectoryW = 0;
-typedef BOOL (WINAPI *PtrGetVolumePathNamesForVolumeNameW)(LPCWSTR,LPWSTR,DWORD,PDWORD);
-static PtrGetVolumePathNamesForVolumeNameW ptrGetVolumePathNamesForVolumeNameW = 0;
QT_END_INCLUDE_NAMESPACE
static TRUSTEE_W currentUserTrusteeW;
@@ -233,7 +225,6 @@ static void resolveLibs()
#endif
triedResolve = true;
-#if !defined(Q_OS_WINCE)
HINSTANCE advapiHnd = QSystemLibrary::load(L"advapi32");
if (advapiHnd) {
ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW");
@@ -279,10 +270,6 @@ static void resolveLibs()
HINSTANCE userenvHnd = QSystemLibrary::load(L"userenv");
if (userenvHnd)
ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW");
- HINSTANCE kernel32 = LoadLibrary(L"kernel32");
- if(kernel32)
- ptrGetVolumePathNamesForVolumeNameW = (PtrGetVolumePathNamesForVolumeNameW)GetProcAddress(kernel32, "GetVolumePathNamesForVolumeNameW");
-#endif
}
}
#endif // QT_NO_LIBRARY
@@ -309,14 +296,14 @@ static bool resolveUNCLibs()
}
#endif
triedResolve = true;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
HINSTANCE hLib = QSystemLibrary::load(L"Netapi32");
if (hLib) {
ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum");
if (ptrNetShareEnum)
ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree");
}
-#endif // !Q_OS_WINCE && !Q_OS_WINRT
+#endif // !Q_OS_WINRT
}
return ptrNetShareEnum && ptrNetApiBufferFree;
}
@@ -324,7 +311,7 @@ static bool resolveUNCLibs()
static QString readSymLink(const QFileSystemEntry &link)
{
QString result;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
HANDLE handle = CreateFile((wchar_t*)link.nativeFilePath().utf16(),
FILE_READ_EA,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -357,27 +344,24 @@ static QString readSymLink(const QFileSystemEntry &link)
#if !defined(QT_NO_LIBRARY)
resolveLibs();
- if (ptrGetVolumePathNamesForVolumeNameW) {
- QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive);
- if(matchVolName.indexIn(result) == 0) {
- DWORD len;
- wchar_t buffer[MAX_PATH];
- QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\"));
- if(ptrGetVolumePathNamesForVolumeNameW((wchar_t*)volumeName.utf16(), buffer, MAX_PATH, &len) != 0)
- result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
- }
+ QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive);
+ if (matchVolName.indexIn(result) == 0) {
+ DWORD len;
+ wchar_t buffer[MAX_PATH];
+ QString volumeName = result.mid(0, matchVolName.matchedLength()).prepend(QLatin1String("\\\\?\\"));
+ if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()), buffer, MAX_PATH, &len) != 0)
+ result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer));
}
-#endif // !Q_OS_WINCE && !Q_OS_WINRT
+#endif // !Q_OS_WINRT
}
#else
Q_UNUSED(link);
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINRT
return result;
}
static QString readLink(const QFileSystemEntry &link)
{
-#if !defined(Q_OS_WINCE)
#if !defined(QT_NO_LIBRARY)
QString ret;
@@ -418,21 +402,6 @@ static QString readLink(const QFileSystemEntry &link)
Q_UNUSED(link);
return QString();
#endif // QT_NO_LIBRARY
-#elif !defined(QT_NO_WINCE_SHELLSDK)
- wchar_t target[MAX_PATH];
- QString result;
- if (SHGetShortcutTarget((wchar_t*)QFileInfo(link.filePath()).absoluteFilePath().replace(QLatin1Char('/'),QLatin1Char('\\')).utf16(), target, MAX_PATH)) {
- result = QString::fromWCharArray(target);
- if (result.startsWith(QLatin1Char('"')))
- result.remove(0,1);
- if (result.endsWith(QLatin1Char('"')))
- result.remove(result.size()-1,1);
- }
- return result;
-#else // QT_NO_WINCE_SHELLSDK
- Q_UNUSED(link);
- return QString();
-#endif // Q_OS_WINCE
}
static bool uncShareExists(const QString &server)
@@ -533,7 +502,7 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path)
{
// can be //server or //server/share
QString absPath;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
+#if !defined(Q_OS_WINRT_WIN81)
QVarLengthArray<wchar_t, MAX_PATH> buf(qMax(MAX_PATH, path.size() + 1));
wchar_t *fileName = 0;
DWORD retLen = GetFullPathName((wchar_t*)path.utf16(), buf.size(), buf.data(), &fileName);
@@ -553,17 +522,12 @@ QString QFileSystemEngine::nativeAbsoluteFilePath(const QString &path)
if (absPath.size() < rootPath.size() && rootPath.startsWith(absPath))
absPath = rootPath;
# endif // Q_OS_WINRT
-#elif !defined(Q_OS_WINCE)
+#else // !Q_OS_WINRT_WIN81
if (QDir::isRelativePath(path))
absPath = QDir::toNativeSeparators(QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + path));
else
absPath = QDir::toNativeSeparators(QDir::cleanPath(path));
-#else // Q_OS_WINRT
- if (path.startsWith(QLatin1Char('/')) || path.startsWith(QLatin1Char('\\')))
- absPath = QDir::toNativeSeparators(path);
- else
- absPath = QDir::toNativeSeparators(QDir::cleanPath(qfsPrivateCurrentDir + QLatin1Char('/') + path));
-#endif // Q_OS_WINCE
+#endif // Q_OS_WINRT_WIN81
// This is really ugly, but GetFullPathName strips off whitespace at the end.
// If you for instance write ". " in the lineedit of QFileDialog,
// (which is an invalid filename) this function will strip the space off and viola,
@@ -580,15 +544,10 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
QString ret;
if (!entry.isRelative()) {
-#if !defined(Q_OS_WINCE)
- if (entry.isAbsolute() && entry.isClean()) {
+ if (entry.isAbsolute() && entry.isClean())
ret = entry.filePath();
- } else {
+ else
ret = QDir::fromNativeSeparators(nativeAbsoluteFilePath(entry.filePath()));
- }
-#else
- ret = entry.filePath();
-#endif
} else {
#ifndef Q_OS_WINRT_WIN81
ret = QDir::cleanPath(QDir::currentPath() + QLatin1Char('/') + entry.filePath());
@@ -617,25 +576,14 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath());
}
-#ifndef Q_OS_WINCE
-
-// FILE_INFO_BY_HANDLE_CLASS has been extended by FileIdInfo = 18 as of VS2012.
-typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS;
-
-# if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601))
-
-// MinGW-64 defines FILE_ID_128 as of gcc-4.8.1 along with FILE_SUPPORTS_INTEGRITY_STREAMS
-# if !(defined(Q_CC_MINGW) && defined(FILE_SUPPORTS_INTEGRITY_STREAMS))
-typedef struct _FILE_ID_128 {
- BYTE Identifier[16];
-} FILE_ID_128, *PFILE_ID_128;
-# endif // !(Q_CC_MINGW && FILE_SUPPORTS_INTEGRITY_STREAMS)
+#if defined(Q_CC_MINGW) && WINVER < 0x0602 // Windows 8 onwards
typedef struct _FILE_ID_INFO {
ULONGLONG VolumeSerialNumber;
FILE_ID_128 FileId;
} FILE_ID_INFO, *PFILE_ID_INFO;
-# endif // if defined (Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601))
+
+#endif // if defined (Q_CC_MINGW) && WINVER < 0x0602
// File ID for Windows up to version 7.
static inline QByteArray fileId(HANDLE handle)
@@ -658,44 +606,26 @@ static inline QByteArray fileId(HANDLE handle)
// File ID for Windows starting from version 8.
QByteArray fileIdWin8(HANDLE handle)
{
-#ifndef Q_OS_WINRT
- typedef BOOL (WINAPI* GetFileInformationByHandleExType)(HANDLE, Q_FILE_INFO_BY_HANDLE_CLASS, void *, DWORD);
-
- // Dynamically resolve GetFileInformationByHandleEx (Vista onwards).
- static GetFileInformationByHandleExType getFileInformationByHandleEx = 0;
- if (!getFileInformationByHandleEx) {
- QSystemLibrary library(QLatin1String("kernel32"));
- getFileInformationByHandleEx = (GetFileInformationByHandleExType)library.resolve("GetFileInformationByHandleEx");
- }
- QByteArray result;
- if (getFileInformationByHandleEx) {
- FILE_ID_INFO infoEx;
- if (getFileInformationByHandleEx(handle, Q_FileIdInfo,
- &infoEx, sizeof(FILE_ID_INFO))) {
- result = QByteArray::number(infoEx.VolumeSerialNumber, 16);
- result += ':';
- // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
- result += QByteArray((char *)&infoEx.FileId, sizeof(infoEx.FileId)).toHex();
- }
- }
-#else // !Q_OS_WINRT
+#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)
QByteArray result;
FILE_ID_INFO infoEx;
- if (GetFileInformationByHandleEx(handle, FileIdInfo,
+ if (GetFileInformationByHandleEx(handle,
+ static_cast<FILE_INFO_BY_HANDLE_CLASS>(18), // FileIdInfo in Windows 8
&infoEx, sizeof(FILE_ID_INFO))) {
result = QByteArray::number(infoEx.VolumeSerialNumber, 16);
result += ':';
- result += QByteArray((char *)infoEx.FileId.Identifier, sizeof(infoEx.FileId.Identifier)).toHex();
+ // Note: MinGW-64's definition of FILE_ID_128 differs from the MSVC one.
+ result += QByteArray(reinterpret_cast<const char *>(&infoEx.FileId), int(sizeof(infoEx.FileId))).toHex();
}
-#endif // Q_OS_WINRT
return result;
+#else // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE
+ return fileId(handle);
+#endif
}
-#endif // !Q_OS_WINCE
//static
QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
{
-#ifndef Q_OS_WINCE
QByteArray result;
const HANDLE handle =
#ifndef Q_OS_WINRT
@@ -711,9 +641,6 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
CloseHandle(handle);
}
return result;
-#else // !Q_OS_WINCE
- return entry.nativeFilePath().toLower().toLatin1();
-#endif
}
//static
@@ -882,7 +809,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
{
bool entryExists = false;
DWORD fileAttrib = 0;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
if (fname.isDriveRoot()) {
// a valid drive ??
const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
@@ -925,7 +852,7 @@ static bool tryDriveUNCFallback(const QFileSystemEntry &fname, QFileSystemMetaDa
fileAttrib = FILE_ATTRIBUTE_DIRECTORY;
entryExists = true;
}
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
}
#endif
if (entryExists)
@@ -949,7 +876,6 @@ static bool tryFindFallback(const QFileSystemEntry &fname, QFileSystemMetaData &
return filledData;
}
-#if !defined(Q_OS_WINCE)
//static
bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what)
@@ -960,7 +886,6 @@ bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data,
}
return false;
}
-#endif
//static
bool QFileSystemEngine::fillMetaData(HANDLE fHandle, QFileSystemMetaData &data,
@@ -1069,25 +994,6 @@ static inline bool mkDir(const QString &path, DWORD *lastError = 0)
{
if (lastError)
*lastError = 0;
-#if defined(Q_OS_WINCE)
- // Unfortunately CreateDirectory returns true for paths longer than
- // 256, but does not create a directory. It starts to fail, when
- // path length > MAX_PATH, which is 260 usually on CE.
- // This only happens on a Windows Mobile device. Windows CE seems
- // not to be affected by this.
- static int platformId = 0;
- if (platformId == 0) {
- wchar_t platformString[64];
- if (SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(platformString)/sizeof(*platformString),platformString,0)) {
- if (0 == wcscmp(platformString, L"PocketPC") || 0 == wcscmp(platformString, L"Smartphone"))
- platformId = 1;
- else
- platformId = 2;
- }
- }
- if (platformId == 1 && QFSFileEnginePrivate::longFileName(path).size() > 256)
- return false;
-#endif
const QString longPath = QFSFileEnginePrivate::longFileName(path);
const bool result = ::CreateDirectory((wchar_t*)longPath.utf16(), 0);
if (lastError) // Capture lastError before any QString is freed since custom allocators might change it.
@@ -1217,9 +1123,7 @@ bool QFileSystemEngine::removeDirectory(const QFileSystemEntry &entry, bool remo
//static
QString QFileSystemEngine::rootPath()
{
-#if defined(Q_OS_WINCE)
- QString ret = QLatin1String("/");
-#elif defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
// We specify the package root as root directory
QString ret = QLatin1String("/");
// Get package location
@@ -1285,13 +1189,8 @@ QString QFileSystemEngine::homePath()
+ QString::fromLocal8Bit(qgetenv("HOMEPATH"));
if (ret.isEmpty() || !QFile::exists(ret)) {
ret = QString::fromLocal8Bit(qgetenv("HOME"));
- if (ret.isEmpty() || !QFile::exists(ret)) {
-#if defined(Q_OS_WINCE)
- ret = QLatin1String("\\My Documents");
- if (!QFile::exists(ret))
-#endif
- ret = rootPath();
- }
+ if (ret.isEmpty() || !QFile::exists(ret))
+ ret = rootPath();
}
}
}
@@ -1304,10 +1203,6 @@ QString QFileSystemEngine::tempPath()
#ifndef Q_OS_WINRT
wchar_t tempPath[MAX_PATH];
const DWORD len = GetTempPath(MAX_PATH, tempPath);
-#ifdef Q_OS_WINCE
- if (len)
- ret = QString::fromWCharArray(tempPath, len);
-#else // Q_OS_WINCE
if (len) { // GetTempPath() can return short names, expand.
wchar_t longTempPath[MAX_PATH];
const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH);
@@ -1315,7 +1210,6 @@ QString QFileSystemEngine::tempPath()
QString::fromWCharArray(longTempPath, longLen) :
QString::fromWCharArray(tempPath, len);
}
-#endif // !Q_OS_WINCE
if (!ret.isEmpty()) {
while (ret.endsWith(QLatin1Char('\\')))
ret.chop(1);
@@ -1343,11 +1237,7 @@ QString QFileSystemEngine::tempPath()
ret = QDir::fromNativeSeparators(QString::fromWCharArray(path.GetRawBuffer(nullptr)));
#endif // Q_OS_WINRT
if (ret.isEmpty()) {
-#if !defined(Q_OS_WINCE)
ret = QLatin1String("C:/tmp");
-#else
- ret = QLatin1String("/Temp");
-#endif
} else if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
return ret;
@@ -1360,7 +1250,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
if(!(meta.exists() && meta.isDirectory()))
return false;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
+#if !defined(Q_OS_WINRT_WIN81)
//TODO: this should really be using nativeFilePath(), but that returns a path in long format \\?\c:\foo
//which causes many problems later on when it's returned through currentPath()
return ::SetCurrentDirectory(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(entry.filePath()).utf16())) != 0;
@@ -1373,7 +1263,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry)
QFileSystemEntry QFileSystemEngine::currentPath()
{
QString ret;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT_WIN81)
+#if !defined(Q_OS_WINRT_WIN81)
DWORD size = 0;
wchar_t currentName[PATH_MAX];
size = ::GetCurrentDirectory(PATH_MAX, currentName);
@@ -1389,17 +1279,13 @@ QFileSystemEntry QFileSystemEngine::currentPath()
}
if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
-#else // !Q_OS_WINCE && !Q_OS_WINRT_WIN81
+#else // !Q_OS_WINRT_WIN81
//TODO - a race condition exists when using currentPath / setCurrentPath from multiple threads
if (qfsPrivateCurrentDir.isEmpty())
-#ifndef Q_OS_WINRT_WIN81
- qfsPrivateCurrentDir = QCoreApplication::applicationDirPath();
-#else
qfsPrivateCurrentDir = QDir::rootPath();
-#endif
ret = qfsPrivateCurrentDir;
-#endif // Q_OS_WINCE || Q_OS_WINRT_WIN81
+#endif // Q_OS_WINRT_WIN81
return QFileSystemEntry(ret, QFileSystemEntry::FromNativePath());
}
@@ -1482,31 +1368,11 @@ static inline QDateTime fileTimeToQDateTime(const FILETIME *time)
{
QDateTime ret;
-#if defined(Q_OS_WINCE)
- SYSTEMTIME systime;
- FILETIME ftime;
- systime.wYear = 1970;
- systime.wMonth = 1;
- systime.wDay = 1;
- systime.wHour = 0;
- systime.wMinute = 0;
- systime.wSecond = 0;
- systime.wMilliseconds = 0;
- systime.wDayOfWeek = 4;
- SystemTimeToFileTime(&systime, &ftime);
- unsigned __int64 acttime = (unsigned __int64)time->dwHighDateTime << 32 | time->dwLowDateTime;
- FileTimeToSystemTime(time, &systime);
- unsigned __int64 time1970 = (unsigned __int64)ftime.dwHighDateTime << 32 | ftime.dwLowDateTime;
- unsigned __int64 difftime = acttime - time1970;
- difftime /= 10000000;
- ret.setTime_t((unsigned int)difftime);
-#else
SYSTEMTIME sTime, lTime;
FileTimeToSystemTime(time, &sTime);
SystemTimeToTzSpecificLocalTime(0, &sTime, &lTime);
ret.setDate(QDate(lTime.wYear, lTime.wMonth, lTime.wDay));
ret.setTime(QTime(lTime.wHour, lTime.wMinute, lTime.wSecond, lTime.wMilliseconds));
-#endif
return ret;
}
diff --git a/src/corelib/io/qfilesystemiterator_win.cpp b/src/corelib/io/qfilesystemiterator_win.cpp
index ba195b2330..9e40a41b4c 100644
--- a/src/corelib/io/qfilesystemiterator_win.cpp
+++ b/src/corelib/io/qfilesystemiterator_win.cpp
@@ -92,12 +92,10 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
haveData = true;
int infoLevel = 0 ; // FindExInfoStandard;
DWORD dwAdditionalFlags = 0;
-#ifndef Q_OS_WINCE
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
dwAdditionalFlags = 2; // FIND_FIRST_EX_LARGE_FETCH
infoLevel = 1 ; // FindExInfoBasic;
}
-#endif
int searchOps = 0; // FindExSearchNameMatch
if (onlyDirs)
searchOps = 1 ; // FindExSearchLimitToDirectories
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 7135c9b19b..b38188d357 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -331,13 +331,10 @@ inline void QFileSystemMetaData::fillFromFindData(WIN32_FIND_DATA &findData, boo
if (setLinkType) {
knownFlagsMask |= LinkType;
entryFlags &= ~LinkType;
-#if !defined(Q_OS_WINCE)
if ((fileAttribute_ & FILE_ATTRIBUTE_REPARSE_POINT)
&& (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) {
entryFlags |= LinkType;
}
-#endif
-
}
}
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index acea610625..55f4bddd17 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -58,7 +58,7 @@
# include "qfilesystemwatcher_win_p.h"
#elif defined(USE_INOTIFY)
# include "qfilesystemwatcher_inotify_p.h"
-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS)
+#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
# include "qfilesystemwatcher_kqueue_p.h"
#elif defined(Q_OS_OSX)
# include "qfilesystemwatcher_fsevents_p.h"
@@ -74,7 +74,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
// there is a chance that inotify may fail on Linux pre-2.6.13 (August
// 2005), so we can't just new inotify directly.
return QInotifyFileSystemWatcherEngine::create(parent);
-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_IOS)
+#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
return QKqueueFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_OSX)
return QFseventsFileSystemWatcherEngine::create(parent);
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index be9eef889a..beb8acb05f 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -198,7 +198,7 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
-#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_6
+#if defined(Q_OS_OSX)
Q_UNUSED(streamRef);
bool needsRestart = false;
@@ -256,12 +256,6 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
if (needsRestart)
emit scheduleStreamRestart();
#else
- // This is a work-around for moc: when we put the version check at the top of the header file,
- // moc will still see the Q_OBJECT macro and generate a meta-object when compiling for 10.6,
- // which obviously won't link.
- //
- // So the trick is to still compile this class on 10.6, but never instantiate it.
-
Q_UNUSED(streamRef);
Q_UNUSED(numEvents);
Q_UNUSED(eventPaths);
diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp
index e8b49db9f3..be56d8dd1d 100644
--- a/src/corelib/io/qfilesystemwatcher_win.cpp
+++ b/src/corelib/io/qfilesystemwatcher_win.cpp
@@ -86,13 +86,9 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QString path = it.next();
QString normalPath = path;
if ((normalPath.endsWith(QLatin1Char('/')) && !normalPath.endsWith(QLatin1String(":/")))
- || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))
-#ifdef Q_OS_WINCE
- && normalPath.size() > 1)
-#else
- )
-#endif
- normalPath.chop(1);
+ || (normalPath.endsWith(QLatin1Char('\\')) && !normalPath.endsWith(QLatin1String(":\\")))) {
+ normalPath.chop(1);
+ }
QFileInfo fileInfo(normalPath);
if (!fileInfo.exists())
continue;
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 2cda4d6bda..098bc49468 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -48,9 +48,7 @@
#ifndef QT_NO_FSFILEENGINE
-#if !defined(Q_OS_WINCE)
#include <errno.h>
-#endif
#if defined(Q_OS_UNIX)
#include "private/qcore_unix_p.h"
#endif
@@ -125,10 +123,8 @@ void QFSFileEnginePrivate::init()
{
is_sequential = 0;
tried_stat = 0;
-#if !defined(Q_OS_WINCE)
need_lstat = 1;
is_link = 0;
-#endif
openMode = QIODevice::NotOpen;
fd = -1;
fh = 0;
@@ -139,10 +135,8 @@ void QFSFileEnginePrivate::init()
fileAttrib = INVALID_FILE_ATTRIBUTES;
fileHandle = INVALID_HANDLE_VALUE;
mapHandle = NULL;
-#ifndef Q_OS_WINCE
cachedFd = -1;
#endif
-#endif
}
/*!
@@ -551,7 +545,7 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
} else {
// Unbuffered stdio mode.
if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) {
- qWarning() << "QFile::at: Cannot set file position" << pos;
+ qWarning("QFile::at: Cannot set file position %lld", pos);
q->setError(QFile::PositionError, qt_error_string(errno));
return false;
}
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index dd498a5bc5..593ecc2687 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -61,10 +61,6 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE_STD) && _WIN32_WCE < 0x600
-#define Q_USE_DEPRECATED_MAP_API 1
-#endif
-
class QFSFileEnginePrivate;
class Q_CORE_EXPORT QFSFileEngine : public QAbstractFileEngine
@@ -184,10 +180,7 @@ public:
HANDLE mapHandle;
QHash<uchar *, DWORD /* offset % AllocationGranularity */> maps;
-#ifndef Q_OS_WINCE
mutable int cachedFd;
-#endif
-
mutable DWORD fileAttrib;
#else
QHash<uchar *, QPair<int /*offset % PageSize*/, size_t /*length + offset % PageSize*/> > maps;
@@ -206,10 +199,8 @@ public:
mutable uint is_sequential : 2;
mutable uint tried_stat : 1;
-#if !defined(Q_OS_WINCE)
mutable uint need_lstat : 1;
mutable uint is_link : 1;
-#endif
#if defined(Q_OS_WIN)
bool doStat(QFileSystemMetaData::MetaDataFlags flags) const;
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index c37a690646..70c347978e 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -50,13 +50,9 @@
#include "qdatetime.h"
#include "qt_windows.h"
-#if !defined(Q_OS_WINCE)
-# include <sys/types.h>
-# include <direct.h>
-# include <winioctl.h>
-#else
-# include <types.h>
-#endif
+#include <sys/types.h>
+#include <direct.h>
+#include <winioctl.h>
#include <objbase.h>
#ifndef Q_OS_WINRT
# include <shlobj.h>
@@ -77,14 +73,12 @@
QT_BEGIN_NAMESPACE
-#if !defined(Q_OS_WINCE)
static inline bool isUncPath(const QString &path)
{
// Starts with \\, but not \\.
return (path.startsWith(QLatin1String("\\\\"))
&& path.size() > 2 && path.at(2) != QLatin1Char('.'));
}
-#endif
/*!
\internal
@@ -95,7 +89,7 @@ QString QFSFileEnginePrivate::longFileName(const QString &path)
return path;
QString absPath = QFileSystemEngine::nativeAbsoluteFilePath(path);
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
QString prefix = QLatin1String("\\\\?\\");
if (isUncPath(absPath)) {
prefix.append(QLatin1String("UNC\\")); // "\\\\?\\UNC\\"
@@ -171,7 +165,6 @@ bool QFSFileEnginePrivate::nativeClose()
// Windows native mode.
bool ok = true;
-#ifndef Q_OS_WINCE
if (cachedFd != -1) {
if (::_close(cachedFd) && !::CloseHandle(fileHandle)) {
q->setError(QFile::UnspecifiedError, qt_error_string());
@@ -184,7 +177,6 @@ bool QFSFileEnginePrivate::nativeClose()
return ok;
}
-#endif
if ((fileHandle == INVALID_HANDLE_VALUE || !::CloseHandle(fileHandle))) {
q->setError(QFile::UnspecifiedError, qt_error_string());
@@ -238,24 +230,6 @@ qint64 QFSFileEnginePrivate::nativeSize() const
// Always retrive the current information
metaData.clearFlags(QFileSystemMetaData::SizeAttribute);
-#if defined(Q_OS_WINCE)
- // Buffered stdlib mode.
- if (fh) {
- QT_OFF_T oldPos = QT_FTELL(fh);
- QT_FSEEK(fh, 0, SEEK_END);
- qint64 fileSize = (qint64)QT_FTELL(fh);
- QT_FSEEK(fh, oldPos, SEEK_SET);
- if (fileSize == -1) {
- fileSize = 0;
- thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno));
- }
- return fileSize;
- }
- if (fd != -1) {
- thatQ->setError(QFile::UnspecifiedError, QLatin1String("Not implemented!"));
- return 0;
- }
-#endif
bool filled = false;
if (fileHandle != INVALID_HANDLE_VALUE && openMode != QIODevice::NotOpen )
filled = QFileSystemEngine::fillMetaData(fileHandle, metaData,
@@ -287,7 +261,6 @@ qint64 QFSFileEnginePrivate::nativePos() const
if (fileHandle == INVALID_HANDLE_VALUE)
return 0;
-#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = 0;
@@ -297,18 +270,6 @@ qint64 QFSFileEnginePrivate::nativePos() const
}
return qint64(currentFilePos.QuadPart);
-#else
- LARGE_INTEGER filepos;
- filepos.HighPart = 0;
- DWORD newFilePointer = SetFilePointer(fileHandle, 0, &filepos.HighPart, FILE_CURRENT);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- thatQ->setError(QFile::UnspecifiedError, qt_error_string());
- return 0;
- }
-
- filepos.LowPart = newFilePointer;
- return filepos.QuadPart;
-#endif
}
/*
@@ -323,7 +284,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
return seekFdFh(pos);
}
-#if !defined(Q_OS_WINCE)
LARGE_INTEGER currentFilePos;
LARGE_INTEGER offset;
offset.QuadPart = pos;
@@ -333,17 +293,6 @@ bool QFSFileEnginePrivate::nativeSeek(qint64 pos)
}
return true;
-#else
- DWORD newFilePointer;
- LARGE_INTEGER *li = reinterpret_cast<LARGE_INTEGER*>(&pos);
- newFilePointer = SetFilePointer(fileHandle, li->LowPart, &li->HighPart, FILE_BEGIN);
- if (newFilePointer == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
- q->setError(QFile::PositionError, qt_error_string());
- return false;
- }
-
- return true;
-#endif
}
/*
@@ -462,7 +411,6 @@ int QFSFileEnginePrivate::nativeHandle() const
{
if (fh || fd != -1)
return fh ? QT_FILENO(fh) : fd;
-#ifndef Q_OS_WINCE
if (cachedFd != -1)
return cachedFd;
@@ -473,9 +421,6 @@ int QFSFileEnginePrivate::nativeHandle() const
flags |= _O_RDONLY;
cachedFd = _open_osfhandle((intptr_t) fileHandle, flags);
return cachedFd;
-#else
- return -1;
-#endif
}
/*
@@ -483,7 +428,7 @@ int QFSFileEnginePrivate::nativeHandle() const
*/
bool QFSFileEnginePrivate::nativeIsSequential() const
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
HANDLE handle = fileHandle;
if (fh || fd != -1)
handle = (HANDLE)_get_osfhandle(fh ? QT_FILENO(fh) : fd);
@@ -531,35 +476,9 @@ bool QFSFileEngine::rename(const QString &newName)
bool QFSFileEngine::renameOverwrite(const QString &newName)
{
Q_D(QFSFileEngine);
-#if defined(Q_OS_WINCE)
- // Windows Embedded Compact 7 does not have MoveFileEx, simulate it with the following sequence:
- // 1. DeleteAndRenameFile (Should work on RAM FS when both files exist)
- // 2. DeleteFile/MoveFile (Should work on all file systems)
- //
- // DeleteFile/MoveFile fallback implementation violates atomicity, but it is more acceptable than
- // alternative CopyFile/DeleteFile sequence for the following reasons:
- //
- // 1. DeleteFile/MoveFile is way faster than CopyFile/DeleteFile and thus more atomic.
- // 2. Given the intended use case of this function in QSaveFile, DeleteFile/MoveFile sequence will
- // delete the old content, but leave a file "filename.ext.XXXXXX" in the same directory if MoveFile fails.
- // With CopyFile/DeleteFile sequence, it can happen that new data is partially copied to target file
- // (because CopyFile is not atomic either), thus leaving *some* content to target file.
- // This makes the need for application level recovery harder to detect than in DeleteFile/MoveFile
- // sequence where target file simply does not exist.
- //
- bool ret = ::DeleteAndRenameFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(),
- (wchar_t*)d->fileEntry.nativeFilePath().utf16()) != 0;
- if (!ret) {
- ret = ::DeleteFile((wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
- if (ret || ::GetLastError() == ERROR_FILE_NOT_FOUND)
- ret = ::MoveFile((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
- (wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16()) != 0;
- }
-#else
bool ret = ::MoveFileEx((wchar_t*)d->fileEntry.nativeFilePath().utf16(),
(wchar_t*)QFileSystemEntry(newName).nativeFilePath().utf16(),
MOVEFILE_REPLACE_EXISTING) != 0;
-#endif
if (!ret)
setError(QFile::RenameError, QSystemError(::GetLastError(), QSystemError::NativeError).toString());
return ret;
@@ -587,7 +506,7 @@ bool QFSFileEngine::setCurrentPath(const QString &path)
QString QFSFileEngine::currentPath(const QString &fileName)
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
QString ret;
//if filename is a drive: then get the pwd of that drive
if (fileName.length() >= 2 &&
@@ -606,10 +525,10 @@ QString QFSFileEngine::currentPath(const QString &fileName)
if (ret.length() >= 2 && ret[1] == QLatin1Char(':'))
ret[0] = ret.at(0).toUpper(); // Force uppercase drive letters.
return ret;
-#else // !Q_OS_WINCE && !Q_OS_WINRT
+#else // !Q_OS_WINRT
Q_UNUSED(fileName);
return QFileSystemEngine::currentPath().filePath();
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINRT
}
QString QFSFileEngine::homePath()
@@ -630,12 +549,12 @@ QString QFSFileEngine::tempPath()
QFileInfoList QFSFileEngine::drives()
{
QFileInfoList ret;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
-#if defined(Q_OS_WIN32)
+#if !defined(Q_OS_WINRT)
+# if defined(Q_OS_WIN32)
const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff;
::SetErrorMode(oldErrorMode);
-#endif
+# endif
char driveName[] = "A:/";
while (driveBits) {
@@ -645,10 +564,10 @@ QFileInfoList QFSFileEngine::drives()
driveBits = driveBits >> 1;
}
return ret;
-#else // !Q_OS_WINCE && !Q_OS_WINRT
+#else // !Q_OS_WINRT
ret.append(QFileInfo(QLatin1String("/")));
return ret;
-#endif // Q_OS_WINCE || Q_OS_WINRT
+#endif // Q_OS_WINRT
}
bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) const
@@ -656,13 +575,11 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
if (!tried_stat || !metaData.hasFlags(flags)) {
tried_stat = true;
-#if !defined(Q_OS_WINCE)
int localFd = fd;
if (fh && fileEntry.isEmpty())
localFd = QT_FILENO(fh);
if (localFd != -1)
QFileSystemEngine::fillMetaData(localFd, metaData, flags);
-#endif
if (metaData.missingFlags(flags) && !fileEntry.isEmpty())
QFileSystemEngine::fillMetaData(fileEntry, metaData, metaData.missingFlags(flags));
}
@@ -673,8 +590,8 @@ bool QFSFileEnginePrivate::doStat(QFileSystemMetaData::MetaDataFlags flags) cons
bool QFSFileEngine::link(const QString &newName)
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
-#if !defined(QT_NO_LIBRARY)
+#if !defined(Q_OS_WINRT)
+# if !defined(QT_NO_LIBRARY)
bool ret = false;
QString linkName = newName;
@@ -715,24 +632,11 @@ bool QFSFileEngine::link(const QString &newName)
CoUninitialize();
return ret;
-#else
+# else // QT_NO_LIBRARY
Q_UNUSED(newName);
return false;
-#endif // QT_NO_LIBRARY
-#elif defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_SHELLSDK)
- QString linkName = newName;
- linkName.replace(QLatin1Char('/'), QLatin1Char('\\'));
- if (!linkName.endsWith(QLatin1String(".lnk")))
- linkName += QLatin1String(".lnk");
- QString orgName = fileName(AbsoluteName).replace(QLatin1Char('/'), QLatin1Char('\\'));
- // Need to append on our own
- orgName.prepend(QLatin1Char('"'));
- orgName.append(QLatin1Char('"'));
- bool ret = SUCCEEDED(SHCreateShortcut((wchar_t*)linkName.utf16(), (wchar_t*)orgName.utf16()));
- if (!ret)
- setError(QFile::RenameError, qt_error_string());
- return ret;
-#else // Q_OS_WINCE && !QT_NO_WINCE_SHELLSDK
+# endif // QT_NO_LIBRARY
+#else // !Q_OS_WINRT
Q_UNUSED(newName);
Q_UNIMPLEMENTED();
return false;
@@ -813,7 +717,6 @@ QString QFSFileEngine::fileName(FileName file) const
QString ret;
if (!isRelativePath()) {
-#if !defined(Q_OS_WINCE)
if (d->fileEntry.filePath().startsWith(QLatin1Char('/')) || // It's a absolute path to the current drive, so \a.txt -> Z:\a.txt
d->fileEntry.filePath().size() == 2 || // It's a drive letter that needs to get a working dir appended
(d->fileEntry.filePath().size() > 2 && d->fileEntry.filePath().at(2) != QLatin1Char('/')) || // It's a drive-relative path, so Z:a.txt -> Z:\currentpath\a.txt
@@ -821,9 +724,7 @@ QString QFSFileEngine::fileName(FileName file) const
d->fileEntry.filePath().endsWith(QLatin1String("/..")) || d->fileEntry.filePath().endsWith(QLatin1String("/.")))
{
ret = QDir::fromNativeSeparators(QFileSystemEngine::nativeAbsoluteFilePath(d->fileEntry.filePath()));
- } else
-#endif
- {
+ } else {
ret = d->fileEntry.filePath();
}
} else {
@@ -905,14 +806,12 @@ bool QFSFileEngine::setSize(qint64 size)
if (d->fileHandle != INVALID_HANDLE_VALUE || d->fd != -1 || d->fh) {
// resize open file
HANDLE fh = d->fileHandle;
-#if !defined(Q_OS_WINCE)
if (fh == INVALID_HANDLE_VALUE) {
if (d->fh)
fh = (HANDLE)_get_osfhandle(QT_FILENO(d->fh));
else
fh = (HANDLE)_get_osfhandle(d->fd);
}
-#endif
if (fh == INVALID_HANDLE_VALUE)
return false;
qint64 currentPos = pos();
@@ -984,10 +883,8 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
// get handle to the file
HANDLE handle = fileHandle;
-#ifndef Q_OS_WINCE
if (handle == INVALID_HANDLE_VALUE && fh)
handle = (HANDLE)::_get_osfhandle(QT_FILENO(fh));
-#endif
#ifdef Q_USE_DEPRECATED_MAP_API
nativeClose();
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index fd204b00de..36616a5236 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -1148,34 +1148,31 @@ QByteArray QIODevice::read(qint64 maxSize)
Q_D(QIODevice);
QByteArray result;
- CHECK_MAXLEN(read, result);
-
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::read(%lld), d->pos = %lld, d->buffer.size() = %lld\n",
this, maxSize, d->pos, d->buffer.size());
#endif
+ // Try to prevent the data from being copied, if we have a chunk
+ // with the same size in the read buffer.
+ if (maxSize == d->buffer.nextDataBlockSize() && !d->transactionStarted
+ && (d->openMode & (QIODevice::ReadOnly | QIODevice::Text)) == QIODevice::ReadOnly) {
+ result = d->buffer.read();
+ if (!d->isSequential())
+ d->pos += maxSize;
+ if (d->buffer.isEmpty())
+ readData(nullptr, 0);
+ return result;
+ }
+
+ CHECK_MAXLEN(read, result);
if (maxSize >= MaxByteArraySize) {
checkWarnMessage(this, "read", "maxSize argument exceeds QByteArray size limit");
maxSize = MaxByteArraySize - 1;
}
- qint64 readBytes = 0;
- if (maxSize) {
- result.resize(int(maxSize));
- if (!result.size()) {
- // If resize fails, read incrementally.
- qint64 readResult;
- do {
- result.resize(int(qMin(maxSize, qint64(result.size() + d->readBufferChunkSize))));
- readResult = read(result.data() + readBytes, result.size() - readBytes);
- if (readResult > 0 || readBytes == 0)
- readBytes += readResult;
- } while (readResult == d->readBufferChunkSize);
- } else {
- readBytes = read(result.data(), result.size());
- }
- }
+ result.resize(int(maxSize));
+ qint64 readBytes = read(result.data(), result.size());
if (readBytes <= 0)
result.clear();
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index e1bd769e77..79141d1e8f 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -70,7 +70,7 @@
# include <cstdio>
#elif defined(Q_OS_HAIKU)
# include <kernel/OS.h>
-#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
+#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
# if !defined(Q_OS_NETBSD)
# include <sys/user.h>
# endif
@@ -283,7 +283,7 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
if (get_thread_info(pid, &info) != B_OK)
return QString();
return QFile::decodeName(info.name);
-#elif defined(Q_OS_BSD4) && !defined(Q_OS_IOS)
+#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
# if defined(Q_OS_NETBSD)
struct kinfo_proc2 kp;
int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc2), 1 };
diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp
index 4afab3d135..baaff8da17 100644
--- a/src/corelib/io/qlockfile_win.cpp
+++ b/src/corelib/io/qlockfile_win.cpp
@@ -100,7 +100,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
? QLockFile::LockFailedError
: QLockFile::PermissionError;
default:
- qWarning() << "Got unexpected locking error" << lastError;
+ qWarning("Got unexpected locking error %llu", quint64(lastError));
return QLockFile::UnknownError;
}
}
@@ -165,7 +165,7 @@ bool QLockFilePrivate::isApparentlyStale() const
QString QLockFilePrivate::processNameByPid(qint64 pid)
{
-#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINRT)
typedef DWORD (WINAPI *GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD);
HMODULE hPsapi = LoadLibraryA("psapi");
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 914d4421d0..ebafd6b524 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -48,9 +48,6 @@
#if defined QPROCESS_DEBUG
#include <qstring.h>
#include <ctype.h>
-#if !defined(Q_OS_WINCE)
-#include <errno.h>
-#endif
QT_BEGIN_NAMESPACE
/*
@@ -1988,13 +1985,6 @@ qint64 QProcess::writeData(const char *data, qint64 len)
{
Q_D(QProcess);
-#if defined(Q_OS_WINCE)
- Q_UNUSED(data);
- Q_UNUSED(len);
- d->setErrorAndEmit(QProcess::WriteError);
- return -1;
-#endif
-
if (d->stdinChannel.closed) {
#if defined QPROCESS_DEBUG
qDebug("QProcess::writeData(%p \"%s\", %lld) == 0 (write channel closing)",
@@ -2171,7 +2161,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode)
mode &= ~QIODevice::ReadOnly; // not open for reading
if (mode == 0)
mode = QIODevice::Unbuffered;
-#ifndef Q_OS_WINCE
if ((mode & QIODevice::ReadOnly) == 0) {
if (stdoutChannel.type == QProcessPrivate::Channel::Normal)
q->setStandardOutputFile(q->nullDevice());
@@ -2179,7 +2168,6 @@ void QProcessPrivate::start(QIODevice::OpenMode mode)
&& processChannelMode != QProcess::MergedChannels)
q->setStandardErrorFile(q->nullDevice());
}
-#endif
q->QIODevice::open(mode);
@@ -2537,7 +2525,7 @@ QT_BEGIN_INCLUDE_NAMESPACE
#if defined(Q_OS_MACX)
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
-#elif defined(Q_OS_WINCE) || defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
static char *qt_empty_environ[] = { 0 };
#define environ qt_empty_environ
#elif !defined(Q_OS_WIN)
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 8c5589538d..1d425653a3 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -322,7 +322,7 @@ QT_END_INCLUDE_NAMESPACE
QProcessEnvironment QProcessEnvironment::systemEnvironment()
{
QProcessEnvironment env;
-#if !defined(Q_OS_IOS)
+#if !defined(QT_PLATFORM_UIKIT)
const char *entry;
for (int count = 0; (entry = environ[count]); ++count) {
const char *equal = strchr(entry, '=');
diff --git a/src/corelib/io/qprocess_wince.cpp b/src/corelib/io/qprocess_wince.cpp
deleted file mode 100644
index 824a6158dc..0000000000
--- a/src/corelib/io/qprocess_wince.cpp
+++ /dev/null
@@ -1,308 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qprocess.h"
-#include "qprocess_p.h"
-
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qtimer.h>
-#include <qwineventnotifier.h>
-#include <qdebug.h>
-#include <private/qthread_p.h>
-
-#ifndef QT_NO_PROCESS
-
-QT_BEGIN_NAMESPACE
-
-//#define QPROCESS_DEBUG
-
-void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
-{
- Q_UNUSED(pipe);
-}
-
-void QProcessPrivate::closeChannel(Channel *channel)
-{
- Q_UNUSED(channel);
-}
-
-static QString qt_create_commandline(const QString &program, const QStringList &arguments)
-{
- QString args;
- if (!program.isEmpty()) {
- QString programName = program;
- if (!programName.startsWith(QLatin1Char('\"')) && !programName.endsWith(QLatin1Char('\"')) && programName.contains(QLatin1Char(' ')))
- programName = QLatin1Char('\"') + programName + QLatin1Char('\"');
- programName.replace(QLatin1Char('/'), QLatin1Char('\\'));
-
- // add the prgram as the first arg ... it works better
- args = programName + QLatin1Char(' ');
- }
-
- for (int i=0; i<arguments.size(); ++i) {
- QString tmp = arguments.at(i);
- // Quotes are escaped and their preceding backslashes are doubled.
- tmp.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\\1\\1\\\""));
- if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) {
- // The argument must not end with a \ since this would be interpreted
- // as escaping the quote -- rather put the \ behind the quote: e.g.
- // rather use "foo"\ than "foo\"
- int i = tmp.length();
- while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\'))
- --i;
- tmp.insert(i, QLatin1Char('"'));
- tmp.prepend(QLatin1Char('"'));
- }
- args += QLatin1Char(' ') + tmp;
- }
- return args;
-}
-
-QProcessEnvironment QProcessEnvironment::systemEnvironment()
-{
- QProcessEnvironment env;
- return env;
-}
-
-void QProcessPrivate::startProcess()
-{
- Q_Q(QProcess);
-
- bool success = false;
-
- if (pid) {
- CloseHandle(pid->hThread);
- CloseHandle(pid->hProcess);
- delete pid;
- pid = 0;
- }
- pid = new PROCESS_INFORMATION;
- memset(pid, 0, sizeof(PROCESS_INFORMATION));
-
- q->setProcessState(QProcess::Starting);
-
- QString args = qt_create_commandline(QString(), arguments);
- if (!nativeArguments.isEmpty()) {
- if (!args.isEmpty())
- args += QLatin1Char(' ');
- args += nativeArguments;
- }
-
-#if defined QPROCESS_DEBUG
- qDebug("Creating process");
- qDebug(" program : [%s]", program.toLatin1().constData());
- qDebug(" args : %s", args.toLatin1().constData());
- qDebug(" pass environment : %s", environment.isEmpty() ? "no" : "yes");
-#endif
-
- QString fullPathProgram = program;
- if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram = QFileInfo(fullPathProgram).absoluteFilePath();
- fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
- (wchar_t*)args.utf16(),
- 0, 0, false, 0, 0, 0, 0, pid);
-
- if (!success) {
- cleanup();
- setErrorAndEmit(QProcess::FailedToStart);
- q->setProcessState(QProcess::NotRunning);
- return;
- }
-
- q->setProcessState(QProcess::Running);
- // User can call kill()/terminate() from the stateChanged() slot
- // so check before proceeding
- if (!pid)
- return;
-
- if (threadData->hasEventDispatcher()) {
- processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q);
- QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied()));
- processFinishedNotifier->setEnabled(true);
- }
-
- // give the process a chance to start ...
- Sleep(20);
- _q_startupNotification();
-}
-
-bool QProcessPrivate::processStarted(QString * /*errorMessage*/)
-{
- return processState == QProcess::Running;
-}
-
-qint64 QProcessPrivate::bytesAvailableInChannel(const Channel *) const
-{
- return 0;
-}
-
-qint64 QProcessPrivate::readFromChannel(const Channel *, char *data, qint64 maxlen)
-{
- return -1;
-}
-
-static BOOL QT_WIN_CALLBACK qt_terminateApp(HWND hwnd, LPARAM procId)
-{
- DWORD currentProcId = 0;
- GetWindowThreadProcessId(hwnd, &currentProcId);
- if (currentProcId == (DWORD)procId)
- PostMessage(hwnd, WM_CLOSE, 0, 0);
-
- return TRUE;
-}
-
-void QProcessPrivate::terminateProcess()
-{
- if (pid) {
- EnumWindows(qt_terminateApp, (LPARAM)pid->dwProcessId);
- PostThreadMessage(pid->dwThreadId, WM_CLOSE, 0, 0);
- }
-}
-
-void QProcessPrivate::killProcess()
-{
- if (pid)
- TerminateProcess(pid->hProcess, 0xf291);
-}
-
-bool QProcessPrivate::waitForStarted(int)
-{
- Q_Q(QProcess);
-
- if (processStarted())
- return true;
-
- if (processError == QProcess::FailedToStart)
- return false;
-
- setError(QProcess::Timedout);
- return false;
-}
-
-bool QProcessPrivate::drainOutputPipes()
-{
- return true;
-}
-
-bool QProcessPrivate::waitForReadyRead(int msecs)
-{
- return false;
-}
-
-bool QProcessPrivate::waitForBytesWritten(int msecs)
-{
- return false;
-}
-
-bool QProcessPrivate::waitForFinished(int msecs)
-{
- Q_Q(QProcess);
-#if defined QPROCESS_DEBUG
- qDebug("QProcessPrivate::waitForFinished(%d)", msecs);
-#endif
-
- if (!pid)
- return true;
-
- if (WaitForSingleObject(pid->hProcess, msecs == -1 ? INFINITE : msecs) == WAIT_OBJECT_0) {
- _q_processDied();
- return true;
- }
-
- setError(QProcess::Timedout);
- return false;
-}
-
-void QProcessPrivate::findExitCode()
-{
- DWORD theExitCode;
- if (GetExitCodeProcess(pid->hProcess, &theExitCode)) {
- exitCode = theExitCode;
- //### for now we assume a crash if exit code is less than -1 or the magic number
- crashed = (exitCode == 0xf291 || (int)exitCode < 0);
- }
-}
-
-void QProcessPrivate::flushPipeWriter()
-{
-}
-
-qint64 QProcessPrivate::pipeWriterBytesToWrite() const
-{
- return 0;
-}
-
-bool QProcessPrivate::writeToStdin()
-{
- return false;
-}
-
-bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDir, qint64 *pid)
-{
- Q_UNUSED(workingDir);
- QString args = qt_create_commandline(QString(), arguments);
-
- bool success = false;
-
- PROCESS_INFORMATION pinfo;
-
- QString fullPathProgram = program;
- if (!QDir::isAbsolutePath(fullPathProgram))
- fullPathProgram.prepend(QDir::currentPath().append(QLatin1Char('/')));
- fullPathProgram.replace(QLatin1Char('/'), QLatin1Char('\\'));
- success = CreateProcess((wchar_t*)fullPathProgram.utf16(),
- (wchar_t*)args.utf16(),
- 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, 0, &pinfo);
-
- if (success) {
- CloseHandle(pinfo.hThread);
- CloseHandle(pinfo.hProcess);
- if (pid)
- *pid = pinfo.dwProcessId;
- }
-
- return success;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PROCESS
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 6e788d28f4..ed3273eb2e 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -81,7 +81,6 @@
#include <stdlib.h>
#ifdef Q_OS_WIN // for homedirpath reading from registry
-# include <private/qsystemlibrary_p.h>
# include <qt_windows.h>
# ifndef Q_OS_WINRT
# include <shlobj.h>
@@ -110,7 +109,7 @@ using namespace ABI::Windows::Storage;
#define Q_XDG_PLATFORM
#endif
-#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(Q_OS_IOS))
+#if !defined(QT_NO_STANDARDPATHS) && (defined(Q_XDG_PLATFORM) || defined(QT_PLATFORM_UIKIT))
#define QSETTINGS_USE_QSTANDARDPATHS
#endif
@@ -986,21 +985,12 @@ static QString windowsConfigPath(int type)
if (result.isEmpty()) {
switch (type) {
-#ifndef Q_OS_WINCE
case CSIDL_COMMON_APPDATA:
result = QLatin1String("C:\\temp\\qt-common");
break;
case CSIDL_APPDATA:
result = QLatin1String("C:\\temp\\qt-user");
break;
-#else
- case CSIDL_COMMON_APPDATA:
- result = QLatin1String("\\Temp\\qt-common");
- break;
- case CSIDL_APPDATA:
- result = QLatin1String("\\Temp\\qt-user");
- break;
-#endif
default:
;
}
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index d73cc4d298..72160a4769 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -541,31 +541,7 @@ void QMacSettingsPrivate::sync()
domains[i].userName, hostNames[j]);
// only report failures for the primary file (the one we write to)
if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) {
-#if 1
- if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
- // work around what seems to be a bug in CFPreferences:
- // don't report an error if there are no preferences for the application
- QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName,
- hostNames[j]);
-
- // iterate through all the applications and see if we're there
- CFIndex size = CFArrayGetCount(appIds);
- for (CFIndex k = 0; k < size; ++k) {
- const void *cfvalue = CFArrayGetValueAtIndex(appIds, k);
- if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) {
- if (CFStringCompare(static_cast<CFStringRef>(cfvalue),
- domains[i].applicationOrSuiteId,
- kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
- setStatus(QSettings::AccessError);
- break;
- }
- }
- }
- } else
-#endif
- {
- setStatus(QSettings::AccessError);
- }
+ setStatus(QSettings::AccessError);
}
}
}
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index 05ed51e999..7c6b782acd 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -609,16 +609,12 @@ HKEY QWinSettingsPrivate::writeHandle() const
QWinSettingsPrivate::~QWinSettingsPrivate()
{
if (deleteWriteHandleOnExit && writeHandle() != 0) {
-#if defined(Q_OS_WINCE)
- remove(regList.at(0).key());
-#else
QString emptyKey;
DWORD res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(emptyKey.utf16()));
if (res != ERROR_SUCCESS) {
qWarning("QSettings: Failed to delete key \"%s\": %s",
regList.at(0).key().toLatin1().data(), errorCodeToString(res).toLatin1().data());
}
-#endif
}
for (int i = 0; i < regList.size(); ++i)
@@ -660,10 +656,6 @@ void QWinSettingsPrivate::remove(const QString &uKey)
}
}
} else {
-#if defined(Q_OS_WINCE)
- // For WinCE always Close the handle first.
- RegCloseKey(handle);
-#endif
res = RegDeleteKey(writeHandle(), reinterpret_cast<const wchar_t *>(rKey.utf16()));
if (res != ERROR_SUCCESS) {
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index f08a6dac53..dc3d7737b6 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -117,7 +117,7 @@ static QString baseWritableLocation(QStandardPaths::StandardLocation type,
case QStandardPaths::TempLocation:
path = QDir::tempPath();
break;
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
// These locations point to non-existing write-protected paths. Use sensible fallbacks.
case QStandardPaths::MusicLocation:
path = pathForDirectory(NSDocumentDirectory, mask) + QLatin1String("/Music");
@@ -204,7 +204,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
{
QStringList dirs;
-#ifdef Q_OS_IOS
+#if defined(QT_PLATFORM_UIKIT)
if (type == PicturesLocation)
dirs << writableLocation(PicturesLocation) << QLatin1String("assets-library://");
#endif
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 9bd5a9e3b6..38c63553ea 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -51,13 +51,7 @@ const GUID qCLSID_FOLDERID_Downloads = { 0x374de290, 0x123f, 0x4565, { 0x91, 0x6
#include <qt_windows.h>
#include <shlobj.h>
-#if !defined(Q_OS_WINCE)
-# include <intshcut.h>
-#else
-# if !defined(STANDARDSHELL_UI_MODEL)
-# include <winx.h>
-# endif
-#endif
+#include <intshcut.h>
#ifndef CSIDL_MYMUSIC
#define CSIDL_MYMUSIC 13
@@ -117,7 +111,6 @@ static inline void appendTestMode(QString &path)
// Map QStandardPaths::StandardLocation to CLSID of SHGetSpecialFolderPath()
static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
{
-#ifndef Q_OS_WINCE
static const int clsids[] = {
CSIDL_DESKTOPDIRECTORY, // DesktopLocation
CSIDL_PERSONAL, // DocumentsLocation
@@ -137,27 +130,6 @@ static int writableSpecialFolderClsid(QStandardPaths::StandardLocation type)
CSIDL_APPDATA, // AppDataLocation ("Roaming" path)
CSIDL_LOCAL_APPDATA, // AppConfigLocation ("Local" path)
};
-#else // !Q_OS_WINCE
- static const int clsids[] = {
- CSIDL_DESKTOPDIRECTORY, // DesktopLocation
- CSIDL_PERSONAL, // DocumentsLocation
- CSIDL_FONTS, // FontsLocation
- CSIDL_PROGRAMS, // ApplicationsLocation
- CSIDL_MYMUSIC, // MusicLocation
- CSIDL_MYVIDEO, // MoviesLocation
- CSIDL_MYPICTURES, // PicturesLocation
- -1, -1, // TempLocation/HomeLocation
- CSIDL_APPDATA, // AppLocalDataLocation, AppLocalDataLocation = DataLocation
- -1, // CacheLocation
- CSIDL_APPDATA, // GenericDataLocation
- -1, // RuntimeLocation
- CSIDL_APPDATA, // ConfigLocation
- -1, -1, // DownloadLocation/GenericCacheLocation
- CSIDL_APPDATA, // GenericConfigLocation
- CSIDL_APPDATA, // AppDataLocation
- CSIDL_APPDATA, // AppConfigLocation
- };
-#endif // Q_OS_WINCE
Q_STATIC_ASSERT(sizeof(clsids) / sizeof(clsids[0]) == size_t(QStandardPaths::AppConfigLocation + 1));
return size_t(type) < sizeof(clsids) / sizeof(clsids[0]) ? clsids[type] : -1;
@@ -183,7 +155,6 @@ static QString sHGetSpecialFolderPath(int clsid, QStandardPaths::StandardLocatio
static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardLocation type, bool warn = false)
{
QString result;
-#ifndef Q_OS_WINCE
typedef HRESULT (WINAPI *GetKnownFolderPath)(const GUID&, DWORD, HANDLE, LPWSTR*);
static const GetKnownFolderPath sHGetKnownFolderPath = // Vista onwards.
@@ -199,11 +170,6 @@ static QString sHGetKnownFolderPath(const GUID &clsid, QStandardPaths::StandardL
qPrintable(displayName(type)));
}
}
-#else // !Q_OS_WINCE
- Q_UNUSED(clsid)
- Q_UNUSED(type)
- Q_UNUSED(warn)
-#endif
return result;
}
@@ -266,7 +232,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
dirs.append(localDir);
// type-specific handling goes here
-#ifndef Q_OS_WINCE
if (isConfigLocation(type)) {
QString programData = sHGetSpecialFolderPath(CSIDL_COMMON_APPDATA, type);
if (!programData.isEmpty()) {
@@ -274,12 +239,11 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
appendOrganizationAndApp(programData);
dirs.append(programData);
}
-# ifndef QT_BOOTSTRAPPED
+#ifndef QT_BOOTSTRAPPED
dirs.append(QCoreApplication::applicationDirPath());
dirs.append(QCoreApplication::applicationDirPath() + QLatin1String("/data"));
-# endif // !QT_BOOTSTRAPPED
+#endif // !QT_BOOTSTRAPPED
} // isConfigLocation()
-#endif // !Q_OS_WINCE
return dirs;
}
diff --git a/src/corelib/io/qstorageinfo_p.h b/src/corelib/io/qstorageinfo_p.h
index 744653ea42..9dc66f2d69 100644
--- a/src/corelib/io/qstorageinfo_p.h
+++ b/src/corelib/io/qstorageinfo_p.h
@@ -70,7 +70,7 @@ public:
static QStorageInfo root();
protected:
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
void retrieveVolumeInfo();
void retrieveDiskFreeSpace();
#elif defined(Q_OS_MAC)
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 0b0446a37e..c430c7714a 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -404,7 +404,12 @@ bool QTemporaryFileEngine::close()
//************* QTemporaryFilePrivate
-QTemporaryFilePrivate::QTemporaryFilePrivate() : autoRemove(true)
+QTemporaryFilePrivate::QTemporaryFilePrivate()
+{
+}
+
+QTemporaryFilePrivate::QTemporaryFilePrivate(const QString &templateNameIn)
+ : templateName(templateNameIn)
{
}
@@ -498,15 +503,11 @@ QString QTemporaryFilePrivate::defaultTemplateName()
QTemporaryFile::QTemporaryFile()
: QFile(*new QTemporaryFilePrivate)
{
- Q_D(QTemporaryFile);
- d->templateName = QTemporaryFilePrivate::defaultTemplateName();
}
QTemporaryFile::QTemporaryFile(const QString &templateName)
- : QFile(*new QTemporaryFilePrivate)
+ : QFile(*new QTemporaryFilePrivate(templateName))
{
- Q_D(QTemporaryFile);
- d->templateName = templateName;
}
#else
@@ -519,10 +520,8 @@ QTemporaryFile::QTemporaryFile(const QString &templateName)
\sa setFileTemplate(), QDir::tempPath()
*/
QTemporaryFile::QTemporaryFile()
- : QFile(*new QTemporaryFilePrivate, 0)
+ : QTemporaryFile(nullptr)
{
- Q_D(QTemporaryFile);
- d->templateName = QTemporaryFilePrivate::defaultTemplateName();
}
/*!
@@ -540,10 +539,8 @@ QTemporaryFile::QTemporaryFile()
\sa open(), fileTemplate()
*/
QTemporaryFile::QTemporaryFile(const QString &templateName)
- : QFile(*new QTemporaryFilePrivate, 0)
+ : QTemporaryFile(templateName, nullptr)
{
- Q_D(QTemporaryFile);
- d->templateName = templateName;
}
/*!
@@ -557,8 +554,6 @@ QTemporaryFile::QTemporaryFile(const QString &templateName)
QTemporaryFile::QTemporaryFile(QObject *parent)
: QFile(*new QTemporaryFilePrivate, parent)
{
- Q_D(QTemporaryFile);
- d->templateName = QTemporaryFilePrivate::defaultTemplateName();
}
/*!
@@ -577,10 +572,8 @@ QTemporaryFile::QTemporaryFile(QObject *parent)
\sa open(), fileTemplate()
*/
QTemporaryFile::QTemporaryFile(const QString &templateName, QObject *parent)
- : QFile(*new QTemporaryFilePrivate, parent)
+ : QFile(*new QTemporaryFilePrivate(templateName), parent)
{
- Q_D(QTemporaryFile);
- d->templateName = templateName;
}
#endif
diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h
index 58cc318ffd..d057603034 100644
--- a/src/corelib/io/qtemporaryfile_p.h
+++ b/src/corelib/io/qtemporaryfile_p.h
@@ -67,13 +67,14 @@ class QTemporaryFilePrivate : public QFilePrivate
protected:
QTemporaryFilePrivate();
+ explicit QTemporaryFilePrivate(const QString &templateNameIn);
~QTemporaryFilePrivate();
QAbstractFileEngine *engine() const;
void resetFileEngine() const;
- bool autoRemove;
- QString templateName;
+ bool autoRemove = true;
+ QString templateName = defaultTemplateName();
static QString defaultTemplateName();
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 27b7570226..b8db23329a 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -231,9 +231,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
#include "qnumeric.h"
#include "qvarlengtharray.h"
-#ifndef Q_OS_WINCE
#include <locale.h>
-#endif
#include "private/qlocale_p.h"
#include <stdlib.h>
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 451e3b2967..40fc492d91 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -413,9 +413,6 @@
#include "qtldurl_p.h"
#include "private/qipaddress_p.h"
#include "qurlquery.h"
-#if defined(Q_OS_WINCE_WM)
-#pragma optimize("g", off)
-#endif
QT_BEGIN_NAMESPACE
extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths); // qdir.cpp
@@ -3454,33 +3451,6 @@ QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclu
return input.toUtf8().toPercentEncoding(exclude, include);
}
-/*! \fn QUrl QUrl::fromCFURL(CFURLRef url)
- \since 5.2
-
- Constructs a QUrl containing a copy of the CFURL \a url.
-*/
-
-/*! \fn CFURLRef QUrl::toCFURL() const
- \since 5.2
-
- Creates a CFURL from a QUrl. The caller owns the CFURL and is
- responsible for releasing it.
-*/
-
-/*!
- \fn QUrl QUrl::fromNSURL(const NSURL *url)
- \since 5.2
-
- Constructs a QUrl containing a copy of the NSURL \a url.
-*/
-
-/*!
- \fn NSURL* QUrl::toNSURL() const
- \since 5.2
-
- Creates a NSURL from a QUrl. The NSURL is autoreleased.
-*/
-
/*!
\internal
\since 5.0
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 947b3bbb55..bce271fcb1 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -48,11 +48,9 @@
#include <QtCore/qpair.h>
#include <QtCore/qglobal.h>
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFURL);
-# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -164,6 +162,12 @@ public:
};
Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption)
#ifdef Q_QDOC
+private:
+ // We need to let qdoc think that FormattingOptions is a normal QFlags, but
+ // it needs to be a QUrlTwoFlags for compiling default arguments of somme functions.
+ template<typename T> struct QFlags : QUrlTwoFlags<T, ComponentFormattingOption>
+ { using QUrlTwoFlags<T, ComponentFormattingOption>::QUrlTwoFlags; };
+public:
Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption)
#else
typedef QUrlTwoFlags<UrlFormattingOption, ComponentFormattingOption> FormattingOptions;
@@ -271,13 +275,11 @@ public:
static QByteArray toPercentEncoding(const QString &,
const QByteArray &exclude = QByteArray(),
const QByteArray &include = QByteArray());
-#if defined(Q_OS_MAC) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QUrl fromCFURL(CFURLRef url);
CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED;
-# if defined(__OBJC__) || defined(Q_QDOC)
static QUrl fromNSURL(const NSURL *url);
NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
-# endif
#endif
#if QT_DEPRECATED_SINCE(5,0)
@@ -372,6 +374,7 @@ Q_DECLARE_SHARED(QUrl)
Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions)
//Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions)
+#ifndef Q_QDOC
Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
{ return QUrl::FormattingOptions(f1) | f2; }
Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2)
@@ -399,6 +402,7 @@ Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormatt
//inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f)
//{ i = int(f); f; }
+#endif // Q_QDOC
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &);
diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp
index 15fb276be9..b8df8e8084 100644
--- a/src/corelib/io/qwindowspipereader.cpp
+++ b/src/corelib/io/qwindowspipereader.cpp
@@ -71,21 +71,6 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
this, &QWindowsPipeReader::emitPendingReadyRead, Qt::QueuedConnection);
}
-bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped)
-{
- typedef BOOL (WINAPI *PtrCancelIoEx)(HANDLE, LPOVERLAPPED);
- static PtrCancelIoEx ptrCancelIoEx = 0;
- if (!ptrCancelIoEx) {
- HMODULE kernel32 = GetModuleHandleA("kernel32");
- if (kernel32)
- ptrCancelIoEx = PtrCancelIoEx(GetProcAddress(kernel32, "CancelIoEx"));
- }
- if (ptrCancelIoEx)
- return ptrCancelIoEx(handle, overlapped);
- else
- return CancelIo(handle);
-}
-
QWindowsPipeReader::~QWindowsPipeReader()
{
stop();
@@ -110,7 +95,7 @@ void QWindowsPipeReader::stop()
{
stopped = true;
if (readSequenceStarted) {
- if (!qt_cancelIo(handle, &overlapped)) {
+ if (!CancelIoEx(handle, &overlapped)) {
const DWORD dwError = GetLastError();
if (dwError != ERROR_NOT_FOUND) {
qErrnoWarning(dwError, "QWindowsPipeReader: qt_cancelIo on handle %x failed.",
diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp
index b0ca0d979b..3ab2c70c75 100644
--- a/src/corelib/io/qwindowspipewriter.cpp
+++ b/src/corelib/io/qwindowspipewriter.cpp
@@ -42,9 +42,6 @@
QT_BEGIN_NAMESPACE
-extern bool qt_cancelIo(HANDLE handle, OVERLAPPED *overlapped); // from qwindowspipereader.cpp
-
-
QWindowsPipeWriter::Overlapped::Overlapped(QWindowsPipeWriter *pipeWriter)
: pipeWriter(pipeWriter)
{
@@ -211,7 +208,7 @@ void QWindowsPipeWriter::stop()
bytesWrittenPending = false;
pendingBytesWrittenValue = 0;
if (writeSequenceStarted) {
- if (!qt_cancelIo(handle, &overlapped)) {
+ if (!CancelIoEx(handle, &overlapped)) {
const DWORD dwError = GetLastError();
if (dwError != ERROR_NOT_FOUND) {
qErrnoWarning(dwError, "QWindowsPipeWriter: qt_cancelIo on handle %x failed.",
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index b0a634cb4a..f2fcb767d5 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -396,7 +396,7 @@ public:
const ushort *uc = (const ushort *)str.unicode();
int i = 0;
#ifdef __SSE2__
- for ( ; i + 16 < len; i += 16) {
+ for ( ; i + 16 <= len; i += 16) {
__m128i chunk1 = _mm_loadu_si128((__m128i*)&uc[i]); // load
__m128i chunk2 = _mm_loadu_si128((__m128i*)&uc[i + 8]); // load
// pack the two vector to 16 x 8bits elements
@@ -405,7 +405,7 @@ public:
}
# ifdef Q_PROCESSOR_X86_64
// we can do one more round, of 8 characters
- if (i + 8 < len) {
+ if (i + 8 <= len) {
__m128i chunk = _mm_loadu_si128((__m128i*)&uc[i]); // load
// pack with itself, we'll discard the high part anyway
chunk = _mm_packus_epi16(chunk, chunk);
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 8c16e10c27..991b73812a 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -84,14 +84,6 @@ win32 {
}
}
-wince {
- SOURCES += \
- kernel/qfunctions_wince.cpp
- HEADERS += \
- kernel/qfunctions_fake_env_p.h \
- kernel/qfunctions_wince.h
-}
-
winrt {
SOURCES += \
kernel/qfunctions_winrt.cpp
@@ -109,7 +101,8 @@ mac {
SOURCES += \
kernel/qcfsocketnotifier.cpp \
kernel/qcoreapplication_mac.cpp \
- kernel/qcore_mac.cpp
+ kernel/qcore_mac.cpp \
+ kernel/qcore_foundation.mm
OBJECTIVE_SOURCES += \
kernel/qcore_mac_objc.mm \
@@ -119,7 +112,7 @@ mac {
osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit
- ios {
+ uikit {
# We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit
}
@@ -156,8 +149,8 @@ unix|integrity {
kernel/qeventdispatcher_glib.cpp
HEADERS += \
kernel/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE +=$$QT_LIBS_GLIB
+ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GLIB
+ LIBS_PRIVATE +=$$QMAKE_LIBS_GLIB
}
contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri)
diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm
new file mode 100644
index 0000000000..2291017a5d
--- /dev/null
+++ b/src/corelib/kernel/qcore_foundation.mm
@@ -0,0 +1,537 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2014 Samuel Gaist <samuel.gaist@edeltech.ch>
+** Copyright (C) 2014 Petroules Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qstring.h>
+#include <QtCore/qurl.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/quuid.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qrect.h>
+
+#import <Foundation/Foundation.h>
+
+#if defined(QT_PLATFORM_UIKIT)
+#import <CoreGraphics/CoreGraphics.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \since 5.3
+
+ Constructs a new QByteArray containing a copy of the CFData \a data.
+
+ \sa fromRawCFData(), fromRawData(), toRawCFData(), toCFData()
+*/
+QByteArray QByteArray::fromCFData(CFDataRef data)
+{
+ if (!data)
+ return QByteArray();
+
+ return QByteArray(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
+}
+
+/*!
+ \since 5.3
+
+ Constructs a QByteArray that uses the bytes of the CFData \a data.
+
+ The \a data's bytes are not copied.
+
+ The caller guarantees that the CFData will not be deleted
+ or modified as long as this QByteArray object exists.
+
+ \sa fromCFData(), fromRawData(), toRawCFData(), toCFData()
+*/
+QByteArray QByteArray::fromRawCFData(CFDataRef data)
+{
+ if (!data)
+ return QByteArray();
+
+ return QByteArray::fromRawData(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
+}
+
+/*!
+ \since 5.3
+
+ Creates a CFData from a QByteArray. The caller owns the CFData object
+ and is responsible for releasing it.
+
+ \sa toRawCFData(), fromCFData(), fromRawCFData(), fromRawData()
+*/
+CFDataRef QByteArray::toCFData() const
+{
+ return CFDataCreate(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()), length());
+}
+
+/*!
+ \since 5.3
+
+ Constructs a CFData that uses the bytes of the QByteArray.
+
+ The QByteArray's bytes are not copied.
+
+ The caller guarantees that the QByteArray will not be deleted
+ or modified as long as this CFData object exists.
+
+ \sa toCFData(), fromRawCFData(), fromCFData(), fromRawData()
+*/
+CFDataRef QByteArray::toRawCFData() const
+{
+ return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()),
+ length(), kCFAllocatorNull);
+}
+
+/*!
+ \since 5.3
+
+ Constructs a new QByteArray containing a copy of the NSData \a data.
+
+ \sa fromRawNSData(), fromRawData(), toNSData(), toRawNSData()
+*/
+QByteArray QByteArray::fromNSData(const NSData *data)
+{
+ if (!data)
+ return QByteArray();
+ return QByteArray(reinterpret_cast<const char *>([data bytes]), [data length]);
+}
+
+/*!
+ \since 5.3
+
+ Constructs a QByteArray that uses the bytes of the NSData \a data.
+
+ The \a data's bytes are not copied.
+
+ The caller guarantees that the NSData will not be deleted
+ or modified as long as this QByteArray object exists.
+
+ \sa fromNSData(), fromRawData(), toRawNSData(), toNSData()
+*/
+QByteArray QByteArray::fromRawNSData(const NSData *data)
+{
+ if (!data)
+ return QByteArray();
+ return QByteArray::fromRawData(reinterpret_cast<const char *>([data bytes]), [data length]);
+}
+
+/*!
+ \since 5.3
+
+ Creates a NSData from a QByteArray. The NSData object is autoreleased.
+
+ \sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData()
+*/
+NSData *QByteArray::toNSData() const
+{
+ return [NSData dataWithBytes:constData() length:size()];
+}
+
+/*!
+ \since 5.3
+
+ Constructs a NSData that uses the bytes of the QByteArray.
+
+ The QByteArray's bytes are not copied.
+
+ The caller guarantees that the QByteArray will not be deleted
+ or modified as long as this NSData object exists.
+
+ \sa fromRawNSData(), fromNSData(), fromRawData(), toNSData()
+*/
+NSData *QByteArray::toRawNSData() const
+{
+ // const_cast is fine here because NSData is immutable thus will never modify bytes we're giving it
+ return [NSData dataWithBytesNoCopy:const_cast<char *>(constData()) length:size() freeWhenDone:NO];
+}
+
+// ----------------------------------------------------------------------------
+
+/*!
+ \since 5.2
+
+ Constructs a new QString containing a copy of the \a string CFString.
+
+ \note this function is only available on OS X and iOS.
+*/
+QString QString::fromCFString(CFStringRef string)
+{
+ if (!string)
+ return QString();
+ CFIndex length = CFStringGetLength(string);
+
+ // Fast path: CFStringGetCharactersPtr does not copy but may
+ // return null for any and no reason.
+ const UniChar *chars = CFStringGetCharactersPtr(string);
+ if (chars)
+ return QString(reinterpret_cast<const QChar *>(chars), length);
+
+ QString ret(length, Qt::Uninitialized);
+ CFStringGetCharacters(string, CFRangeMake(0, length), reinterpret_cast<UniChar *>(ret.data()));
+ return ret;
+}
+
+/*!
+ \since 5.2
+
+ Creates a CFString from a QString. The caller owns the CFString and is
+ responsible for releasing it.
+
+ \note this function is only available on OS X and iOS.
+*/
+CFStringRef QString::toCFString() const
+{
+ return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(unicode()), length());
+}
+
+/*!
+ \since 5.2
+
+ Constructs a new QString containing a copy of the \a string NSString.
+
+ \note this function is only available on OS X and iOS.
+*/
+QString QString::fromNSString(const NSString *string)
+{
+ if (!string)
+ return QString();
+ QString qstring;
+ qstring.resize([string length]);
+ [string getCharacters: reinterpret_cast<unichar*>(qstring.data()) range: NSMakeRange(0, [string length])];
+ return qstring;
+}
+
+/*!
+ \since 5.2
+
+ Creates a NSString from a QString. The NSString is autoreleased.
+
+ \note this function is only available on OS X and iOS.
+*/
+NSString *QString::toNSString() const
+{
+ return [NSString stringWithCharacters: reinterpret_cast<const UniChar*>(unicode()) length: length()];
+}
+
+// ----------------------------------------------------------------------------
+
+/*!
+ \since 5.7
+
+ Constructs a new QUuid containing a copy of the \a uuid CFUUID.
+
+ \note this function is only available on Apple platforms.
+*/
+QUuid QUuid::fromCFUUID(CFUUIDRef uuid)
+{
+ if (!uuid)
+ return QUuid();
+ const CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid);
+ return QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char *>(&bytes), sizeof(bytes)));
+}
+
+/*!
+ \since 5.7
+
+ Creates a CFUUID from a QUuid. The caller owns the CFUUID and is
+ responsible for releasing it.
+
+ \note this function is only available on Apple platforms.
+*/
+CFUUIDRef QUuid::toCFUUID() const
+{
+ const QByteArray bytes = toRfc4122();
+ return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(bytes.constData()));
+}
+
+/*!
+ \since 5.7
+
+ Constructs a new QUuid containing a copy of the \a uuid NSUUID.
+
+ \note this function is only available on Apple platforms.
+*/
+QUuid QUuid::fromNSUUID(const NSUUID *uuid)
+{
+ if (!uuid)
+ return QUuid();
+ uuid_t bytes;
+ [uuid getUUIDBytes:bytes];
+ return QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char *>(bytes), sizeof(bytes)));
+}
+
+/*!
+ \since 5.7
+
+ Creates a NSUUID from a QUuid. The NSUUID is autoreleased.
+
+ \note this function is only available on Apple platforms.
+*/
+NSUUID *QUuid::toNSUUID() const
+{
+ const QByteArray bytes = toRfc4122();
+ return [[[NSUUID alloc] initWithUUIDBytes:*reinterpret_cast<const uuid_t *>(bytes.constData())] autorelease];
+}
+
+// ----------------------------------------------------------------------------
+
+
+/*!
+ \since 5.2
+
+ Constructs a QUrl containing a copy of the CFURL \a url.
+*/
+QUrl QUrl::fromCFURL(CFURLRef url)
+{
+ return QUrl(QString::fromCFString(CFURLGetString(url)));
+}
+
+/*!
+ \since 5.2
+
+ Creates a CFURL from a QUrl. The caller owns the CFURL and is
+ responsible for releasing it.
+*/
+CFURLRef QUrl::toCFURL() const
+{
+ CFURLRef url = 0;
+ CFStringRef str = toString(FullyEncoded).toCFString();
+ if (str) {
+ url = CFURLCreateWithString(0, str, 0);
+ CFRelease(str);
+ }
+ return url;
+}
+
+/*!
+ \since 5.2
+
+ Constructs a QUrl containing a copy of the NSURL \a url.
+*/
+QUrl QUrl::fromNSURL(const NSURL *url)
+{
+ return QUrl(QString::fromNSString([url absoluteString]));
+}
+
+/*!
+ \since 5.2
+
+ Creates a NSURL from a QUrl. The NSURL is autoreleased.
+*/
+NSURL *QUrl::toNSURL() const
+{
+ return [NSURL URLWithString:toString(FullyEncoded).toNSString()];
+}
+
+// ----------------------------------------------------------------------------
+
+
+/*!
+ \since 5.5
+
+ Constructs a new QDateTime containing a copy of the CFDate \a date.
+
+ \sa toCFDate()
+*/
+QDateTime QDateTime::fromCFDate(CFDateRef date)
+{
+ if (!date)
+ return QDateTime();
+ return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>((CFDateGetAbsoluteTime(date)
+ + kCFAbsoluteTimeIntervalSince1970) * 1000));
+}
+
+/*!
+ \since 5.5
+
+ Creates a CFDate from a QDateTime. The caller owns the CFDate object
+ and is responsible for releasing it.
+
+ \sa fromCFDate()
+*/
+CFDateRef QDateTime::toCFDate() const
+{
+ return CFDateCreate(kCFAllocatorDefault, (static_cast<CFAbsoluteTime>(toMSecsSinceEpoch())
+ / 1000) - kCFAbsoluteTimeIntervalSince1970);
+}
+
+/*!
+ \since 5.5
+
+ Constructs a new QDateTime containing a copy of the NSDate \a date.
+
+ \sa toNSDate()
+*/
+QDateTime QDateTime::fromNSDate(const NSDate *date)
+{
+ if (!date)
+ return QDateTime();
+ return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>([date timeIntervalSince1970] * 1000));
+}
+
+/*!
+ \since 5.5
+
+ Creates an NSDate from a QDateTime. The NSDate object is autoreleased.
+
+ \sa fromNSDate()
+*/
+NSDate *QDateTime::toNSDate() const
+{
+ return [NSDate
+ dateWithTimeIntervalSince1970:static_cast<NSTimeInterval>(toMSecsSinceEpoch()) / 1000];
+}
+
+// ----------------------------------------------------------------------------
+
+/*!
+ \since 5.8
+
+ Creates a CGRect from a QRect.
+
+ \sa fromCGRect()
+*/
+CGRect QRect::toCGRect() const Q_DECL_NOTHROW
+{
+ return CGRectMake(x(), y(), width(), height());
+}
+
+/*!
+ \since 5.8
+
+ Creates a CGRect from a QRectF.
+
+ \sa fromCGRect()
+*/
+CGRect QRectF::toCGRect() const Q_DECL_NOTHROW
+{
+ return CGRectMake(x(), y(), width(), height());
+}
+
+/*!
+ \since 5.8
+
+ Creates a QRectF from a CGRect.
+
+ \sa toCGRect()
+*/
+QRectF QRectF::fromCGRect(CGRect rect) Q_DECL_NOTHROW
+{
+ return QRectF(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+}
+
+// ----------------------------------------------------------------------------
+
+/*!
+ \since 5.8
+
+ Creates a CGPoint from a QPoint.
+
+ \sa fromCGPoint()
+*/
+CGPoint QPoint::toCGPoint() const Q_DECL_NOTHROW
+{
+ return CGPointMake(x(), y());
+}
+
+/*!
+ \since 5.8
+
+ Creates a CGPoint from a QPointF.
+
+ \sa fromCGPoint()
+*/
+CGPoint QPointF::toCGPoint() const Q_DECL_NOTHROW
+{
+ return CGPointMake(x(), y());
+}
+
+/*!
+ \since 5.8
+
+ Creates a QRectF from a CGPoint.
+
+ \sa toCGPoint()
+*/
+QPointF QPointF::fromCGPoint(CGPoint point) Q_DECL_NOTHROW
+{
+ return QPointF(point.x, point.y);
+}
+
+// ----------------------------------------------------------------------------
+
+/*!
+ \since 5.8
+
+ Creates a CGSize from a QSize.
+
+ \sa fromCGSize()
+*/
+CGSize QSize::toCGSize() const Q_DECL_NOTHROW
+{
+ return CGSizeMake(width(), height());
+}
+
+/*!
+ \since 5.8
+
+ Creates a CGSize from a QSizeF.
+
+ \sa fromCGSize()
+*/
+CGSize QSizeF::toCGSize() const Q_DECL_NOTHROW
+{
+ return CGSizeMake(width(), height());
+}
+
+/*!
+ \since 5.8
+
+ Creates a QRectF from a CGSize.
+
+ \sa toCGSize()
+*/
+QSizeF QSizeF::fromCGSize(CGSize size) Q_DECL_NOTHROW
+{
+ return QSizeF(size.width, size.height);
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index de491dd43d..068b6b0440 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -47,7 +47,7 @@
#include <qdebug.h>
-#ifdef Q_OS_IOS
+#if defined(Q_OS_IOS)
#import <UIKit/UIKit.h>
#endif
@@ -101,7 +101,7 @@ QT_FOR_EACH_MUTABLE_CORE_GRAPHICS_TYPE(QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TY
QAppleOperatingSystemVersion qt_apple_os_version()
{
QAppleOperatingSystemVersion v = {0, 0, 0};
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0)
+#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_10, __IPHONE_8_0) || defined(Q_OS_TVOS)
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) {
NSOperatingSystemVersion osv = NSProcessInfo.processInfo.operatingSystemVersion;
v.major = osv.majorVersion;
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index 53f2a50191..6ed316254b 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -294,8 +294,8 @@ static inline int qt_safe_close(int fd)
#undef QT_CLOSE
#define QT_CLOSE qt_safe_close
-// - VxWorks doesn't have processes
-#if !defined(Q_OS_VXWORKS)
+// - VxWorks & iOS/tvOS don't have processes
+#if !defined(Q_OS_VXWORKS) && !defined(QT_NO_PROCESS)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
{
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 7bb2e7a78c..aa08a23f6b 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1299,19 +1299,6 @@ void QCoreApplication::exit(int returnCode)
QEventLoop *eventLoop = data->eventLoops.at(i);
eventLoop->exit(returnCode);
}
-#ifdef Q_OS_WINRT
- qWarning("QCoreApplication::exit: It is not recommended to explicitly exit an application on Windows Store Apps");
- ComPtr<ICoreApplication> app;
- HRESULT hr = RoGetActivationFactory(Wrappers::HString::MakeReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
- IID_PPV_ARGS(&app));
- RETURN_VOID_IF_FAILED("Could not acquire ICoreApplication object");
- ComPtr<ICoreApplicationExit> appExit;
-
- hr = app.As(&appExit);
- RETURN_VOID_IF_FAILED("Could not acquire ICoreApplicationExit object");
- hr = appExit->Exit();
- RETURN_VOID_IF_FAILED("Could not exit application");
-#endif // Q_OS_WINRT
}
/*****************************************************************************
@@ -2261,14 +2248,6 @@ QStringList QCoreApplication::arguments()
// classes by index.
QString cmdline = QString::fromWCharArray(GetCommandLine());
-#if defined(Q_OS_WINCE)
- wchar_t tempFilename[MAX_PATH+1];
- if (GetModuleFileName(0, tempFilename, MAX_PATH)) {
- tempFilename[MAX_PATH] = 0;
- cmdline.prepend(QLatin1Char('\"') + QString::fromWCharArray(tempFilename) + QLatin1String("\" "));
- }
-#endif // Q_OS_WINCE
-
const QCoreApplicationPrivate *d = self->d_func();
if (d->origArgv) {
const QStringList allArguments = qWinCmdArgs(cmdline);
@@ -2499,6 +2478,26 @@ QStringList QCoreApplication::libraryPaths()
}
}
+#ifdef Q_OS_DARWIN
+ // Check the main bundle's PlugIns directory as this is a standard location for Apple OSes.
+ // Note that the QLibraryInfo::PluginsPath below will coincidentally be the same as this value
+ // but with a different casing, so it can't be relied upon when the underlying filesystem
+ // is case sensitive (and this is always the case on newer OSes like iOS).
+ if (CFBundleRef bundleRef = CFBundleGetMainBundle()) {
+ if (QCFType<CFURLRef> urlRef = CFBundleCopyBuiltInPlugInsURL(bundleRef)) {
+ if (QCFType<CFURLRef> absoluteUrlRef = CFURLCopyAbsoluteURL(urlRef)) {
+ if (QCFString path = CFURLCopyFileSystemPath(absoluteUrlRef, kCFURLPOSIXPathStyle)) {
+ if (QFile::exists(path)) {
+ path = QDir(path).canonicalPath();
+ if (!app_libpaths->contains(path))
+ app_libpaths->append(path);
+ }
+ }
+ }
+ }
+ }
+#endif // Q_OS_DARWIN
+
QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath);
if (QFile::exists(installPathPlugins)) {
// Make sure we convert from backslashes to slashes.
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 601733b939..342e6227f2 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -81,16 +81,12 @@ Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app
Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command
{
-#if defined(Q_OS_WINCE)
- return appCmdShow;
-#else
STARTUPINFO startupInfo;
GetStartupInfo(&startupInfo);
return (startupInfo.dwFlags & STARTF_USESHOWWINDOW)
? startupInfo.wShowWindow
: SW_SHOWDEFAULT;
-#endif
}
Q_CORE_EXPORT QString qAppFileName() // get application file name
@@ -143,7 +139,7 @@ QString QCoreApplicationPrivate::appName() const
qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp
*****************************************************************************/
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
// ### Qt6: FIXME: Consider removing this function. It is here for Active Qt
// servers and for binary for compatibility to applications built with Qt 5.3
@@ -164,30 +160,7 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
argv.append(_strdup(wArg.toLocal8Bit().constData()));
}
-#elif defined(Q_OS_WINCE)
-
-Q_CORE_EXPORT void __cdecl qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
- int cmdShow, int &argc, QVector<char *> &argv)
-{
- static bool already_called = false;
-
- if (already_called) {
- qWarning("Qt: Internal error: qWinMain should be called only once");
- return;
- }
- already_called = true;
-
- // Create command line
- argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc);
-
- appCmdShow = cmdShow;
-
- // Ignore Windows parameters
- Q_UNUSED(instance);
- Q_UNUSED(prevInstance);
-}
-
-#endif // Q_OS_WINCE
+#endif // !Q_OS_WINRT
#ifndef QT_NO_QOBJECT
@@ -205,11 +178,6 @@ QT_END_INCLUDE_NAMESPACE
# define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
# define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
#endif
-#ifdef _WIN32_WCE
-# ifndef WM_NCACTIVATE
-# define WM_NCACTIVATE 0x86
-# endif
-#endif
// The values below should never change. Note that none of the usual
// WM_...FIRST & WM_...LAST values are in the list, as they normally have other
diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h
index 2d8de08f2d..c5d9d130f0 100644
--- a/src/corelib/kernel/qcorecmdlineargs_p.h
+++ b/src/corelib/kernel/qcorecmdlineargs_p.h
@@ -81,93 +81,7 @@ static inline QStringList qWinCmdArgs(const QString &cmdLine)
return result;
}
-#elif defined(Q_OS_WINCE) // Q_OS_WIN32
-
-// template implementation of the parsing algorithm
-// this is used from qcoreapplication_win.cpp and the tools (rcc, uic...)
-
-template<typename Char>
-static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc)
-{
- QVector<Char*> argv(8);
- Char *p = cmdParam;
- Char *p_end = p + length;
-
- argc = 0;
-
- while (*p && p < p_end) { // parse cmd line arguments
- while (QChar((short)(*p)).isSpace()) // skip white space
- p++;
- if (*p && p < p_end) { // arg starts
- int quote;
- Char *start, *r;
- if (*p == Char('\"')) {
- quote = *p;
- start = ++p;
- } else {
- quote = 0;
- start = p;
- }
- r = start;
- while (*p && p < p_end) {
- if (quote) {
- if (*p == quote) {
- p++;
- if (QChar((short)(*p)).isSpace())
- break;
- quote = 0;
- }
- }
- if (*p == '\\') { // escape char?
- // testing by looking at argc, argv shows that it only escapes quotes
- if (p < p_end && (*(p+1) == Char('\"')))
- p++;
- } else {
- if (!quote && (*p == Char('\"'))) {
- quote = *p++;
- continue;
- } else if (QChar((short)(*p)).isSpace() && !quote)
- break;
- }
- if (*p)
- *r++ = *p++;
- }
- if (*p && p < p_end)
- p++;
- *r = Char('\0');
-
- if (argc >= (int)argv.size()-1) // expand array
- argv.resize(argv.size()*2);
- argv[argc++] = start;
- }
- }
- argv[argc] = 0;
-
- return argv;
-}
-
-static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified
-{
- QStringList args;
-
- int argc = 0;
- QVector<wchar_t*> argv = qWinCmdLine<wchar_t>((wchar_t *)cmdLine.utf16(), cmdLine.length(), argc);
- for (int a = 0; a < argc; ++a) {
- args << QString::fromWCharArray(argv[a]);
- }
-
- return args;
-}
-
-static inline QStringList qCmdLineArgs(int argc, char *argv[])
-{
- Q_UNUSED(argc)
- Q_UNUSED(argv)
- QString cmdLine = QString::fromWCharArray(GetCommandLine());
- return qWinCmdArgs(cmdLine);
-}
-
-#elif defined(Q_OS_WINRT) // Q_OS_WINCE
+#elif defined(Q_OS_WINRT) // Q_OS_WIN32
static inline QStringList qCmdLineArgs(int argc, char *argv[])
{
diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm
index 55f27a5b60..437e4062ad 100644
--- a/src/corelib/kernel/qeventdispatcher_cf.mm
+++ b/src/corelib/kernel/qeventdispatcher_cf.mm
@@ -210,6 +210,13 @@ QEventDispatcherCoreFoundation::~QEventDispatcherCoreFoundation()
m_cfSocketNotifier.removeSocketNotifiers();
}
+QEventLoop *QEventDispatcherCoreFoundation::currentEventLoop() const
+{
+ QEventLoop *eventLoop = QThreadData::current()->eventLoops.top();
+ Q_ASSERT(eventLoop);
+ return eventLoop;
+}
+
/*!
Processes all pending events that match \a flags until there are no
more events to process. Returns \c true if pending events were handled;
@@ -302,10 +309,7 @@ bool QEventDispatcherCoreFoundation::processEvents(QEventLoop::ProcessEventsFlag
// to exit, and then unwind back to the previous event loop which will break
// immediately, since it has already been exited.
- QEventLoop *currentEventLoop = QThreadData::current()->eventLoops.top();
- Q_ASSERT(currentEventLoop);
-
- if (!currentEventLoop->isRunning()) {
+ if (!currentEventLoop()->isRunning()) {
qEventDispatcherDebug() << "Top level event loop was exited";
break;
} else {
diff --git a/src/corelib/kernel/qeventdispatcher_cf_p.h b/src/corelib/kernel/qeventdispatcher_cf_p.h
index c2592cacc8..e6581e2bac 100644
--- a/src/corelib/kernel/qeventdispatcher_cf_p.h
+++ b/src/corelib/kernel/qeventdispatcher_cf_p.h
@@ -228,6 +228,8 @@ public:
void flush();
protected:
+ QEventLoop *currentEventLoop() const;
+
virtual bool processPostedEvents();
struct ProcessEventsState
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 166e509635..e05de4f085 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -63,11 +63,7 @@ extern uint qGlobalPostedEventsCount();
#endif
#ifndef QS_RAWINPUT
-# ifdef Q_OS_WINCE
-# define QS_RAWINPUT 0x0000
-# else
# define QS_RAWINPUT 0x0400
-# endif
#endif
#ifndef WM_TOUCH
@@ -89,230 +85,14 @@ enum {
SendPostedEventsWindowsTimerId = ~1u
};
-#if defined(Q_OS_WINCE)
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <winsock.h>
-QT_END_INCLUDE_NAMESPACE
-// Asynchronous Winsocks ------------------------------------------
-#ifndef QT_NO_THREAD
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <qthread.h>
-#include <qmap.h>
-#include <qmutex.h>
-QT_END_INCLUDE_NAMESPACE
-
-//#define QCE_ASYNC_DEBUG
-
-namespace {
- class SocketAsyncHandler;
-
- class SocketAsyncHandler : public QThread
- {
- public:
- SocketAsyncHandler();
- ~SocketAsyncHandler();
- void run();
- void select(SOCKET sock, HWND handle, unsigned int msg, long ev);
- void removeSelect(SOCKET sock);
- void safeRemove(SOCKET sock);
- private:
- struct SockInfo {
- HWND handle;
- unsigned int msg;
- long ev;
- };
- QMap<SOCKET, SockInfo> sockets;
- QMutex mutex;
- QWaitCondition cond;
- bool supposedToDie;
- };
-
- SocketAsyncHandler::SocketAsyncHandler()
- : supposedToDie(false)
- {
- }
-
- SocketAsyncHandler::~SocketAsyncHandler()
- {
- mutex.lock();
- supposedToDie = true;
- mutex.unlock();
- cond.wakeOne();
- wait();
- while (sockets.size() > 0)
- removeSelect(sockets.begin().key());
- }
-
- void SocketAsyncHandler::removeSelect(SOCKET sock)
- {
- if (!sockets.contains(sock))
- return;
- sockets.remove(sock);
- return;
- }
-
- void SocketAsyncHandler::safeRemove(SOCKET sock)
- {
- QMutexLocker locker(&mutex);
- removeSelect(sock);
- }
-
- void SocketAsyncHandler::select(SOCKET sock, HWND handle, unsigned int msg, long ev)
- {
- QMutexLocker locker(&mutex);
-
- if (sockets.contains(sock))
- sockets.remove(sock);
-
- SockInfo info;
- info.handle = handle;
- info.msg = msg;
- info.ev = ev;
- sockets.insert(sock, info);
- cond.wakeOne();
- }
-
- void SocketAsyncHandler::run()
- {
- do {
- mutex.lock();
-
- while (!supposedToDie && sockets.isEmpty()) {
- cond.wait(&mutex);
- }
-
- if (supposedToDie) {
- mutex.unlock();
- break;
- }
-
- // Copy current items to reduce lock time
- // and to be able to use SendMessage
- QMap<SOCKET, SockInfo> currentSockets = sockets;
- mutex.unlock();
-
- fd_set readS, writeS, exS;
- FD_ZERO(&readS);
- FD_ZERO(&writeS);
- FD_ZERO(&exS);
-
- int maxFd = 0;
-
- for (QMap<SOCKET, SockInfo>::iterator it = currentSockets.begin(); it != currentSockets.end(); ++it) {
- const SockInfo &info = it.value();
- int socket = it.key();
- maxFd = qMax(maxFd, socket);
-
- if ((info.ev & FD_READ) || (info.ev & FD_CLOSE) || (info.ev & FD_ACCEPT))
- FD_SET(socket, &readS);
- if ((info.ev & FD_WRITE)|| (info.ev & FD_CONNECT))
- FD_SET(socket, &writeS);
- if (info.ev & FD_OOB)
- FD_SET(socket, &exS);
- }
-
- timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 50000;
- int result = ::select(maxFd + 1, &readS, &writeS, &exS, &timeout);
- if (result > 0) {
- HWND handle;
- unsigned int tmpMsg;
- SOCKET sock;
- HRESULT ret;
- for (QMap<SOCKET, SockInfo>::const_iterator it = currentSockets.constBegin();
- it != currentSockets.constEnd(); ++it) {
- handle = (*it).handle;
- tmpMsg = (*it).msg;
- sock = it.key();
- if (FD_ISSET(sock, &readS))
- ret = SendMessage(handle, tmpMsg, sock, FD_READ);
-
- if (FD_ISSET(sock, &writeS))
- ret = SendMessage(handle, tmpMsg, sock, FD_WRITE);
-
- if (FD_ISSET(sock, &exS))
- ret = SendMessage(handle, tmpMsg, sock, FD_OOB);
- }
- }
-
-#ifdef QCE_ASYNC_DEBUG
- else if (result == 0) { //timeout
- qDebug(" WSAAsync select timeout");
- } else if (result < 0) { // SocketError
- // This might happen because of two reasons
- // 1. We already closed a socket in between the copy and the select
- // and thus select() returns an error
- // 2. Something is really wrong, then
- // ### Loop on all descriptors, try to select and remove the
- // ### broken one.
- qWarning("WSAAsync select error %d", WSAGetLastError());
- }
-#endif
- } while(true);
- }
-} // namespace
-
-Q_GLOBAL_STATIC(SocketAsyncHandler, qt_async_handler)
-
-int WSAAsyncSelect(SOCKET sock, HWND handle, unsigned int msg, long ev)
-{
- if (sock == 0 || handle == 0 || handle == INVALID_HANDLE_VALUE) {
- WSASetLastError(WSAEINVAL);
- return SOCKET_ERROR;
- }
-
- if (msg == 0 && ev == 0)
- qt_async_handler()->safeRemove(sock);
- else
- qt_async_handler()->select(sock, handle, msg, ev);
-
- qt_async_handler()->start(QThread::LowPriority);
- WSASetLastError(0);
- return 0;
-}
-#else // QT_NO_THREAD
-int WSAAsyncSelect(SOCKET, HWND, unsigned int, long)
-{
- return SOCKET_ERROR;
-}
-#endif
-#endif // Q_OS_WINCE
-
class QEventDispatcherWin32Private;
#if !defined(DWORD_PTR) && !defined(Q_OS_WIN64)
#define DWORD_PTR DWORD
#endif
-typedef MMRESULT(WINAPI *ptimeSetEvent)(UINT, UINT, LPTIMECALLBACK, DWORD_PTR, UINT);
-typedef MMRESULT(WINAPI *ptimeKillEvent)(UINT);
-
-static ptimeSetEvent qtimeSetEvent = 0;
-static ptimeKillEvent qtimeKillEvent = 0;
-
LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
-static void resolveTimerAPI()
-{
- static bool triedResolve = false;
- if (!triedResolve) {
-#ifndef QT_NO_THREAD
- QMutexLocker locker(QMutexPool::globalInstanceGet(&triedResolve));
- if (triedResolve)
- return;
-#endif
- triedResolve = true;
-#if !defined(Q_OS_WINCE)
- qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent");
- qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent");
-#else
- qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent");
- qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent");
-#endif
- }
-}
-
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0),
getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0),
@@ -321,7 +101,6 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private()
, activateNotifiersPosted(false)
#endif
{
- resolveTimerAPI();
}
QEventDispatcherWin32Private::~QEventDispatcherWin32Private()
@@ -502,11 +281,7 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
}
}
}
-#ifdef Q_OS_WINCE
- return 0;
-#else
return q->d_func()->getMessageHook ? CallNextHookEx(0, code, wp, lp) : 0;
-#endif
}
// Provide class name and atom for the message window used by
@@ -564,16 +339,11 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch
QWindowsMessageWindowClassContext *ctx = qWindowsMessageWindowClassContext();
if (!ctx->atom)
return 0;
-#ifdef Q_OS_WINCE
- HWND parent = 0;
-#else
- HWND parent = HWND_MESSAGE;
-#endif
HWND wnd = CreateWindow(ctx->className, // classname
ctx->className, // window name
0, // style
0, 0, 0, 0, // geometry
- parent, // parent
+ HWND_MESSAGE, // parent
0, // menu handle
qWinAppInst(), // application
0); // windows creation data.
@@ -609,24 +379,27 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
Q_Q(QEventDispatcherWin32);
- int ok = 0;
+ bool ok = false;
calculateNextTimeout(t, qt_msectime());
uint interval = t->interval;
if (interval == 0u) {
// optimization for single-shot-zero-timer
QCoreApplication::postEvent(q, new QZeroTimerEvent(t->timerId));
- ok = 1;
- } else if ((interval < 20u || t->timerType == Qt::PreciseTimer) && qtimeSetEvent) {
- ok = t->fastTimerId = qtimeSetEvent(interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
- TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
+ ok = true;
+ } else if (interval < 20u || t->timerType == Qt::PreciseTimer) {
+ // 3/2016: Although MSDN states timeSetEvent() is deprecated, the function
+ // is still deemed to be the most reliable precision timer.
+ t->fastTimerId = timeSetEvent(interval, 1, qt_fast_timer_proc, DWORD_PTR(t),
+ TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
+ ok = t->fastTimerId;
}
- if (ok == 0) {
+ if (!ok) {
// user normal timers for (Very)CoarseTimers, or if no more multimedia timers available
ok = SetTimer(internalHwnd, t->timerId, interval, 0);
}
- if (ok == 0)
+ if (!ok)
qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer");
}
@@ -635,7 +408,7 @@ void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t)
if (t->interval == 0) {
QCoreApplicationPrivate::removePostedTimerEvent(t->dispatcher, t->timerId);
} else if (t->fastTimerId != 0) {
- qtimeKillEvent(t->fastTimerId);
+ timeKillEvent(t->fastTimerId);
QCoreApplicationPrivate::removePostedTimerEvent(t->dispatcher, t->timerId);
} else if (internalHwnd) {
KillTimer(internalHwnd, t->timerId);
@@ -702,7 +475,6 @@ void QEventDispatcherWin32::installMessageHook()
if (d->getMessageHook)
return;
-#ifndef Q_OS_WINCE
// setup GetMessage hook needed to drive our posted events
d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
if (Q_UNLIKELY(!d->getMessageHook)) {
@@ -710,17 +482,14 @@ void QEventDispatcherWin32::installMessageHook()
qFatal("Qt: INTERNAL ERROR: failed to install GetMessage hook: %d, %s",
errorCode, qPrintable(qt_error_string(errorCode)));
}
-#endif
}
void QEventDispatcherWin32::uninstallMessageHook()
{
Q_D(QEventDispatcherWin32);
-#ifndef Q_OS_WINCE
if (d->getMessageHook)
UnhookWindowsHookEx(d->getMessageHook);
-#endif
d->getMessageHook = 0;
}
@@ -1166,11 +935,7 @@ void QEventDispatcherWin32::activateEventNotifiers()
Q_D(QEventDispatcherWin32);
//### this could break if events are removed/added in the activation
for (int i=0; i<d->winEventNotifierList.count(); i++) {
-#if !defined(Q_OS_WINCE)
if (WaitForSingleObjectEx(d->winEventNotifierList.at(i)->handle(), 0, TRUE) == WAIT_OBJECT_0)
-#else
- if (WaitForSingleObject(d->winEventNotifierList.at(i)->handle(), 0) == WAIT_OBJECT_0)
-#endif
d->activateEventNotifier(d->winEventNotifierList.at(i));
}
}
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index a87b56cd38..773315c04f 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -138,7 +138,7 @@ struct WinTimerInfo { // internal timer info
quint64 timeout; // - when to actually fire
QObject *obj; // - object to receive events
bool inTimerEvent;
- int fastTimerId;
+ UINT fastTimerId;
};
class QZeroTimerEvent : public QTimerEvent
diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h
index 06f5ea09da..ff035fcb11 100644
--- a/src/corelib/kernel/qfunctions_p.h
+++ b/src/corelib/kernel/qfunctions_p.h
@@ -53,9 +53,7 @@
#include <QtCore/qglobal.h>
-#if defined(Q_OS_WINCE)
-# include "QtCore/qfunctions_wince.h"
-#elif defined(Q_OS_VXWORKS)
+#if defined(Q_OS_VXWORKS)
# include "QtCore/qfunctions_vxworks.h"
#elif defined(Q_OS_NACL)
# include "QtCore/qfunctions_nacl.h"
diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp
deleted file mode 100644
index 104c6fb27c..0000000000
--- a/src/corelib/kernel/qfunctions_wince.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifdef _WIN32_WCE //Q_OS_WINCE
-
-#include <windows.h>
-#include <winbase.h>
-#include <kfuncs.h>
-#include <stdio.h>
-#if _WIN32_WCE < 0x800
-# include <altcecrt.h>
-#else
-# include <fcntl.h>
-#endif
-
-#include "qplatformdefs.h"
-#include "qfunctions_wince.h"
-#include "qfunctions_fake_env_p.h"
-#include "qstring.h"
-
-QT_USE_NAMESPACE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-wchar_t* CEPrivConvCharToWide(const char* string)
-{
- size_t length = strlen(string);
- wchar_t* wString = new wchar_t[length +1];
- for (unsigned int i = 0; i < (length +1); i++)
- wString[i] = string[i];
- return wString;
-}
-
-// Time -------------------------------------------------------------
-time_t qt_wince_ftToTime_t( const FILETIME ft )
-{
- ULARGE_INTEGER li;
- li.LowPart = ft.dwLowDateTime;
- li.HighPart = ft.dwHighDateTime;
-
- // 100-nanosec to seconds
- li.QuadPart /= 10000000;
-
- // FILETIME is from 1601-01-01 T 00:00:00
- // time_t is from 1970-01-01 T 00:00:00
- // 1970 - 1601 = 369 year (89 leap years)
- //
- // ((369y*365d) + 89d) *24h *60min *60sec
- // = 11644473600 seconds
- li.QuadPart -= 11644473600;
- return li.LowPart;
-}
-
-FILETIME qt_wince_time_tToFt( time_t tt )
-{
- ULARGE_INTEGER li;
- li.QuadPart = tt;
- li.QuadPart += 11644473600;
- li.QuadPart *= 10000000;
-
- FILETIME ft;
- ft.dwLowDateTime = li.LowPart;
- ft.dwHighDateTime = li.HighPart;
- return ft;
-}
-
-// File I/O ---------------------------------------------------------
-#if _WIN32_WCE < 0x800
-int errno = 0;
-#endif
-
-int qt_wince__getdrive( void )
-{
- return 1;
-}
-
-int qt_wince__waccess( const wchar_t *path, int pmode )
-{
- DWORD res = GetFileAttributes( path );
- if ( 0xFFFFFFFF == res )
- return -1;
-
- if ( (pmode & W_OK) && (res & FILE_ATTRIBUTE_READONLY) )
- return -1;
-
- if ( (pmode & X_OK) && !(res & FILE_ATTRIBUTE_DIRECTORY) ) {
- QString file = QString::fromWCharArray(path);
- if ( !(file.endsWith(QString::fromLatin1(".exe")) ||
- file.endsWith(QString::fromLatin1(".com"))) )
- return -1;
- }
-
- return 0;
-}
-
-int qt_wince_open( const char *filename, int oflag, int pmode )
-{
- QString fn( QString::fromLatin1(filename) );
- return _wopen( (wchar_t*)fn.utf16(), oflag, pmode );
-}
-
-int qt_wince__wopen( const wchar_t *filename, int oflag, int /*pmode*/ )
-{
- wchar_t *flag;
-
- if ( oflag & _O_APPEND ) {
- if ( oflag & _O_WRONLY ) {
- flag = L"a";
- } else if ( oflag & _O_RDWR ) {
- flag = L"a+";
- }
- } else if (oflag & _O_BINARY) {
- if ( oflag & _O_WRONLY ) {
- flag = L"wb";
- } else if ( oflag & _O_RDWR ) {
- flag = L"w+b"; // slightly different from "r+" where the file must exist
- } else if ( oflag & _O_RDONLY ) {
- flag = L"rb";
- } else {
- flag = L"b";
- }
- } else {
- if ( oflag & _O_WRONLY ) {
- flag = L"wt";
- } else if ( oflag & _O_RDWR ) {
- flag = L"w+t"; // slightly different from "r+" where the file must exist
- } else if ( oflag & _O_RDONLY ) {
- flag = L"rt";
- } else {
- flag = L"t";
- }
- }
-
- int retval = (int)_wfopen( filename, flag );
- return (retval == NULL) ? -1 : retval;
-}
-
-long qt_wince__lseek( int handle, long offset, int origin )
-{
- return fseek( (FILE*)handle, offset, origin );
-}
-
-int qt_wince__read( int handle, void *buffer, unsigned int count )
-{
- return fread( buffer, 1, count, (FILE*)handle );
-}
-
-int qt_wince__write( int handle, const void *buffer, unsigned int count )
-{
- return fwrite( buffer, 1, count, (FILE*)handle );
-}
-
-int qt_wince__close( int handle )
-{
- if (!handle)
- return 0;
- return fclose( (FILE*)handle );
-}
-
-FILE *qt_wince__fdopen(int handle, const char* /*mode*/)
-{
- return (FILE*)handle;
-}
-
-FILE *qt_wince_fdopen( int handle, const char* /*mode*/ )
-{
- return (FILE*)handle;
-}
-
-void qt_wince_rewind( FILE *stream )
-{
- fseek( stream, 0L, SEEK_SET );
-}
-
-int qt_wince___fileno(FILE *f)
-{
- return (int) _fileno(f);
-}
-
-FILE *qt_wince_tmpfile( void )
-{
- static long i = 0;
- char name[16];
- sprintf( name, "tmp%i", i++ );
- return fopen( name, "r+" );
-}
-
-int qt_wince__mkdir(const char *dirname)
-{
- return CreateDirectory(reinterpret_cast<const wchar_t *> (QString(QString::fromLatin1(dirname)).utf16()), 0) ? 0 : -1;
-}
-
-int qt_wince__rmdir(const char *dirname)
-{
- return RemoveDirectory(reinterpret_cast<const wchar_t *> (QString::fromLatin1(dirname).utf16())) ? 0 : -1;
-}
-
-int qt_wince__access( const char *path, int pmode )
-{
- return _waccess(reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()),pmode);
-}
-
-int qt_wince__rename( const char *oldname, const char *newname )
-{
- return !MoveFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(oldname).utf16()), reinterpret_cast<const wchar_t *> (QString::fromLatin1(newname).utf16()));
-}
-
-int qt_wince__remove( const char *name )
-{
- return !DeleteFile(reinterpret_cast<const wchar_t *> (QString::fromLatin1(name).utf16()));
-}
-
-int qt_wince_stat( const char *path, struct stat *buffer )
-{
- WIN32_FIND_DATA finfo;
- HANDLE ff = FindFirstFile( reinterpret_cast<const wchar_t *> (QString::fromLatin1(path).utf16()), &finfo );
-
- if ( ff == INVALID_HANDLE_VALUE )
- return -1;
-
- buffer->st_ctime = qt_wince_ftToTime_t( finfo.ftCreationTime );
- buffer->st_atime = qt_wince_ftToTime_t( finfo.ftLastAccessTime );
- buffer->st_mtime = qt_wince_ftToTime_t( finfo.ftLastWriteTime );
- buffer->st_nlink = 0;
- buffer->st_size = finfo.nFileSizeLow; // ### missing high!
- buffer->st_mode = (finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG;
- buffer->st_mode |= (finfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR;
- return (FindClose(ff) == 0);
-}
-
-int qt_wince__fstat( int handle, struct stat *buffer)
-{
- BY_HANDLE_FILE_INFORMATION fInfo;
- BOOL res = GetFileInformationByHandle((HANDLE)handle, &fInfo);
-
- buffer->st_ctime = qt_wince_ftToTime_t( fInfo.ftCreationTime );
- buffer->st_atime = qt_wince_ftToTime_t( fInfo.ftLastAccessTime );
- buffer->st_mtime = qt_wince_ftToTime_t( fInfo.ftLastWriteTime );
- buffer->st_nlink = 0;
- buffer->st_size = fInfo.nFileSizeLow; // ### missing high!
- buffer->st_mode = (fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR : _S_IFREG;
- buffer->st_mode |= (fInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _O_RDONLY : _O_RDWR;
- return (res == 0);
-}
-
-int qt_wince_SetErrorMode(int newValue)
-{
- static int oldValue;
- int result = oldValue;
- oldValue = newValue;
- return result;
-}
-
-bool qt_wince__chmod(const char *file, int mode)
-{
- return _wchmod( reinterpret_cast<const wchar_t *> (QString::fromLatin1(file).utf16()), mode);
-}
-
-bool qt_wince__wchmod(const wchar_t *file, int mode)
-{
- BOOL success = FALSE;
- // ### Does not work properly, what about just adding one property?
- if(mode&_S_IWRITE) {
- success = SetFileAttributes(file, FILE_ATTRIBUTE_NORMAL);
- } else if((mode&_S_IREAD) && !(mode&_S_IWRITE)) {
- success = SetFileAttributes(file, FILE_ATTRIBUTE_READONLY);
- }
- return success ? 0 : -1;
-}
-
-HANDLE qt_wince_CreateFileA(LPCSTR filename, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attr, DWORD dispo, DWORD flags, HANDLE tempFile)
-{
- return CreateFileW( reinterpret_cast<const wchar_t *>(QString::fromLatin1(filename).utf16()), access, share, attr, dispo, flags, tempFile);
-}
-
-// Graphics ---------------------------------------------------------
-BOOL qt_wince_SetWindowOrgEx( HDC /*hdc*/, int /*X*/, int /*Y*/, LPPOINT /*lpPoint*/) {
- return TRUE;
-}
-
-// Threading --------------------------------------------------------
-HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist)
-{
- unsigned initflag = 0;
- if (stack_size > 0)
- initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION;
- return CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, initflag, NULL);
-}
-
-unsigned long qt_wince__beginthreadex( void *security,
- unsigned stack_size,
- unsigned (__stdcall *start_address)(void *),
- void *arglist,
- unsigned initflag,
- unsigned *thrdaddr)
-{
- if (stack_size > 0)
- initflag |= STACK_SIZE_PARAM_IS_A_RESERVATION;
- return (unsigned long)
- CreateThread( (LPSECURITY_ATTRIBUTES)security,
- (DWORD)stack_size,
- (LPTHREAD_START_ROUTINE)start_address,
- (LPVOID)arglist,
- (DWORD)initflag | CREATE_SUSPENDED,
- (LPDWORD)thrdaddr);
-}
-
-void qt_wince__endthreadex(unsigned nExitCode) {
- ExitThread((DWORD)nExitCode);
-}
-
-void *qt_wince_bsearch(const void *key,
- const void *base,
- size_t num,
- size_t size,
- int (__cdecl *compare)(const void *, const void *))
-{
- size_t low = 0;
- size_t high = num - 1;
- while (low <= high) {
- size_t mid = (low + high) >> 1;
- int c = compare(key, (char*)base + mid * size);
- if (c < 0) {
- if (!mid)
- break;
- high = mid - 1;
- } else if (c > 0)
- low = mid + 1;
- else
- return (char*) base + mid * size;
- }
- return 0;
-}
-
-void *lfind(const void* key, const void* base, size_t* elements, size_t size,
- int (__cdecl *compare)(const void*, const void*))
-{
- const char* current = (char*) base;
- const char* const end = (char*) (current + (*elements) * size);
- while (current != end) {
- if (compare(current, key) == 0)
- return (void*)current;
- current += size;
- }
- return 0;
-}
-
-DWORD qt_wince_GetThreadLocale(void)
-{
- return GetUserDefaultLCID();
-}
-
-void *qt_wince_calloc( size_t num, size_t size )
-{
- void *ptr = malloc( num * size );
- if( ptr )
- memset( ptr, 0, num * size );
- return ptr;
-}
-
-// _getpid is currently only used for creating a temporary filename
-int qt_wince__getpid()
-{
- return qAbs((int)GetCurrentProcessId());
-}
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-#endif // Q_OS_WINCE
diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h
deleted file mode 100644
index 030950e1bd..0000000000
--- a/src/corelib/kernel/qfunctions_wince.h
+++ /dev/null
@@ -1,473 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFUNCTIONS_WINCE_H
-#define QFUNCTIONS_WINCE_H
-
-#include <QtCore/qglobal.h>
-
-#ifdef Q_OS_WINCE
-# ifndef NOMINMAX
-# define NOMINMAX
-# endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <winuser.h>
-#include <winbase.h>
-#include <objbase.h>
-#include <kfuncs.h>
-#include <ctype.h>
-#include <time.h>
-#include <crtdefs.h>
-#if _WIN32_WCE < 0x800
-# include <altcecrt.h>
-#else
-# include <fcntl.h>
-# include <stat.h>
-#endif
-#include <winsock.h>
-#include <ceconfig.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef QT_BUILD_CORE_LIB
-#endif
-
-QT_END_NAMESPACE
-
-// The standard SDK misses this define...
-#define _control87 _controlfp
-
-#if !defined __cplusplus
-#define bool int
-#define true 1
-#define false 0
-#endif
-
-// Environment ------------------------------------------------------
-errno_t qt_fake_getenv_s(size_t*, char*, size_t, const char*);
-errno_t qt_fake__putenv_s(const char*, const char*);
-
-#ifdef __cplusplus // have this as tiff plugin is written in C
-extern "C" {
-#endif
-
-#if !defined(NO_ERRNO_H)
-#define NO_ERRNO_H
-#endif
-
-// Environment ------------------------------------------------------
-int qt_wince__getpid(void);
-
-
-// Time -------------------------------------------------------------
-#ifndef _TM_DEFINED
-#define _TM_DEFINED
-struct tm {
- int tm_sec; /* seconds after the minute - [0,59] */
- int tm_min; /* minutes after the hour - [0,59] */
- int tm_hour; /* hours since midnight - [0,23] */
- int tm_mday; /* day of the month - [1,31] */
- int tm_mon; /* months since January - [0,11] */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday - [0,6] */
- int tm_yday; /* days since January 1 - [0,365] */
- int tm_isdst; /* daylight-saving time flag */
-};
-#endif // _TM_DEFINED
-
-FILETIME qt_wince_time_tToFt( time_t tt );
-time_t qt_wince_ftToTime_t( const FILETIME ft );
-
-#if _WIN32_WCE < 0x800
-
-// File I/O ---------------------------------------------------------
-#define _O_RDONLY 0x0001
-#define _O_RDWR 0x0002
-#define _O_WRONLY 0x0004
-#define _O_CREAT 0x0008
-#define _O_TRUNC 0x0010
-#define _O_APPEND 0x0020
-#define _O_EXCL 0x0040
-
-#define O_RDONLY _O_RDONLY
-#define O_RDWR _O_RDWR
-#define O_WRONLY _O_WRONLY
-#define O_CREAT _O_CREAT
-#define O_TRUNC _O_TRUNC
-#define O_APPEND _O_APPEND
-#define O_EXCL _O_EXCL
-
-#define _S_IFMT 0x0600
-#define _S_IFDIR 0x0200
-#define _S_IFCHR 0x0100
-#define _S_IFREG 0x0400
-#define _S_IREAD 0x0010
-#define _S_IWRITE 0x0008
-
-#define S_IFMT _S_IFMT
-#define S_IFDIR _S_IFDIR
-#define S_IFCHR _S_IFCHR
-#define S_IFREG _S_IFREG
-#define S_IREAD _S_IREAD
-#define S_IWRITE _S_IWRITE
-
-#ifndef _IOFBF
-#define _IOFBF 0x0000
-#endif
-
-#ifndef _IOLBF
-#define _IOLBF 0x0040
-#endif
-
-#ifndef _IONBF
-#define _IONBF 0x0004
-#endif
-
-// Regular Berkeley error constants
-#ifndef _STAT_DEFINED
-#define _STAT_DEFINED
-struct stat
-{
- int st_mode;
- int st_size;
- int st_nlink;
- time_t st_mtime;
- time_t st_atime;
- time_t st_ctime;
-};
-#endif
-
-typedef int mode_t;
-extern int errno;
-#endif // _WIN32_WCE < 0x800
-
-int qt_wince__getdrive( void );
-int qt_wince__waccess( const wchar_t *path, int pmode );
-int qt_wince__wopen( const wchar_t *filename, int oflag, int pmode );
-long qt_wince__lseek( int handle, long offset, int origin );
-int qt_wince__read( int handle, void *buffer, unsigned int count );
-int qt_wince__write( int handle, const void *buffer, unsigned int count );
-int qt_wince__close( int handle );
-FILE *qt_wince__fdopen(int handle, const char *mode);
-FILE *qt_wince_fdopen(int handle, const char *mode);
-void qt_wince_rewind( FILE *stream );
-int qt_wince___fileno(FILE *);
-FILE *qt_wince_tmpfile( void );
-
-//For zlib we need these helper functions, but they break the build when
-//set globally, so just set them for zlib use
-#ifdef ZLIB_H
-#define open qt_wince_open
-#define close qt_wince__close
-#define lseek qt_wince__lseek
-#define read qt_wince__read
-#define write qt_wince__write
-#endif
-
-int qt_wince__mkdir(const char *dirname);
-int qt_wince__rmdir(const char *dirname);
-int qt_wince__access( const char *path, int pmode );
-int qt_wince__rename( const char *oldname, const char *newname );
-int qt_wince__remove( const char *name );
-#ifdef __cplusplus
-int qt_wince_open( const char *filename, int oflag, int pmode = 0 );
-#else
-int qt_wince_open( const char *filename, int oflag, int pmode );
-#endif
-int qt_wince_stat( const char *path, struct stat *buffer );
-int qt_wince__fstat( int handle, struct stat *buffer);
-
-#define SEM_FAILCRITICALERRORS 0x0001
-#define SEM_NOOPENFILEERRORBOX 0x0002
-int qt_wince_SetErrorMode(int);
-#ifndef CoInitialize
-#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED)
-#endif
-
-bool qt_wince__chmod(const char *file, int mode);
-bool qt_wince__wchmod(const wchar_t *file, int mode);
-
-QT_WARNING_DISABLE_MSVC(4273)
-HANDLE qt_wince_CreateFileA(LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
-
-// Printer ----------------------------------------------------------
-#define ETO_GLYPH_INDEX 0x0010
-
-// Graphics ---------------------------------------------------------
-#ifndef SM_CXCURSOR
-# define SM_CXCURSOR 13
-#endif
-#ifndef SM_CYCURSOR
-# define SM_CYCURSOR 14
-#endif
-BOOL qt_wince_SetWindowOrgEx( HDC hdc, int X, int Y, LPPOINT lpPoint );
-
-// Other stuff ------------------------------------------------------
-#define MWMO_ALERTABLE 0x0002
-// ### not the real values
-#define CREATE_NO_WINDOW 2
-#define CF_HDROP 15
-
-void *qt_wince_calloc(size_t num, size_t size);
-#if !defined(TLS_OUT_OF_INDEXES)
-# define TLS_OUT_OF_INDEXES 0xffffffff
-#endif
-DWORD qt_wince_GetThreadLocale(void);
-
-HANDLE qt_wince__beginthread(void( *start_address )( void * ), unsigned stack_size, void *arglist);
-
-unsigned long qt_wince__beginthreadex( void *security,
- unsigned stack_size,
- unsigned (__stdcall *start_address)(void *),
- void *arglist,
- unsigned initflag,
- unsigned *thrdaddr );
-void qt_wince__endthreadex(unsigned nExitCode);
-
-
-// bsearch is needed for building the tiff plugin
-// otherwise it could go into qguifunctions_wce
-void *qt_wince_bsearch(const void *key,
- const void *base,
- size_t num,
- size_t size,
- int (__cdecl *compare)(const void *, const void *));
-
-// Missing typedefs
-#ifndef _TIME_T_DEFINED
-typedef unsigned long time_t;
-#define _TIME_T_DEFINED
-#endif
-typedef HANDLE HDROP;
-
-#ifndef WS_THICKFRAME
-#define WS_THICKFRAME WS_DLGFRAME
-#endif
-
-typedef UINT UWORD;
-
-// Missing definitions: not necessary equal to their Win32 values
-// (the goal is to just have a clean compilation of MFC)
-#define WS_MAXIMIZE 0
-#define WS_MINIMIZE 0
-#ifndef WS_EX_TOOLWINDOW
-#define WS_EX_TOOLWINDOW 0
-#endif
-#define WS_EX_NOPARENTNOTIFY 0
-#define WM_ENTERIDLE 0x0121
-#define WM_PRINT WM_PAINT
-#define WM_NCCREATE (0x0081)
-#define WM_PARENTNOTIFY 0
-#define WM_NCDESTROY (WM_APP-1)
-#ifndef SW_RESTORE
-#define SW_RESTORE (SW_SHOWNORMAL)
-#endif
-#define SW_NORMAL (SW_SHOWNORMAL)
-#define WAIT_OBJECT_0 0x00000000L
-#define DEFAULT_GUI_FONT SYSTEM_FONT
-#ifndef SWP_NOREDRAW
-#define SWP_NOREDRAW 0
-#endif
-#define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
-#define HWND_TOPMOST ((HWND)-1)
-#define HWND_NOTOPMOST ((HWND)-2)
-#define PS_DOT 2
-#define PD_ALLPAGES 0
-#define PD_USEDEVMODECOPIES 0
-#define PD_NOSELECTION 0
-#define PD_HIDEPRINTTOFILE 0
-#define PD_NOPAGENUMS 0
-#define CF_METAFILEPICT 3
-#define MM_ANISOTROPIC 8
-#define KF_ALTDOWN 0x2000
-#define SPI_GETWORKAREA 48
-
-#ifndef WM_SETCURSOR
- #define WM_SETCURSOR 0x0020
- #define IDC_ARROW MAKEINTRESOURCE(32512)
- #define IDC_IBEAM MAKEINTRESOURCE(32513)
- #define IDC_WAIT MAKEINTRESOURCE(32514)
- #define IDC_CROSS MAKEINTRESOURCE(32515)
- #define IDC_UPARROW MAKEINTRESOURCE(32516)
- #define IDC_SIZE MAKEINTRESOURCE(32646)
- #define IDC_ICON MAKEINTRESOURCE(32512)
- #define IDC_SIZENWSE MAKEINTRESOURCE(32642)
- #define IDC_SIZENESW MAKEINTRESOURCE(32643)
- #define IDC_SIZEWE MAKEINTRESOURCE(32644)
- #define IDC_SIZENS MAKEINTRESOURCE(32645)
- #define IDC_SIZEALL MAKEINTRESOURCE(32646)
- #define IDC_NO MAKEINTRESOURCE(32648)
- #define IDC_APPSTARTING MAKEINTRESOURCE(32650)
- #define IDC_HELP MAKEINTRESOURCE(32651)
- #define IDC_HAND MAKEINTRESOURCE(32649)
-#endif
-
-#define GMEM_MOVEABLE LMEM_MOVEABLE
-#define GPTR LPTR
-
-// WinCE: CESYSGEN prunes the following FRP defines,
-// and INTERNET_TRANSFER_TYPE_ASCII breaks in wininet.h
-#undef FTP_TRANSFER_TYPE_ASCII
-#define FTP_TRANSFER_TYPE_ASCII 0x00000001
-#undef FTP_TRANSFER_TYPE_BINARY
-#define FTP_TRANSFER_TYPE_BINARY 0x00000002
-
-typedef DWORD OLE_COLOR;
-
-// Define the Windows Styles which are not defined by MS
-#ifndef WS_POPUPWINDOW
-#define WS_POPUPWINDOW WS_POPUP|WS_BORDER|WS_SYSMENU|WS_CAPTION
-#endif
-
-#ifndef WS_OVERLAPPEDWINDOW
-#define WS_OVERLAPPEDWINDOW WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX
-#endif
-
-#ifndef WS_TILED
-#define WS_TILED WS_OVERLAPPED
-#endif
-
-#ifndef WS_TILEDWINDOW
-#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW
-#endif
-
-#ifndef WS_EX_CAPTIONOKBTN
-#define WS_EX_CAPTIONOKBTN 0x80000000L
-#endif
-
-#ifndef WS_EX_NODRAG
-#define WS_EX_NODRAG 0x40000000L
-#endif
-
-#ifdef __cplusplus
-} // Extern C.
-#endif
-
-#ifdef __cplusplus
-
-
-// As Windows CE lacks some standard functions used in Qt, these got
-// reimplemented. Other projects do this as well. Inline functions are used
-// that there is a central place to disable functions for newer versions if
-// they get available. There are no defines used anymore, because this
-// will break member functions of classes which are called like these
-// functions. Also inline functions are only supported by C++, so just define
-// them for C++, as only 3rd party dependencies are C, this is no issue.
-// The other declarations available in this file are being used per
-// define inside qplatformdefs.h of the corresponding WinCE mkspec.
-
-#define generate_inline_return_func0(funcname, returntype) \
- inline returntype funcname() \
- { \
- return qt_wince_##funcname(); \
- }
-#define generate_inline_return_func1(funcname, returntype, param1) \
- inline returntype funcname(param1 p1) \
- { \
- return qt_wince_##funcname(p1); \
- }
-#define generate_inline_return_func2(funcname, returntype, prependnamespace, param1, param2) \
- inline returntype funcname(param1 p1, param2 p2) \
- { \
- return prependnamespace##funcname(p1, p2); \
- }
-#define generate_inline_return_func3(funcname, returntype, param1, param2, param3) \
- inline returntype funcname(param1 p1, param2 p2, param3 p3) \
- { \
- return qt_wince_##funcname(p1, p2, p3); \
- }
-#define generate_inline_return_func4(funcname, returntype, prependnamespace, param1, param2, param3, param4) \
- inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4) \
- { \
- return prependnamespace##funcname(p1, p2, p3, p4); \
- }
-#define generate_inline_return_func5(funcname, returntype, param1, param2, param3, param4, param5) \
- inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
- { \
- return qt_wince_##funcname(p1, p2, p3, p4, p5); \
- }
-#define generate_inline_return_func6(funcname, returntype, param1, param2, param3, param4, param5, param6) \
- inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
- { \
- return qt_wince_##funcname(p1, p2, p3, p4, p5, p6); \
- }
-#define generate_inline_return_func7(funcname, returntype, param1, param2, param3, param4, param5, param6, param7) \
- inline returntype funcname(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) \
- { \
- return qt_wince_##funcname(p1, p2, p3, p4, p5, p6, p7); \
- }
-
-typedef unsigned (__stdcall *StartAdressExFunc)(void *);
-typedef void(*StartAdressFunc)(void *);
-typedef int ( __cdecl *CompareFunc ) (const void *, const void *) ;
-
-generate_inline_return_func4(getenv_s, errno_t, qt_fake_, size_t *, char *, size_t, const char *)
-generate_inline_return_func2(_putenv_s, errno_t, qt_fake_, const char *, const char *)
-generate_inline_return_func0(_getpid, int)
-generate_inline_return_func1(time_tToFt, FILETIME, time_t)
-generate_inline_return_func1(ftToTime_t, time_t, FILETIME)
-generate_inline_return_func0(_getdrive, int)
-generate_inline_return_func2(_waccess, int, qt_wince_, const wchar_t *, int)
-generate_inline_return_func3(_wopen, int, const wchar_t *, int, int)
-generate_inline_return_func2(_fdopen, FILE *, qt_wince_, int, const char *)
-generate_inline_return_func2(fdopen, FILE *, qt_wince_, int, const char *)
-generate_inline_return_func1(rewind, void, FILE *)
-generate_inline_return_func0(tmpfile, FILE *)
-generate_inline_return_func2(_rename, int, qt_wince_, const char *, const char *)
-generate_inline_return_func1(_remove, int, const char *)
-generate_inline_return_func1(SetErrorMode, int, int)
-#if _WIN32_WCE < 0x800
-generate_inline_return_func2(_chmod, bool, qt_wince_, const char *, int)
-generate_inline_return_func2(_wchmod, bool, qt_wince_, const wchar_t *, int)
-#endif
-generate_inline_return_func7(CreateFileA, HANDLE, LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE)
-generate_inline_return_func4(SetWindowOrgEx, BOOL, qt_wince_, HDC, int, int, LPPOINT)
-generate_inline_return_func2(calloc, void *, qt_wince_, size_t, size_t)
-generate_inline_return_func0(GetThreadLocale, DWORD)
-generate_inline_return_func3(_beginthread, HANDLE, StartAdressFunc, unsigned, void *)
-generate_inline_return_func6(_beginthreadex, unsigned long, void *, unsigned, StartAdressExFunc, void *, unsigned, unsigned *)
-generate_inline_return_func1(_endthreadex, void, unsigned)
-generate_inline_return_func5(bsearch, void *, const void *, const void *, size_t, size_t, CompareFunc)
-
-#endif //__cplusplus
-
-#endif // Q_OS_WINCE
-#endif // QFUNCTIONS_WINCE_H
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index c24fc3a0ce..773884047a 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -45,6 +45,7 @@
#endif
#include <QtCore/qglobal.h>
+#include <QtCore/qalgorithms.h>
#ifndef _USE_MATH_DEFINES
# define _USE_MATH_DEFINES
@@ -241,20 +242,12 @@ Q_DECL_CONSTEXPR inline double qRadiansToDegrees(double radians)
}
-#if defined(Q_CC_GNU)
-// clz instructions exist in at least MIPS, ARM, PowerPC and X86, so we can assume this builtin always maps to an efficient instruction.
+#if defined(QT_HAS_BUILTIN_CLZ)
inline quint32 qNextPowerOfTwo(quint32 v)
{
if (v == 0)
return 1;
- return 2U << (31 ^ __builtin_clz(v));
-}
-
-inline quint64 qNextPowerOfTwo(quint64 v)
-{
- if (v == 0)
- return 1;
- return Q_UINT64_C(2) << (63 ^ __builtin_clzll(v));
+ return 2U << (31 ^ QAlgorithmsPrivate::qt_builtin_clz(v));
}
#else
inline quint32 qNextPowerOfTwo(quint32 v)
@@ -267,7 +260,16 @@ inline quint32 qNextPowerOfTwo(quint32 v)
++v;
return v;
}
+#endif
+#if defined(QT_HAS_BUILTIN_CLZLL)
+inline quint64 qNextPowerOfTwo(quint64 v)
+{
+ if (v == 0)
+ return 1;
+ return Q_UINT64_C(2) << (63 ^ QAlgorithmsPrivate::qt_builtin_clzll(v));
+}
+#else
inline quint64 qNextPowerOfTwo(quint64 v)
{
v |= v >> 1;
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index f7c60cc309..4d114a5616 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -168,19 +168,15 @@ public:
inline bool isValid() const { return mobj != Q_NULLPTR; }
-#ifdef Q_QDOC
- static QMetaMethod fromSignal(PointerToMemberFunction signal);
-#else
- template <typename Func>
- static inline QMetaMethod fromSignal(Func signal)
+ template <typename PointerToMemberFunction>
+ static inline QMetaMethod fromSignal(PointerToMemberFunction signal)
{
- typedef QtPrivate::FunctionPointer<Func> SignalType;
+ typedef QtPrivate::FunctionPointer<PointerToMemberFunction> SignalType;
Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
"No Q_OBJECT in the class with the signal");
return fromSignalImpl(&SignalType::Object::staticMetaObject,
reinterpret_cast<void **>(&signal));
}
-#endif
private:
#if QT_DEPRECATED_SINCE(5,0)
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index 0790af2bb5..9b67d63524 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -168,6 +168,7 @@ class QMutex;
struct QMetaObjectPrivate
{
+ // revision 7 is Qt 5.0 everything lower is not supported
enum { OutputRevision = 7 }; // Used by moc, qmetaobjectbuilder and qdbus
int revision;
@@ -176,12 +177,9 @@ struct QMetaObjectPrivate
int methodCount, methodData;
int propertyCount, propertyData;
int enumeratorCount, enumeratorData;
- int constructorCount, constructorData; //since revision 2
- int flags; //since revision 3
- int signalCount; //since revision 4
- // revision 5 introduces changes in normalized signatures, no new members
- // revision 6 added qt_static_metacall as a member of each Q_OBJECT and inside QMetaObject itself
- // revision 7 is Qt 5
+ int constructorCount, constructorData;
+ int flags;
+ int signalCount;
static inline const QMetaObjectPrivate *get(const QMetaObject *metaobject)
{ return reinterpret_cast<const QMetaObjectPrivate*>(metaobject->d.data); }
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 3ac1f28638..cf0e88c7cd 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -870,8 +870,7 @@ const char *QMetaType::typeName(int typeId)
return result;
}
-/*!
- \internal
+/*
Similar to QMetaType::type(), but only looks in the static set of types.
*/
static inline int qMetaTypeStaticType(const char *typeName, int length)
@@ -884,8 +883,7 @@ static inline int qMetaTypeStaticType(const char *typeName, int length)
return types[i].type;
}
-/*!
- \internal
+/*
Similar to QMetaType::type(), but only looks in the custom set of
types, and doesn't lock the mutex.
The extra \a firstInvalidIndex parameter is an easy way to avoid
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index b68dbacbd3..a36d247c3c 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -506,11 +506,8 @@ public:
static int registerTypedef(const char *typeName, int aliasId);
static int registerNormalizedTypedef(const QT_PREPEND_NAMESPACE(QByteArray) &normalizedTypeName, int aliasId);
static int type(const char *typeName);
-#ifndef Q_QDOC
+
static int type(const QT_PREPEND_NAMESPACE(QByteArray) &typeName);
-#else
- static int type(const QByteArray &typeName);
-#endif
static const char *typeName(int type);
static int sizeOf(int type);
static TypeFlags typeFlags(int type);
@@ -600,8 +597,11 @@ public:
}
#ifdef Q_QDOC
+ template<typename MemberFunction, int>
static bool registerConverter(MemberFunction function);
+ template<typename MemberFunctionOk, char>
static bool registerConverter(MemberFunctionOk function);
+ template<typename UnaryFunction>
static bool registerConverter(UnaryFunction function);
#else
// member function as in "QString QFont::toString() const"
@@ -1857,6 +1857,7 @@ inline int qRegisterMetaTypeStreamOperators()
} QT_END_NAMESPACE \
/**/
+#ifndef Q_MOC_RUN
#define Q_DECLARE_METATYPE(TYPE) Q_DECLARE_METATYPE_IMPL(TYPE)
#define Q_DECLARE_METATYPE_IMPL(TYPE) \
QT_BEGIN_NAMESPACE \
@@ -1876,7 +1877,7 @@ inline int qRegisterMetaTypeStreamOperators()
} \
}; \
QT_END_NAMESPACE
-
+#endif // Q_MOC_RUN
#define Q_DECLARE_BUILTIN_METATYPE(TYPE, METATYPEID, NAME) \
QT_BEGIN_NAMESPACE \
@@ -1899,7 +1900,9 @@ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER)
typedef QList<QVariant> QVariantList;
typedef QMap<QString, QVariant> QVariantMap;
typedef QHash<QString, QVariant> QVariantHash;
+#ifndef Q_QDOC
typedef QList<QByteArray> QByteArrayList;
+#endif
#define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \
QT_BEGIN_NAMESPACE \
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index c06f702b30..3cec9802dc 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -210,8 +210,11 @@ public:
const char *member, Qt::ConnectionType type = Qt::AutoConnection) const;
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection);
+ template<typename PointerToMemberFunction, typename Functor>
static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor);
+ template<typename PointerToMemberFunction, typename Functor>
static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection);
#else
//Connect a signal to a pointer to qobject member function
@@ -337,6 +340,7 @@ public:
static bool disconnect(const QMetaObject::Connection &);
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
static bool disconnect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method);
#else
template <typename Func1, typename Func2>
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index aa68c9c1ad..d7ae63a98c 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -97,7 +97,7 @@ namespace QtPrivate {
inline void destroyIfLastRef() Q_DECL_NOTHROW
{ if (!m_ref.deref()) m_impl(Destroy, this, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR); }
- inline bool compare(void **a) { bool ret; m_impl(Compare, this, Q_NULLPTR, a, &ret); return ret; }
+ inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, Q_NULLPTR, a, &ret); return ret; }
inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, Q_NULLPTR); }
protected:
~QSlotObjectBase() {}
@@ -143,10 +143,9 @@ namespace QtPrivate {
case Call:
FuncType::template call<Args, R>(static_cast<QStaticSlotObject*>(this_)->function, r, a);
break;
- case Compare:
- *ret = false; // not implemented
- break;
- case NumOperations: ;
+ case Compare: // not implemented
+ case NumOperations:
+ Q_UNUSED(ret);
}
}
public:
@@ -168,10 +167,9 @@ namespace QtPrivate {
case Call:
FuncType::template call<Args, R>(static_cast<QFunctorSlotObject*>(this_)->function, r, a);
break;
- case Compare:
- *ret = false; // not implemented
- break;
- case NumOperations: ;
+ case Compare: // not implemented
+ case NumOperations:
+ Q_UNUSED(ret);
}
}
public:
diff --git a/src/corelib/kernel/qppsobject.cpp b/src/corelib/kernel/qppsobject.cpp
index dbff997c88..f716c1a92e 100644
--- a/src/corelib/kernel/qppsobject.cpp
+++ b/src/corelib/kernel/qppsobject.cpp
@@ -397,12 +397,12 @@ QByteArray QPpsObjectPrivate::encode(const QVariantMap &ppsData, bool *ok)
void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, const QVariant &data,
bool *ok)
{
- QString errorFunction;
+ const char *errorFunction;
pps_encoder_error_t error = PPS_ENCODER_OK;
switch (data.type()) {
case QVariant::Bool:
error = pps_encoder_add_bool(encoder, name, data.toBool());
- errorFunction = QStringLiteral("pps_encoder_add_bool");
+ errorFunction = "pps_encoder_add_bool";
break;
// We want to support encoding uint even though libpps doesn't support it directly.
// We can't encode uint as an int since that will lose precision (e.g. 2^31+1 can't be
@@ -411,41 +411,41 @@ void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, con
case QVariant::UInt:
case QVariant::Double:
error = pps_encoder_add_double(encoder, name, data.toDouble());
- errorFunction = QStringLiteral("pps_encoder_add_double");
+ errorFunction = "pps_encoder_add_double";
break;
case QVariant::Int:
error = pps_encoder_add_int(encoder, name, data.toInt());
- errorFunction = QStringLiteral("pps_encoder_add_int");
+ errorFunction = "pps_encoder_add_int";
break;
case QVariant::LongLong:
error = pps_encoder_add_int64(encoder, name, data.toLongLong());
- errorFunction = QStringLiteral("pps_encoder_add_int64");
+ errorFunction = "pps_encoder_add_int64";
break;
case QVariant::String:
error = pps_encoder_add_string(encoder, name, data.toString().toUtf8().constData());
- errorFunction = QStringLiteral("pps_encoder_add_string");
+ errorFunction = "pps_encoder_add_string";
break;
case QVariant::List:
error = pps_encoder_start_array(encoder, name);
- errorFunction = QStringLiteral("pps_encoder_start_array");
+ errorFunction = "pps_encoder_start_array";
if (error == PPS_ENCODER_OK) {
encodeArray(encoder, data.toList(), ok);
error = pps_encoder_end_array(encoder);
- errorFunction = QStringLiteral("pps_encoder_end_array");
+ errorFunction = "pps_encoder_end_array";
}
break;
case QVariant::Map:
error = pps_encoder_start_object(encoder, name);
- errorFunction = QStringLiteral("pps_encoder_start_object");
+ errorFunction = "pps_encoder_start_object";
if (error == PPS_ENCODER_OK) {
encodeObject(encoder, data.toMap(), ok);
error = pps_encoder_end_object(encoder);
- errorFunction = QStringLiteral("pps_encoder_end_object");
+ errorFunction = "pps_encoder_end_object";
}
break;
case QVariant::Invalid:
error = pps_encoder_add_null(encoder, name);
- errorFunction = QStringLiteral("pps_encoder_add_null");
+ errorFunction = "pps_encoder_add_null";
break;
default:
qWarning("QPpsObjectPrivate::encodeData: the type of the parameter data is invalid");
@@ -454,7 +454,7 @@ void QPpsObjectPrivate::encodeData(pps_encoder_t *encoder, const char *name, con
}
if (error != PPS_ENCODER_OK) {
- qWarning() << "QPpsObjectPrivate::encodeData: " << errorFunction << " failed";
+ qWarning("QPpsObjectPrivate::encodeData: %s failed", errorFunction);
*ok = false;
} else {
*ok = true;
diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp
index e998b938c7..07d4930332 100644
--- a/src/corelib/kernel/qsharedmemory_win.cpp
+++ b/src/corelib/kernel/qsharedmemory_win.cpp
@@ -64,8 +64,8 @@ void QSharedMemoryPrivate::setErrorString(QLatin1String function)
errorString = QSharedMemory::tr("%1: already exists").arg(function);
break;
case ERROR_FILE_NOT_FOUND:
-#if defined(Q_OS_WINCE) || (defined(Q_OS_WINRT) && _MSC_VER < 1900)
- // This happens on CE only if no file is present as CreateFileMappingW
+#if defined(Q_OS_WINRT) && _MSC_VER < 1900
+ // This happens on WinRT only if no file is present as CreateFileMappingW
// bails out with this error code
case ERROR_INVALID_PARAMETER:
#endif
@@ -112,10 +112,6 @@ HANDLE QSharedMemoryPrivate::handle()
#else
hand = CreateFileMappingFromApp(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, (PCWSTR)nativeKey.utf16());
#endif
-#elif defined(Q_OS_WINCE)
- // This works for opening a mapping too, but always opens it with read/write access in
- // attach as it seems.
- hand = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 0, (wchar_t*)nativeKey.utf16());
#else
hand = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, (wchar_t*)nativeKey.utf16());
#endif
diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp
index 12fd5404da..f38daec4f8 100644
--- a/src/corelib/kernel/qsystemerror.cpp
+++ b/src/corelib/kernel/qsystemerror.cpp
@@ -39,15 +39,9 @@
#include <qglobal.h>
#include "qsystemerror_p.h"
-#if !defined(Q_OS_WINCE)
-# include <errno.h>
-# if defined(Q_CC_MSVC)
-# include <crtdbg.h>
-# endif
-#else
-# if (_WIN32_WCE >= 0x700)
-# include <errno.h>
-# endif
+#include <errno.h>
+#if defined(Q_CC_MSVC)
+# include <crtdbg.h>
#endif
#ifdef Q_OS_WIN
# include <qt_windows.h>
@@ -131,16 +125,12 @@ static QString standardLibraryErrorString(int errorCode)
s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
break;
default: {
- #ifdef Q_OS_WINCE
- ret = windowsErrorString(errorCode);
- #else
- #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
+ #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
QByteArray buf(1024, '\0');
ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
- #else
+ #else
ret = QString::fromLocal8Bit(strerror(errorCode));
- #endif
- #endif
+ #endif
break; }
}
if (s) {
diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h
index 26647db2e1..3b55d80276 100644
--- a/src/corelib/kernel/qsystemsemaphore_p.h
+++ b/src/corelib/kernel/qsystemsemaphore_p.h
@@ -56,9 +56,7 @@
#ifndef QT_NO_SYSTEMSEMAPHORE
#include "qsharedmemory_p.h"
-#ifndef Q_OS_WINCE
-# include <sys/types.h>
-#endif
+#include <sys/types.h>
#ifdef QT_POSIX_IPC
# include <semaphore.h>
#endif
diff --git a/src/corelib/kernel/qsystemsemaphore_posix.cpp b/src/corelib/kernel/qsystemsemaphore_posix.cpp
index 6137239467..9fbf5779b8 100644
--- a/src/corelib/kernel/qsystemsemaphore_posix.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_posix.cpp
@@ -147,7 +147,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
if (::sem_post(semaphore) == -1) {
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore (sem_post)"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::modify sem_post failed") << count << errno;
+ qDebug("QSystemSemaphore::modify sem_post failed %d %d", count, errno);
#endif
// rollback changes to preserve the SysV semaphore behavior
for ( ; cnt < count; ++cnt) {
@@ -169,7 +169,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
}
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore (sem_wait)"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::modify sem_wait failed") << count << errno;
+ qDebug("QSystemSemaphore::modify sem_wait failed %d %d", count, errno);
#endif
return false;
}
diff --git a/src/corelib/kernel/qsystemsemaphore_systemv.cpp b/src/corelib/kernel/qsystemsemaphore_systemv.cpp
index f4fdfa5f58..1967899a58 100644
--- a/src/corelib/kernel/qsystemsemaphore_systemv.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_systemv.cpp
@@ -187,7 +187,8 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
}
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore"));
#if defined QSYSTEMSEMAPHORE_DEBUG
- qDebug() << QLatin1String("QSystemSemaphore::modify failed") << count << semctl(semaphore, 0, GETVAL) << errno << EIDRM << EINVAL;
+ qDebug("QSystemSemaphore::modify failed %d %d %d %d %d",
+ count, int(semctl(semaphore, 0, GETVAL)), int(errno), int(EIDRM), int(EINVAL);
#endif
return false;
}
diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp
index 236e346afe..3395f5641e 100644
--- a/src/corelib/kernel/qsystemsemaphore_win.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_win.cpp
@@ -121,11 +121,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count)
return false;
}
} else {
-#if !defined(Q_OS_WINCE)
if (WAIT_OBJECT_0 != WaitForSingleObjectEx(semaphore, INFINITE, FALSE)) {
-#else
- if (WAIT_OBJECT_0 != WaitForSingleObject(semaphore, INFINITE)) {
-#endif
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore"));
#if defined QSYSTEMSEMAPHORE_DEBUG
qDebug("QSystemSemaphore::modifySemaphore WaitForSingleObject failed");
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index dd52d52a1c..d97fe933b9 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -80,11 +80,17 @@ public:
static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, const char *member);
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
static void singleShot(int msec, const QObject *receiver, PointerToMemberFunction method);
+ template<typename PointerToMemberFunction>
static void singleShot(int msec, Qt::TimerType timerType, const QObject *receiver, PointerToMemberFunction method);
+ template<typename Functor>
static void singleShot(int msec, Functor functor);
+ template<typename Functor>
static void singleShot(int msec, Qt::TimerType timerType, Functor functor);
+ template<typename Functor, int>
static void singleShot(int msec, const QObject *context, Functor functor);
+ template<typename Functor, int>
static void singleShot(int msec, Qt::TimerType timerType, const QObject *context, Functor functor);
#else
// singleShot to a QObject slot
diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri
index 544dd41742..473480eb55 100644
--- a/src/corelib/plugin/plugin.pri
+++ b/src/corelib/plugin/plugin.pri
@@ -35,8 +35,4 @@ integrity {
SOURCES += plugin/qlibrary_unix.cpp
}
-darwin {
- OBJECTIVE_SOURCES += plugin/quuid_darwin.mm
-}
-
!no-libdl: LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 6cd02e3a3f..c09dc6c22b 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -108,7 +108,11 @@ void QFactoryLoader::update()
if (!QDir(path).exists(QLatin1String(".")))
continue;
- QStringList plugins = QDir(path).entryList(QDir::Files);
+ QStringList plugins = QDir(path).entryList(
+#ifdef Q_OS_WIN
+ QStringList(QStringLiteral("*.dll")),
+#endif
+ QDir::Files);
QLibraryPrivate *library = 0;
#ifdef Q_OS_MAC
@@ -187,10 +191,12 @@ void QFactoryLoader::update()
++keyUsageCount;
}
}
- if (keyUsageCount || keys.isEmpty())
+ if (keyUsageCount || keys.isEmpty()) {
+ library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload
d->libraryList += library;
- else
+ } else {
library->release();
+ }
}
}
#else
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index f6a947b61a..9db0b7ff39 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -50,10 +50,6 @@
# include <private/qcore_mac_p.h>
#endif
-#if defined(QT_AOUT_UNDERSCORE)
-#include <string.h>
-#endif
-
#if (defined(Q_OS_VXWORKS) && !defined(VXWORKS_RTP)) || defined (Q_OS_NACL)
#define QT_NO_DYNAMIC_LIBRARY
#endif
@@ -171,9 +167,6 @@ bool QLibraryPrivate::load_sys()
}
#if !defined(Q_OS_CYGWIN)
else {
-#if defined(Q_OS_MAC)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
-#endif
dlFlags |= RTLD_LOCAL;
}
#endif
@@ -308,14 +301,7 @@ Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symb
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
-#if defined(QT_AOUT_UNDERSCORE)
- // older a.out systems add an underscore in front of symbols
- char* undrscr_symbol = new char[strlen(symbol)+2];
- undrscr_symbol[0] = '_';
- strcpy(undrscr_symbol+1, symbol);
- QFunctionPointer address = QFunctionPointer(dlsym(pHnd, undrscr_symbol));
- delete [] undrscr_symbol;
-#elif defined(QT_HPUX_LD)
+#if defined(QT_HPUX_LD)
QFunctionPointer address = 0;
if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0)
address = 0;
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index 46fbba151c..48aa0cdbb6 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -71,15 +71,6 @@ bool QLibraryPrivate::load_sys()
#endif
// We make the following attempts at locating the library:
//
- // WinCE
- // if (absolute)
- // fileName
- // fileName + ".dll"
- // else
- // fileName + ".dll"
- // fileName
- // QFileInfo(fileName).absoluteFilePath()
- //
// Windows
// if (absolute)
// fileName
@@ -97,14 +88,10 @@ bool QLibraryPrivate::load_sys()
// If the fileName is an absolute path we try that first, otherwise we
// use the system-specific suffix first
QFileSystemEntry fsEntry(fileName);
- if (fsEntry.isAbsolute()) {
+ if (fsEntry.isAbsolute())
attempts.prepend(fileName);
- } else {
+ else
attempts.append(fileName);
-#if defined(Q_OS_WINCE)
- attempts.append(QFileInfo(fileName).absoluteFilePath());
-#endif
- }
#ifdef Q_OS_WINRT
if (fileName.startsWith(QLatin1Char('/')))
attempts.prepend(QDir::rootPath() + fileName);
@@ -176,11 +163,7 @@ bool QLibraryPrivate::unload_sys()
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
-#ifdef Q_OS_WINCE
- FARPROC address = GetProcAddress(pHnd, (const wchar_t*)QString::fromLatin1(symbol).utf16());
-#else
FARPROC address = GetProcAddress(pHnd, symbol);
-#endif
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
QString::fromLatin1(symbol)).arg(
diff --git a/src/corelib/plugin/qmachparser.cpp b/src/corelib/plugin/qmachparser.cpp
index c136ef3797..a599fbcb23 100644
--- a/src/corelib/plugin/qmachparser.cpp
+++ b/src/corelib/plugin/qmachparser.cpp
@@ -59,6 +59,9 @@ static const cpu_type_t my_cputype = CPU_TYPE_X86;
static const cpu_type_t my_cputype = CPU_TYPE_POWERPC64;
#elif defined(Q_PROCESSOR_POWER_32)
static const cpu_type_t my_cputype = CPU_TYPE_POWERPC;
+#elif defined(Q_PROCESSOR_ARM_64)
+# define MACHO64
+static const cpu_type_t my_cputype = CPU_TYPE_ARM64;
#elif defined(Q_PROCESSOR_ARM)
static const cpu_type_t my_cputype = CPU_TYPE_ARM;
#else
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 62067c7ef7..4752f69ff3 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -154,6 +154,7 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
: QObject(parent), d(0), did_load(false)
{
setFileName(fileName);
+ setLoadHints(QLibrary::PreventUnloadHint);
}
/*!
@@ -348,7 +349,7 @@ static QString locatePlugin(const QString& fileName)
void QPluginLoader::setFileName(const QString &fileName)
{
#if defined(QT_SHARED)
- QLibrary::LoadHints lh;
+ QLibrary::LoadHints lh = QLibrary::PreventUnloadHint;
if (d) {
lh = d->loadHints();
d->release();
@@ -394,7 +395,7 @@ QString QPluginLoader::errorString() const
\brief Give the load() function some hints on how it should behave.
You can give hints on how the symbols in the plugin are
- resolved. By default, none of the hints are set.
+ resolved. By default since Qt 5.7, QLibrary::PreventUnloadHint is set.
See the documentation of QLibrary::loadHints for a complete
description of how this property works.
diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp
index 178a33f987..7c80fbbd42 100644
--- a/src/corelib/plugin/qsystemlibrary.cpp
+++ b/src/corelib/plugin/qsystemlibrary.cpp
@@ -68,23 +68,11 @@
DLL Safe search mode is documented in the "Dynamic-Link Library Search
Order" document on MSDN.
-
- Since library loading code is sometimes shared between Windows and WinCE,
- this class can also be used on WinCE. However, its implementation just
- calls the LoadLibrary() function. This is ok since it is documented as not
- loading from the current directory on WinCE. This behaviour is documented
- in the documentation for LoadLibrary for Windows CE at MSDN.
- (http://msdn.microsoft.com/en-us/library/ms886736.aspx)
*/
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE)
-HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */)
-{
- return ::LoadLibrary(libraryName);
-}
-#elif defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */)
{
Q_UNUSED(onlySystemDirectory);
@@ -141,6 +129,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect
}
-#endif //Q_OS_WINCE
+#endif // Q_OS_WINRT
QT_END_NAMESPACE
diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h
index 469376d81b..7b6d180df9 100644
--- a/src/corelib/plugin/qsystemlibrary_p.h
+++ b/src/corelib/plugin/qsystemlibrary_p.h
@@ -93,11 +93,7 @@ public:
load();
if (!m_handle)
return 0;
-#ifdef Q_OS_WINCE
- return QFunctionPointer(GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16()));
-#else
return QFunctionPointer(GetProcAddress(m_handle, symbol));
-#endif
}
static QFunctionPointer resolve(const QString &libraryName, const char *symbol)
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 5876bb84c3..1780039928 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -809,39 +809,6 @@ QUuid::Version QUuid::version() const Q_DECL_NOTHROW
return ver;
}
-/*! \fn QUuid QUuid::fromCFUUID(CFUUIDRef uuid)
- \since 5.7
-
- Constructs a new QUuid containing a copy of the \a uuid CFUUID.
-
- \note this function is only available on Apple platforms.
-*/
-
-/*! \fn CFUUIDRef QUuid::toCFUUID() const
- \since 5.7
-
- Creates a CFUUID from a QUuid. The caller owns the CFUUID and is
- responsible for releasing it.
-
- \note this function is only available on Apple platforms.
-*/
-
-/*! \fn QUuid QUuid::fromNSUUID(const NSUUID *uuid)
- \since 5.7
-
- Constructs a new QUuid containing a copy of the \a uuid NSUUID.
-
- \note this function is only available on Apple platforms.
-*/
-
-/*! \fn NSUUID QUuid::toNSUUID() const
- \since 5.7
-
- Creates a NSUUID from a QUuid. The NSUUID is autoreleased.
-
- \note this function is only available on Apple platforms.
-*/
-
/*!
\fn bool QUuid::operator<(const QUuid &other) const
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index a1d16b449e..264f572993 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -55,11 +55,9 @@ typedef struct _GUID
#endif
#endif
-#ifdef Q_OS_DARWIN
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFUUID);
-# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID);
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -210,10 +208,8 @@ public:
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QUuid fromCFUUID(CFUUIDRef uuid);
CFUUIDRef toCFUUID() const Q_DECL_CF_RETURNS_RETAINED;
-# if defined(__OBJC__) || defined(Q_QDOC)
static QUuid fromNSUUID(const NSUUID *uuid);
NSUUID *toNSUUID() const Q_DECL_NS_RETURNS_AUTORELEASED;
-# endif
#endif
uint data1;
diff --git a/src/corelib/plugin/quuid_darwin.mm b/src/corelib/plugin/quuid_darwin.mm
deleted file mode 100644
index c2a7240f3b..0000000000
--- a/src/corelib/plugin/quuid_darwin.mm
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "quuid.h"
-
-#import <Foundation/Foundation.h>
-
-QT_BEGIN_NAMESPACE
-
-QUuid QUuid::fromCFUUID(CFUUIDRef uuid)
-{
- if (!uuid)
- return QUuid();
- const CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid);
- return QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char *>(&bytes), sizeof(bytes)));
-}
-
-CFUUIDRef QUuid::toCFUUID() const
-{
- const QByteArray bytes = toRfc4122();
- return CFUUIDCreateFromUUIDBytes(0, *reinterpret_cast<const CFUUIDBytes *>(bytes.constData()));
-}
-
-QUuid QUuid::fromNSUUID(const NSUUID *uuid)
-{
- if (!uuid)
- return QUuid();
- uuid_t bytes;
- [uuid getUUIDBytes:bytes];
- return QUuid::fromRfc4122(QByteArray::fromRawData(reinterpret_cast<const char *>(bytes), sizeof(bytes)));
-}
-
-NSUUID *QUuid::toNSUUID() const
-{
- const QByteArray bytes = toRfc4122();
- return [[[NSUUID alloc] initWithUUIDBytes:*reinterpret_cast<const uuid_t *>(bytes.constData())] autorelease];
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index e8d413cd8a..d7cf8584da 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -60,6 +60,7 @@ public:
QSignalTransition(const QObject *sender, const char *signal,
QState *sourceState = Q_NULLPTR);
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
QSignalTransition(const QObject *object, PointerToMemberFunction signal,
QState *sourceState = Q_NULLPTR);
#elif defined(Q_COMPILER_DELEGATING_CONSTRUCTORS)
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index ee1ff3fea3..7a9dc9c132 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -82,6 +82,7 @@ public:
void addTransition(QAbstractTransition *transition);
QSignalTransition *addTransition(const QObject *sender, const char *signal, QAbstractState *target);
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
QSignalTransition *addTransition(const QObject *sender, PointerToMemberFunction signal,
QAbstractState *target);
#else
diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp
index acb0f9dc61..3c314a4c0c 100644
--- a/src/corelib/thread/qmutex_win.cpp
+++ b/src/corelib/thread/qmutex_win.cpp
@@ -61,11 +61,7 @@ QMutexPrivate::~QMutexPrivate()
bool QMutexPrivate::wait(int timeout)
{
-#ifndef Q_OS_WINCE
return (WaitForSingleObjectEx(event, timeout < 0 ? INFINITE : timeout, FALSE) == WAIT_OBJECT_0);
-#else
- return (WaitForSingleObject(event, timeout < 0 ? INFINITE : timeout) == WAIT_OBJECT_0);
-#endif
}
void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index ef1799a021..a14c193bad 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -55,15 +55,10 @@
#include <qt_windows.h>
#ifndef Q_OS_WINRT
-#ifndef Q_OS_WINCE
-#ifndef _MT
-#define _MT
-#endif // _MT
-#include <process.h>
-#else // !Q_OS_WINCE
-#include "qfunctions_wince.h"
-#endif // Q_OS_WINCE
-#else // !Q_OS_WINRT
+# ifndef _MT
+# define _MT
+# endif // _MT
+# include <process.h>
#endif // Q_OS_WINRT
#ifndef QT_NO_THREAD
@@ -150,7 +145,6 @@ QThreadData *QThreadData::current(bool createIfNecessary)
// WinRT API?
} else {
HANDLE realHandle = INVALID_HANDLE_VALUE;
-#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600))
DuplicateHandle(GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
@@ -158,9 +152,6 @@ QThreadData *QThreadData::current(bool createIfNecessary)
0,
FALSE,
DUPLICATE_SAME_ACCESS);
-#else
- realHandle = reinterpret_cast<HANDLE>(GetCurrentThreadId());
-#endif
qt_watch_adopted_thread(realHandle, threadData->thread);
}
}
@@ -190,9 +181,7 @@ void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread)
QMutexLocker lock(&qt_adopted_thread_watcher_mutex);
if (GetCurrentThreadId() == qt_adopted_thread_watcher_id) {
-#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600))
CloseHandle(adoptedThreadHandle);
-#endif
return;
}
@@ -291,9 +280,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
data->deref();
QMutexLocker lock(&qt_adopted_thread_watcher_mutex);
-#if !defined(Q_OS_WINCE) || (defined(_WIN32_WCE) && (_WIN32_WCE>=0x600))
CloseHandle(qt_adopted_thread_handles.at(handleIndex));
-#endif
qt_adopted_thread_handles.remove(handleIndex);
qt_adopted_qthreads.remove(qthreadIndex);
}
@@ -306,7 +293,7 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
return 0;
}
-#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT)
#ifndef Q_OS_WIN64
# define ULONG_PTR DWORD
@@ -336,7 +323,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName)
{
}
}
-#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // !QT_NO_DEBUG && Q_CC_MSVC && !Q_OS_WINRT
/**************************************************************************
** QThreadPrivate
@@ -378,7 +365,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi
else
createEventDispatcher(data);
-#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT)
// sets the name of the current thread.
QByteArray objectName = thr->objectName().toLocal8Bit();
qt_set_thread_name((HANDLE)-1,
@@ -453,7 +440,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
void QThread::yieldCurrentThread()
{
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
SwitchToThread();
#else
::Sleep(0);
@@ -495,7 +482,6 @@ void QThread::start(Priority priority)
d->returnCode = 0;
d->interruptionRequested = false;
-#ifndef Q_OS_WINRT
/*
NOTE: we create the thread in the suspended state, set the
priority and then resume the thread.
@@ -506,9 +492,21 @@ void QThread::start(Priority priority)
less than NormalPriority), but the newly created thread preempts
its 'parent' and runs at normal priority.
*/
+#if defined(Q_CC_MSVC) && !defined(_DLL) // && !defined(Q_OS_WINRT)
+# ifdef Q_OS_WINRT
+ // If you wish to accept the memory leaks, uncomment the part above.
+ // See:
+ // https://support.microsoft.com/en-us/kb/104641
+ // https://msdn.microsoft.com/en-us/library/kdzttdcb.aspx
+# error "Microsoft documentation says this combination leaks memory every time a thread is started. " \
+ "Please change your build back to -MD/-MDd or, if you understand this issue and want to continue, " \
+ "edit this source file."
+# endif
+ // MSVC -MT or -MTd build
d->handle = (Qt::HANDLE) _beginthreadex(NULL, d->stackSize, QThreadPrivate::start,
this, CREATE_SUSPENDED, &(d->id));
-#else // !Q_OS_WINRT
+#else
+ // MSVC -MD or -MDd or MinGW build
d->handle = (Qt::HANDLE) CreateThread(NULL, d->stackSize, (LPTHREAD_START_ROUTINE)QThreadPrivate::start,
this, CREATE_SUSPENDED, reinterpret_cast<LPDWORD>(&d->id));
#endif // Q_OS_WINRT
diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp
index a95ca0b8fd..e6610f18c8 100644
--- a/src/corelib/thread/qwaitcondition_win.cpp
+++ b/src/corelib/thread/qwaitcondition_win.cpp
@@ -115,12 +115,7 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time)
{
// wait for the event
bool ret = false;
-#ifndef Q_OS_WINCE
switch (WaitForSingleObjectEx(wce->event, time, FALSE)) {
-#else
- switch (WaitForSingleObject(wce->event, time)) {
-#endif
-
default: break;
case WAIT_OBJECT_0:
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 4f704d6764..6e68bc7eb1 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -142,15 +142,9 @@ QT_DEPRECATED_X("Use std::count") inline void qCount(const Container &container,
}
#ifdef Q_QDOC
-template <typename T>
-LessThan qLess()
-{
-}
-
-template <typename T>
-LessThan qGreater()
-{
-}
+typedef void* LessThan;
+template <typename T> LessThan qLess();
+template <typename T> LessThan qGreater();
#else
template <typename T>
class QT_DEPRECATED_X("Use std::less") qLess
@@ -522,20 +516,148 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
#endif // QT_DEPRECATED_SINCE(5, 2)
-} //namespace QAlgorithmsPrivate
-
+// Clang had a bug where __builtin_ctz/clz/popcount were not marked as constexpr.
+#if !defined Q_CC_CLANG || (defined __apple_build_version__ && __clang_major__ >= 7) \
+ || (Q_CC_CLANG >= 307)
+# define QT_HAS_CONSTEXPR_BUILTINS
+#endif
-// Use __builtin_popcount on gcc. Clang claims to be gcc
-// but has a bug where __builtin_popcount is not marked as
-// constexpr.
-#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
+#if defined QT_HAS_CONSTEXPR_BUILTINS
+#if defined(Q_CC_GNU)
+# define QT_HAS_BUILTIN_CTZS
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
+{
+# if QT_HAS_BUILTIN(__builtin_ctzs) || defined(__BMI__)
+ return __builtin_ctzs(v);
+# else
+ return __builtin_ctz(v);
+# endif
+}
+#define QT_HAS_BUILTIN_CLZS
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
+{
+# if QT_HAS_BUILTIN(__builtin_clzs) || defined(__BMI__)
+ return __builtin_clzs(v);
+# else
+ return __builtin_clz(v) - 16U;
+# endif
+}
+#define QT_HAS_BUILTIN_CTZ
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) Q_DECL_NOTHROW
+{
+ return __builtin_ctz(v);
+}
+#define QT_HAS_BUILTIN_CLZ
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) Q_DECL_NOTHROW
+{
+ return __builtin_clz(v);
+}
+#define QT_HAS_BUILTIN_CTZLL
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) Q_DECL_NOTHROW
+{
+ return __builtin_ctzll(v);
+}
+#define QT_HAS_BUILTIN_CLZLL
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) Q_DECL_NOTHROW
+{
+ return __builtin_clzll(v);
+}
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
-#endif
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
+{
+ return __builtin_popcount(v);
+}
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW
+{
+ return __builtin_popcount(v);
+}
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
+{
+ return __builtin_popcount(v);
+}
+#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
+Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
+{
+ return __builtin_popcountll(v);
+}
+#elif defined(Q_CC_MSVC) && !defined(Q_OS_WINCE) && !defined(Q_PROCESSOR_ARM)
+#define QT_HAS_BUILTIN_CTZ
+Q_DECL_CONSTEXPR 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)
+{
+ unsigned long result;
+ _BitScanReverse(&result, val);
+ // Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
+ // and the lsb index is 0. The result for the index when counting up: msb index is 0 (because it
+ // starts there), and the lsb index is 31.
+ result ^= sizeof(quint32) * 8 - 1;
+ return result;
+}
+#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)
+{
+ unsigned long result;
+ _BitScanForward64(&result, val);
+ return result;
+}
+// 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)
+{
+ unsigned long result;
+ _BitScanReverse64(&result, val);
+ // see qt_builtin_clz
+ result ^= sizeof(quint64) * 8 - 1;
+ return result;
+}
+#endif // MSVC 64bit
+# define QT_HAS_BUILTIN_CTZS
+Q_DECL_CONSTEXPR 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
+{
+ 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
+{
+ return __popcnt(v);
+}
+Q_DECL_CONSTEXPR 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
+{
+ 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
+{
+ return __popcnt64(v);
+}
+#endif // MSVC 64bit
+#endif // MSVC
+#endif // QT_HAS_CONSTEXPR_BUILTINS
+
+} //namespace QAlgorithmsPrivate
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
- return __builtin_popcount(v);
+ return QAlgorithmsPrivate::qt_builtin_popcount(v);
#else
// See http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
return
@@ -548,7 +670,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint32 v) Q
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
- return __builtin_popcount(v);
+ return QAlgorithmsPrivate::qt_builtin_popcount(v);
#else
return
(((v ) & 0xfff) * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f;
@@ -558,7 +680,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW
{
#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
- return __builtin_popcount(v);
+ return QAlgorithmsPrivate::qt_builtin_popcount(v);
#else
return
(((v ) & 0xfff) * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f +
@@ -568,8 +690,8 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint16 v) Q
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW
{
-#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT
- return __builtin_popcountll(v);
+#ifdef QALGORITHMS_USE_BUILTIN_POPCOUNTLL
+ return QAlgorithmsPrivate::qt_builtin_popcountll(v);
#else
return
(((v ) & 0xfff) * Q_UINT64_C(0x1001001001001) & Q_UINT64_C(0x84210842108421)) % 0x1f +
@@ -592,8 +714,8 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qPopulationCount(long unsigne
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
- return v ? __builtin_ctz(v) : 32U;
+#if defined(QT_HAS_BUILTIN_CTZ)
+ return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 32U;
#else
// see http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightParallel
unsigned int c = 32; // c will be the number of zero bits on the right
@@ -610,8 +732,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NO
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
- return v ? __builtin_ctz(v) : 8U;
+#if defined(QT_HAS_BUILTIN_CTZ)
+ return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 8U;
#else
unsigned int c = 8; // c will be the number of zero bits on the right
v &= -signed(v);
@@ -625,12 +747,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOT
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
-# if QT_HAS_BUILTIN(__builtin_ctzs) || (defined(__LZCNT__) && defined(__BMI__))
- return v ? __builtin_ctzs(v) : 16U;
-# else
- return v ? __builtin_ctz(v) : 16U;
-# endif
+#if defined(QT_HAS_BUILTIN_CTZS)
+ return v ? QAlgorithmsPrivate::qt_builtin_ctzs(v) : 16U;
#else
unsigned int c = 16; // c will be the number of zero bits on the right
v &= -signed(v);
@@ -645,8 +763,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NO
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
- return v ? __builtin_ctzll(v) : 64;
+#if defined(QT_HAS_BUILTIN_CTZLL)
+ return v ? QAlgorithmsPrivate::qt_builtin_ctzll(v) : 64;
#else
quint32 x = static_cast<quint32>(v);
return x ? qCountTrailingZeroBits(x)
@@ -661,8 +779,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(unsigned long v) Q_D
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
- return v ? __builtin_clz(v) : 32U;
+#if defined(QT_HAS_BUILTIN_CLZ)
+ return v ? QAlgorithmsPrivate::qt_builtin_clz(v) : 32U;
#else
// Hacker's Delight, 2nd ed. Fig 5-16, p. 102
v = v | (v >> 1);
@@ -676,8 +794,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOT
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
- return v ? __builtin_clz(v)-24U : 8U;
+#if defined(QT_HAS_BUILTIN_CLZ)
+ return v ? QAlgorithmsPrivate::qt_builtin_clz(v)-24U : 8U;
#else
v = v | (v >> 1);
v = v | (v >> 2);
@@ -688,12 +806,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTH
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
-# if QT_HAS_BUILTIN(__builtin_clzs) || (defined(__LZCNT__) && defined(__BMI__))
- return v ? __builtin_clzs(v) : 16U;
-# else
- return v ? __builtin_clz(v)-16U : 16U;
-# endif
+#if defined(QT_HAS_BUILTIN_CLZS)
+ return v ? QAlgorithmsPrivate::qt_builtin_clzs(v) : 16U;
#else
v = v | (v >> 1);
v = v | (v >> 2);
@@ -705,8 +819,8 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOT
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DECL_NOTHROW
{
-#if defined(Q_CC_GNU)
- return v ? __builtin_clzll(v) : 64U;
+#if defined(QT_HAS_BUILTIN_CLZLL)
+ return v ? QAlgorithmsPrivate::qt_builtin_clzll(v) : 64U;
#else
v = v | (v >> 1);
v = v | (v >> 2);
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index c9d6f4e411..266c2e9b57 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -4467,91 +4467,6 @@ QByteArray QByteArray::fromPercentEncoding(const QByteArray &input, char percent
\sa fromStdString(), QString::toStdString()
*/
-/*! \fn QByteArray QByteArray::fromCFData(CFDataRef data)
- \since 5.3
-
- Constructs a new QByteArray containing a copy of the CFData \a data.
-
- \sa fromRawCFData(), fromRawData(), toRawCFData(), toCFData()
-*/
-
-/*! \fn QByteArray QByteArray::fromRawCFData(CFDataRef data)
- \since 5.3
-
- Constructs a QByteArray that uses the bytes of the CFData \a data.
-
- The \a data's bytes are not copied.
-
- The caller guarantees that the CFData will not be deleted
- or modified as long as this QByteArray object exists.
-
- \sa fromCFData(), fromRawData(), toRawCFData(), toCFData()
-*/
-
-/*! \fn CFDataRef QByteArray::toCFData() const
- \since 5.3
-
- Creates a CFData from a QByteArray. The caller owns the CFData object
- and is responsible for releasing it.
-
- \sa toRawCFData(), fromCFData(), fromRawCFData(), fromRawData()
-*/
-
-/*! \fn CFDataRef QByteArray::toRawCFData() const
- \since 5.3
-
- Constructs a CFData that uses the bytes of the QByteArray.
-
- The QByteArray's bytes are not copied.
-
- The caller guarantees that the QByteArray will not be deleted
- or modified as long as this CFData object exists.
-
- \sa toCFData(), fromRawCFData(), fromCFData(), fromRawData()
-*/
-
-/*! \fn QByteArray QByteArray::fromNSData(const NSData *data)
- \since 5.3
-
- Constructs a new QByteArray containing a copy of the NSData \a data.
-
- \sa fromRawNSData(), fromRawData(), toNSData(), toRawNSData()
-*/
-
-/*! \fn QByteArray QByteArray::fromRawNSData(const NSData *data)
- \since 5.3
-
- Constructs a QByteArray that uses the bytes of the NSData \a data.
-
- The \a data's bytes are not copied.
-
- The caller guarantees that the NSData will not be deleted
- or modified as long as this QByteArray object exists.
-
- \sa fromNSData(), fromRawData(), toRawNSData(), toNSData()
-*/
-
-/*! \fn NSData QByteArray::toNSData() const
- \since 5.3
-
- Creates a NSData from a QByteArray. The NSData object is autoreleased.
-
- \sa fromNSData(), fromRawNSData(), fromRawData(), toRawNSData()
-*/
-
-/*! \fn NSData QByteArray::toRawNSData() const
- \since 5.3
-
- Constructs a NSData that uses the bytes of the QByteArray.
-
- The QByteArray's bytes are not copied.
-
- The caller guarantees that the QByteArray will not be deleted
- or modified as long as this NSData object exists.
-
- \sa fromRawNSData(), fromNSData(), fromRawData(), toNSData()
-*/
-
static inline bool q_strchr(const char str[], char chr)
{
if (!str) return false;
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index d334bb43c5..477402d6de 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -56,11 +56,9 @@
#error qbytearray.h must be included before any header file that defines truncate
#endif
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFData);
-# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSData);
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -384,17 +382,15 @@ public:
static QByteArray fromHex(const QByteArray &hexEncoded) Q_REQUIRED_RESULT;
static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%') Q_REQUIRED_RESULT;
-#if defined(Q_OS_MAC) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QByteArray fromCFData(CFDataRef data);
static QByteArray fromRawCFData(CFDataRef data);
CFDataRef toCFData() const Q_DECL_CF_RETURNS_RETAINED;
CFDataRef toRawCFData() const Q_DECL_CF_RETURNS_RETAINED;
-# if defined(__OBJC__) || defined(Q_QDOC)
static QByteArray fromNSData(const NSData *data);
static QByteArray fromRawNSData(const NSData *data);
NSData *toNSData() const Q_DECL_NS_RETURNS_AUTORELEASED;
NSData *toRawNSData() const Q_DECL_NS_RETURNS_AUTORELEASED;
-# endif
#endif
typedef char *iterator;
diff --git a/src/corelib/tools/qbytearray_mac.mm b/src/corelib/tools/qbytearray_mac.mm
deleted file mode 100644
index 9386a966f0..0000000000
--- a/src/corelib/tools/qbytearray_mac.mm
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Samuel Gaist <samuel.gaist@edeltech.ch>
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbytearray.h"
-
-#import <Foundation/Foundation.h>
-
-QT_BEGIN_NAMESPACE
-
-QByteArray QByteArray::fromCFData(CFDataRef data)
-{
- if (!data)
- return QByteArray();
-
- return QByteArray(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
-}
-
-QByteArray QByteArray::fromRawCFData(CFDataRef data)
-{
- if (!data)
- return QByteArray();
-
- return QByteArray::fromRawData(reinterpret_cast<const char *>(CFDataGetBytePtr(data)), CFDataGetLength(data));
-}
-
-CFDataRef QByteArray::toCFData() const
-{
- return CFDataCreate(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()), length());
-}
-
-CFDataRef QByteArray::toRawCFData() const
-{
- return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8 *>(data()),
- length(), kCFAllocatorNull);
-}
-
-QByteArray QByteArray::fromNSData(const NSData *data)
-{
- if (!data)
- return QByteArray();
- return QByteArray(reinterpret_cast<const char *>([data bytes]), [data length]);
-}
-
-QByteArray QByteArray::fromRawNSData(const NSData *data)
-{
- if (!data)
- return QByteArray();
- return QByteArray::fromRawData(reinterpret_cast<const char *>([data bytes]), [data length]);
-}
-
-NSData *QByteArray::toNSData() const
-{
- return [NSData dataWithBytes:constData() length:size()];
-}
-
-NSData *QByteArray::toRawNSData() const
-{
- // const_cast is fine here because NSData is immutable thus will never modify bytes we're giving it
- return [NSData dataWithBytesNoCopy:const_cast<char *>(constData()) length:size() freeWhenDone:NO];
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h
index bc8b08b380..501bb2e0d5 100644
--- a/src/corelib/tools/qbytearraylist.h
+++ b/src/corelib/tools/qbytearraylist.h
@@ -50,11 +50,13 @@ QT_BEGIN_NAMESPACE
typedef QListIterator<QByteArray> QByteArrayListIterator;
typedef QMutableListIterator<QByteArray> QMutableByteArrayListIterator;
+#ifndef Q_QDOC
typedef QList<QByteArray> QByteArrayList;
namespace QtPrivate {
QByteArray Q_CORE_EXPORT QByteArrayList_join(const QByteArrayList *that, const char *separator, int separatorLength);
}
+#endif
#ifdef Q_QDOC
class QByteArrayList : public QList<QByteArray>
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index f01fbc109c..a83e5e6f98 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -578,6 +578,18 @@ Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) Q_DECL_NOTHROW { ret
Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) Q_DECL_NOTHROW { return operator< (c2, c1); }
Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c2, c1); }
+// disambiguate QChar == int (but only that, so constrain template to exactly 'int'):
+template <typename T>
+Q_DECL_DEPRECATED_X("don't compare ints to QChars, compare them to QChar::unicode() instead")
+Q_DECL_CONSTEXPR inline
+typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, int>::value, bool>::type
+operator==(QChar lhs, T rhs) Q_DECL_NOEXCEPT { return lhs == QChar(rhs); }
+template <typename T>
+Q_DECL_DEPRECATED_X("don't compare ints to QChars, compare them to QChar::unicode() instead")
+Q_DECL_CONSTEXPR inline
+typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, int>::value, bool>::type
+operator!=(QChar lhs, T rhs) Q_DECL_NOEXCEPT { return lhs != QChar(rhs); }
+
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QChar &);
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index 64cabcc304..1f7f9cc33b 100644
--- a/src/corelib/tools/qcommandlineoption.cpp
+++ b/src/corelib/tools/qcommandlineoption.cpp
@@ -49,14 +49,12 @@ class QCommandLineOptionPrivate : public QSharedData
public:
Q_NEVER_INLINE
explicit QCommandLineOptionPrivate(const QString &name)
- : names(removeInvalidNames(QStringList(name))),
- hidden(false)
+ : names(removeInvalidNames(QStringList(name)))
{ }
Q_NEVER_INLINE
explicit QCommandLineOptionPrivate(const QStringList &names)
- : names(removeInvalidNames(names)),
- hidden(false)
+ : names(removeInvalidNames(names))
{ }
static QStringList removeInvalidNames(QStringList nameList);
@@ -74,8 +72,7 @@ public:
//! The list of default values used for this option.
QStringList defaultValues;
- //! Show or hide in --help
- bool hidden;
+ QCommandLineOption::Flags flags;
};
/*!
@@ -394,6 +391,7 @@ QStringList QCommandLineOption::defaultValues() const
return d->defaultValues;
}
+#if QT_DEPRECATED_SINCE(5, 8)
/*!
Sets whether to hide this option in the user-visible help output.
@@ -401,11 +399,12 @@ QStringList QCommandLineOption::defaultValues() const
a particular option makes it internal, i.e. not listed in the help output.
\since 5.6
+ \obsolete Use setFlags(QCommandLineOption::HiddenFromHelp), QCommandLineOption::HiddenFromHelp
\sa isHidden
*/
void QCommandLineOption::setHidden(bool hide)
{
- d->hidden = hide;
+ d->flags.setFlag(HiddenFromHelp, hide);
}
/*!
@@ -413,11 +412,52 @@ void QCommandLineOption::setHidden(bool hide)
false if the option is listed.
\since 5.6
- \sa setHidden()
+ \obsolete Use flags() & QCommandLineOption::HiddenFromHelp
+ \sa setHidden(), QCommandLineOption::HiddenFromHelp
*/
bool QCommandLineOption::isHidden() const
{
- return d->hidden;
+ return d->flags & HiddenFromHelp;
}
+#endif
+
+/*!
+ Returns a set of flags that affect this command-line option.
+
+ \since 5.8
+ \sa setFlags(), QCommandLineOption::Flags
+ */
+QCommandLineOption::Flags QCommandLineOption::flags() const
+{
+ return d->flags;
+}
+
+/*!
+ Set the set of flags that affect this command-line option.
+
+ \since 5.8
+ \sa flags(), QCommandLineOption::Flags
+ */
+void QCommandLineOption::setFlags(Flags flags)
+{
+ d->flags = flags;
+}
+
+/*!
+ \enum QCommandLineOption::Flag
+
+ \value HiddenFromHelp Hide this option in the user-visible help output. All
+ options are visible by default. Setting this flag for a particular
+ option makes it internal, i.e. not listed in the help output.
+
+ \value ShortOptionStyle The option will always be understood as a short
+ option, regardless of what was set by
+ QCommandLineParser::setSingleDashWordOptionMode.
+ This allows flags such as \c{-DDEFINE=VALUE} or \c{-I/include/path} to be
+ interpreted as short flags even when the parser is in
+ QCommandLineParser::ParseAsLongOptions mode.
+
+ \sa QCommandLineOption::setFlags(), QCommandLineOption::flags()
+*/
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h
index a7747f9fb2..6ebaab3d48 100644
--- a/src/corelib/tools/qcommandlineoption.h
+++ b/src/corelib/tools/qcommandlineoption.h
@@ -50,6 +50,12 @@ class QCommandLineOptionPrivate;
class Q_CORE_EXPORT QCommandLineOption
{
public:
+ enum Flag {
+ HiddenFromHelp = 0x1,
+ ShortOptionStyle = 0x2
+ };
+ Q_DECLARE_FLAGS(Flags, Flag)
+
explicit QCommandLineOption(const QString &name);
explicit QCommandLineOption(const QStringList &names);
/*implicit*/ QCommandLineOption(const QString &name, const QString &description,
@@ -82,14 +88,24 @@ public:
void setDefaultValues(const QStringList &defaultValues);
QStringList defaultValues() const;
+ Flags flags() const;
+ void setFlags(Flags aflags);
+
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED_X("Use setFlags() with HiddenFromHelp)")
void setHidden(bool hidden);
+ QT_DEPRECATED_X("Use flags() and HiddenFromHelp")
bool isHidden() const;
+#endif
+
private:
QSharedDataPointer<QCommandLineOptionPrivate> d;
};
Q_DECLARE_SHARED(QCommandLineOption)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QCommandLineOption::Flags)
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index a7ab8b9e70..2450484ce9 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -44,7 +44,7 @@
#include <qhash.h>
#include <qvector.h>
#include <qdebug.h>
-#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT)
# include <qt_windows.h>
#endif
#include <stdio.h>
@@ -295,7 +295,9 @@ QCommandLineParser::~QCommandLineParser()
i.e. as the long option named \c{abc}. This is how Qt's own tools
(uic, rcc...) have always been parsing arguments. This mode should be
used for preserving compatibility in applications that were parsing
- arguments in such a way.
+ arguments in such a way. There is an exception if the \c{a} option has the
+ QCommandLineOption::ShortOptionStyle flag set, in which case it is still
+ interpreted as \c{-a bc}.
\sa setSingleDashWordOptionMode()
*/
@@ -530,7 +532,7 @@ QString QCommandLineParser::errorText() const
enum MessageType { UsageMessage, ErrorMessage };
-#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINRT)
// Return whether to use a message box. Use handles if a console can be obtained
// or we are run with redirected handles (for example, by QProcess).
static inline bool displayMessageBox()
@@ -552,7 +554,7 @@ static void showParserMessage(const QString &message, MessageType type)
else
qCritical(qPrintable(message));
return;
-#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED) && !defined(Q_OS_WINCE)
+#elif defined(Q_OS_WIN) && !defined(QT_BOOTSTRAPPED)
if (displayMessageBox()) {
const UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND
| (type == UsageMessage ? MB_ICONINFORMATION : MB_ICONERROR);
@@ -565,7 +567,7 @@ static void showParserMessage(const QString &message, MessageType type)
reinterpret_cast<const wchar_t *>(title.utf16()), flags);
return;
}
-#endif // Q_OS_WIN && !QT_BOOTSTRAPPED && !Q_OS_WINCE
+#endif // Q_OS_WIN && !QT_BOOTSTRAPPED
fputs(qPrintable(message), type == UsageMessage ? stdout : stderr);
}
@@ -762,6 +764,18 @@ bool QCommandLineParserPrivate::parse(const QStringList &args)
}
case QCommandLineParser::ParseAsLongOptions:
{
+ if (argument.size() > 2) {
+ const QString possibleShortOptionStyleName = argument.mid(1, 1);
+ const auto shortOptionIt = nameHash.constFind(possibleShortOptionStyleName);
+ if (shortOptionIt != nameHash.constEnd()) {
+ const auto &arg = commandLineOptionList.at(*shortOptionIt);
+ if (arg.flags() & QCommandLineOption::ShortOptionStyle) {
+ registerFoundOption(possibleShortOptionStyleName);
+ optionValuesHash[*shortOptionIt].append(argument.mid(2));
+ break;
+ }
+ }
+ }
const QString optionName = argument.mid(1).section(assignChar, 0, 0);
if (registerFoundOption(optionName)) {
if (!parseOptionValue(optionName, argument, &argumentIterator, args.end()))
@@ -1098,7 +1112,7 @@ QString QCommandLineParserPrivate::helpText() const
optionNameList.reserve(commandLineOptionList.size());
int longestOptionNameString = 0;
for (const QCommandLineOption &option : commandLineOptionList) {
- if (option.isHidden())
+ if (option.flags() & QCommandLineOption::HiddenFromHelp)
continue;
const QStringList optionNames = option.names();
QString optionNamesString;
@@ -1117,7 +1131,7 @@ QString QCommandLineParserPrivate::helpText() const
++longestOptionNameString;
auto optionNameIterator = optionNameList.cbegin();
for (const QCommandLineOption &option : commandLineOptionList) {
- if (option.isHidden())
+ if (option.flags() & QCommandLineOption::HiddenFromHelp)
continue;
text += wrapText(*optionNameIterator, longestOptionNameString, option.description());
++optionNameIterator;
diff --git a/src/corelib/tools/qcryptographichash.h b/src/corelib/tools/qcryptographichash.h
index a19c734768..0f17baa036 100644
--- a/src/corelib/tools/qcryptographichash.h
+++ b/src/corelib/tools/qcryptographichash.h
@@ -42,6 +42,7 @@
#define QCRYPTOGRAPHICHASH_H
#include <QtCore/qbytearray.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -51,6 +52,7 @@ class QIODevice;
class Q_CORE_EXPORT QCryptographicHash
{
+ Q_GADGET
public:
enum Algorithm {
#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
@@ -69,6 +71,7 @@ public:
Sha3_512
#endif
};
+ Q_ENUM(Algorithm)
explicit QCryptographicHash(Algorithm method);
~QCryptographicHash();
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 6750925853..2ebf7c7977 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -57,9 +57,6 @@
#include <time.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>
-# ifdef Q_OS_WINCE
-# include "qfunctions_wince.h"
-# endif
# ifdef Q_OS_WINRT
# include "qfunctions_winrt.h"
# endif
@@ -71,8 +68,6 @@
QT_BEGIN_NAMESPACE
-Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QDateTimePrivate>, defaultDateTimePrivate, (new QDateTimePrivate()))
-
/*****************************************************************************
Date/Time Constants
*****************************************************************************/
@@ -1685,9 +1680,6 @@ QString QTime::toString(const QString& format) const
bool QTime::setHMS(int h, int m, int s, int ms)
{
-#if defined(Q_OS_WINCE)
- startTick = NullTime;
-#endif
if (!isValid(h,m,s,ms)) {
mds = NullTime; // make this invalid
return false;
@@ -1767,10 +1759,6 @@ QTime QTime::addMSecs(int ms) const
t.mds = (ds() + ms) % MSECS_PER_DAY;
}
}
-#if defined(Q_OS_WINCE)
- if (startTick > NullTime)
- t.startTick = (startTick + ms) % MSECS_PER_DAY;
-#endif
return t;
}
@@ -1792,13 +1780,7 @@ int QTime::msecsTo(const QTime &t) const
{
if (!isValid() || !t.isValid())
return 0;
-#if defined(Q_OS_WINCE)
- // GetLocalTime() for Windows CE has no milliseconds resolution
- if (t.startTick > NullTime && startTick > NullTime)
- return t.startTick - startTick;
- else
-#endif
- return t.ds() - ds();
+ return t.ds() - ds();
}
@@ -2137,13 +2119,14 @@ int QTime::elapsed() const
QDateTime static helper functions
*****************************************************************************/
+// get the types from QDateTime (through QDateTimePrivate)
+typedef QDateTimePrivate::QDateTimeShortData ShortData;
+typedef QDateTimePrivate::QDateTimeData QDateTimeData;
+
// Calls the platform variant of tzset
static void qt_tzset()
{
-#if defined(Q_OS_WINCE)
- // WinCE doesn't use tzset
- return;
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
_tzset();
#else
tzset();
@@ -2157,12 +2140,7 @@ static void qt_tzset()
// Relies on tzset, mktime, or localtime having been called to populate timezone
static int qt_timezone()
{
-#if defined(Q_OS_WINCE)
- TIME_ZONE_INFORMATION tzi;
- GetTimeZoneInformation(&tzi);
- // Expressed in minutes, convert to seconds
- return (tzi.Bias + tzi.StandardBias) * 60;
-#elif defined(_MSC_VER) && _MSC_VER >= 1400
+#if defined(_MSC_VER)
long offset;
_get_timezone(&offset);
return offset;
@@ -2191,16 +2169,6 @@ static int qt_timezone()
// Returns the tzname, assume tzset has been called already
static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus)
{
-#if defined(Q_OS_WINCE)
- TIME_ZONE_INFORMATION tzi;
- DWORD res = GetTimeZoneInformation(&tzi);
- if (res == TIME_ZONE_ID_UNKNOWN)
- return QString();
- else if (daylightStatus == QDateTimePrivate::DaylightTime)
- return QString::fromWCharArray(tzi.DaylightName);
- else
- return QString::fromWCharArray(tzi.StandardName);
-#else
int isDst = (daylightStatus == QDateTimePrivate::DaylightTime) ? 1 : 0;
#if defined(_MSC_VER) && _MSC_VER >= 1400
size_t s = 0;
@@ -2211,7 +2179,6 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus)
#else
return QString::fromLocal8Bit(tzname[isDst]);
#endif // Q_OS_WIN
-#endif // Q_OS_WINCE
}
// Calls the platform variant of mktime for the given date, time and daylightStatus,
@@ -2226,48 +2193,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat
int yy, mm, dd;
date->getDate(&yy, &mm, &dd);
-#if defined(Q_OS_WINCE)
- // WinCE doesn't provide standard C library time functions
- SYSTEMTIME st;
- memset(&st, 0, sizeof(SYSTEMTIME));
- st.wSecond = time->second();
- st.wMinute = time->minute();
- st.wHour = time->hour();
- st.wDay = dd;
- st.wMonth = mm;
- st.wYear = yy;
- FILETIME lft;
- bool valid = SystemTimeToFileTime(&st, &lft);
- FILETIME ft;
- if (valid)
- valid = LocalFileTimeToFileTime(&lft, &ft);
- const time_t secsSinceEpoch = ftToTime_t(ft);
- const time_t localSecs = ftToTime_t(lft);
- TIME_ZONE_INFORMATION tzi;
- GetTimeZoneInformation(&tzi);
- bool isDaylight = false;
- // Check for overflow
- qint64 localDiff = qAbs(localSecs - secsSinceEpoch);
- int daylightOffset = qAbs(tzi.Bias + tzi.DaylightBias) * 60;
- if (localDiff > daylightOffset)
- valid = false;
- else
- isDaylight = (localDiff == daylightOffset);
- if (daylightStatus) {
- if (isDaylight)
- *daylightStatus = QDateTimePrivate::DaylightTime;
- else
- *daylightStatus = QDateTimePrivate::StandardTime;
- }
- if (abbreviation) {
- if (isDaylight)
- *abbreviation = QString::fromWCharArray(tzi.DaylightName);
- else
- *abbreviation = QString::fromWCharArray(tzi.StandardName);
- }
- if (ok)
- *ok = valid;
-#else
// All other platforms provide standard C library time functions
tm local;
memset(&local, 0, sizeof(local)); // tm_[wy]day plus any non-standard fields
@@ -2329,7 +2254,6 @@ static qint64 qt_mktime(QDate *date, QTime *time, QDateTimePrivate::DaylightStat
if (ok)
*ok = false;
}
-#endif // Q_OS_WINCE
return ((qint64)secsSinceEpoch * 1000) + msec;
}
@@ -2345,23 +2269,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
tm local;
bool valid = false;
-#if defined(Q_OS_WINCE)
- FILETIME utcTime = time_tToFt(secsSinceEpoch);
- FILETIME resultTime;
- valid = FileTimeToLocalFileTime(&utcTime , &resultTime);
- SYSTEMTIME sysTime;
- if (valid)
- valid = FileTimeToSystemTime(&resultTime , &sysTime);
-
- if (valid) {
- local.tm_sec = sysTime.wSecond;
- local.tm_min = sysTime.wMinute;
- local.tm_hour = sysTime.wHour;
- local.tm_mday = sysTime.wDay;
- local.tm_mon = sysTime.wMonth - 1;
- local.tm_year = sysTime.wYear - 1900;
- }
-#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
// localtime() is required to work as if tzset() was called before it.
// localtime_r() does not have this requirement, so make an explicit call.
qt_tzset();
@@ -2574,240 +2482,403 @@ static qint64 localMSecsToEpochMSecs(qint64 localMsecs,
}
}
-/*****************************************************************************
- QDateTimePrivate member functions
- *****************************************************************************/
+static inline bool specCanBeSmall(Qt::TimeSpec spec)
+{
+ return spec == Qt::LocalTime || spec == Qt::UTC;
+}
-QDateTimePrivate::QDateTimePrivate(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
- int offsetSeconds)
- : m_msecs(0),
- m_spec(Qt::LocalTime),
- m_offsetFromUtc(0),
- m_status(0)
+static Q_DECL_CONSTEXPR inline
+QDateTimePrivate::StatusFlags mergeSpec(QDateTimePrivate::StatusFlags status, Qt::TimeSpec spec)
{
- setTimeSpec(toSpec, offsetSeconds);
- setDateTime(toDate, toTime);
+ return QDateTimePrivate::StatusFlags((status & ~QDateTimePrivate::TimeSpecMask) |
+ (int(spec) << QDateTimePrivate::TimeSpecShift));
}
-#ifndef QT_BOOTSTRAPPED
-QDateTimePrivate::QDateTimePrivate(const QDate &toDate, const QTime &toTime,
- const QTimeZone &toTimeZone)
- : m_spec(Qt::TimeZone),
- m_offsetFromUtc(0),
- m_timeZone(toTimeZone),
- m_status(0)
+static Q_DECL_CONSTEXPR inline Qt::TimeSpec extractSpec(QDateTimePrivate::StatusFlags status)
{
- setDateTime(toDate, toTime);
+ return Qt::TimeSpec((status & QDateTimePrivate::TimeSpecMask) >> QDateTimePrivate::TimeSpecShift);
}
-#endif // QT_BOOTSTRAPPED
-void QDateTimePrivate::setTimeSpec(Qt::TimeSpec spec, int offsetSeconds)
+// Set the Daylight Status if LocalTime set via msecs
+static Q_DECL_RELAXED_CONSTEXPR inline QDateTimePrivate::StatusFlags
+mergeDaylightStatus(QDateTimePrivate::StatusFlags sf, QDateTimePrivate::DaylightStatus status)
+{
+ sf &= ~QDateTimePrivate::DaylightMask;
+ if (status == QDateTimePrivate::DaylightTime) {
+ sf |= QDateTimePrivate::SetToDaylightTime;
+ } else if (status == QDateTimePrivate::StandardTime) {
+ sf |= QDateTimePrivate::SetToStandardTime;
+ }
+ return sf;
+}
+
+// Get the DST Status if LocalTime set via msecs
+static Q_DECL_RELAXED_CONSTEXPR inline
+QDateTimePrivate::DaylightStatus extractDaylightStatus(QDateTimePrivate::StatusFlags status)
{
- clearValidDateTime();
- clearSetToDaylightStatus();
+ if (status & QDateTimePrivate::SetToDaylightTime)
+ return QDateTimePrivate::DaylightTime;
+ if (status & QDateTimePrivate::SetToStandardTime)
+ return QDateTimePrivate::StandardTime;
+ return QDateTimePrivate::UnknownDaylightTime;
+}
+
+static inline qint64 getMSecs(const QDateTimeData &d)
+{
+ if (d.isShort()) {
+ // same as, but producing better code
+ //return d.data.msecs;
+ return qintptr(d.d) >> 8;
+ }
+ return d->m_msecs;
+}
+
+static inline QDateTimePrivate::StatusFlags getStatus(const QDateTimeData &d)
+{
+ if (d.isShort()) {
+ // same as, but producing better code
+ //return StatusFlag(d.data.status);
+ return QDateTimePrivate::StatusFlag(qintptr(d.d) & 0xFF);
+ }
+ return d->m_status;
+}
+
+static inline Qt::TimeSpec getSpec(const QDateTimeData &d)
+{
+ return extractSpec(getStatus(d));
+}
+
+// Refresh the LocalTime validity and offset
+static void refreshDateTime(QDateTimeData &d)
+{
+ auto status = getStatus(d);
+ const auto spec = extractSpec(status);
+ const qint64 msecs = getMSecs(d);
+ qint64 epochMSecs = 0;
+ int offsetFromUtc = 0;
+ QDate testDate;
+ QTime testTime;
+ Q_ASSERT(spec == Qt::TimeZone || spec == Qt::LocalTime);
#ifndef QT_BOOTSTRAPPED
- m_timeZone = QTimeZone();
+ // If not valid time zone then is invalid
+ if (spec == Qt::TimeZone) {
+ if (!d->m_timeZone.isValid())
+ status &= ~QDateTimePrivate::ValidDateTime;
+ else
+ epochMSecs = QDateTimePrivate::zoneMSecsToEpochMSecs(msecs, d->m_timeZone, &testDate, &testTime);
+ }
#endif // QT_BOOTSTRAPPED
- switch (spec) {
- case Qt::OffsetFromUTC:
- if (offsetSeconds == 0) {
- m_spec = Qt::UTC;
- m_offsetFromUtc = 0;
+ // If not valid date and time then is invalid
+ if (!(status & QDateTimePrivate::ValidDate) || !(status & QDateTimePrivate::ValidTime)) {
+ status &= ~QDateTimePrivate::ValidDateTime;
+ if (status & QDateTimePrivate::ShortData) {
+ d.data.status = status;
} else {
- m_spec = Qt::OffsetFromUTC;
- m_offsetFromUtc = offsetSeconds;
+ d->m_status = status;
+ d->m_offsetFromUtc = 0;
}
+ return;
+ }
+
+ // We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating
+ // LocalTime and TimeZone might fall into a "missing" DST transition hour
+ // Calling toEpochMSecs will adjust the returned date/time if it does
+ if (spec == Qt::LocalTime) {
+ auto dstStatus = extractDaylightStatus(status);
+ epochMSecs = localMSecsToEpochMSecs(msecs, &dstStatus, &testDate, &testTime);
+ }
+ if (timeToMSecs(testDate, testTime) == msecs) {
+ status |= QDateTimePrivate::ValidDateTime;
+ // Cache the offset to use in offsetFromUtc()
+ offsetFromUtc = (msecs - epochMSecs) / 1000;
+ } else {
+ status &= ~QDateTimePrivate::ValidDateTime;
+ }
+
+ if (status & QDateTimePrivate::ShortData) {
+ d.data.status = status;
+ } else {
+ d->m_status = status;
+ d->m_offsetFromUtc = offsetFromUtc;
+ }
+}
+
+// Check the UTC / offsetFromUTC validity
+static void checkValidDateTime(QDateTimeData &d)
+{
+ auto status = getStatus(d);
+ auto spec = extractSpec(status);
+ switch (spec) {
+ case Qt::OffsetFromUTC:
+ case Qt::UTC:
+ // for these, a valid date and a valid time imply a valid QDateTime
+ if ((status & QDateTimePrivate::ValidDate) && (status & QDateTimePrivate::ValidTime))
+ status |= QDateTimePrivate::ValidDateTime;
+ else
+ status &= ~QDateTimePrivate::ValidDateTime;
+ if (status & QDateTimePrivate::ShortData)
+ d.data.status = status;
+ else
+ d->m_status = status;
break;
case Qt::TimeZone:
- // Use system time zone instead
- m_spec = Qt::LocalTime;
- m_offsetFromUtc = 0;
+ case Qt::LocalTime:
+ // for these, we need to check whether the timezone is valid and whether
+ // the time is valid in that timezone. Expensive, but no other option.
+ refreshDateTime(d);
break;
+ }
+}
+
+static void setTimeSpec(QDateTimeData &d, Qt::TimeSpec spec, int offsetSeconds)
+{
+ auto status = getStatus(d);
+ status &= ~(QDateTimePrivate::ValidDateTime | QDateTimePrivate::DaylightMask |
+ QDateTimePrivate::TimeSpecMask);
+
+ switch (spec) {
+ case Qt::OffsetFromUTC:
+ if (offsetSeconds == 0)
+ spec = Qt::UTC;
+ break;
+ case Qt::TimeZone:
+ // Use system time zone instead
+ spec = Qt::LocalTime;
+ // fallthrough
case Qt::UTC:
case Qt::LocalTime:
- m_spec = spec;
- m_offsetFromUtc = 0;
+ offsetSeconds = 0;
break;
}
+
+ status = mergeSpec(status, spec);
+ if (d.isShort() && offsetSeconds == 0) {
+ d.data.status = status;
+ } else {
+ d.detach();
+ d->m_status = status & ~QDateTimePrivate::ShortData;
+ d->m_offsetFromUtc = offsetSeconds;
+#ifndef QT_BOOTSTRAPPED
+ d->m_timeZone = QTimeZone();
+#endif // QT_BOOTSTRAPPED
+ }
}
-void QDateTimePrivate::setDateTime(const QDate &date, const QTime &time)
+static void setDateTime(QDateTimeData &d, const QDate &date, const QTime &time)
{
// If the date is valid and the time is not we set time to 00:00:00
QTime useTime = time;
if (!useTime.isValid() && date.isValid())
useTime = QTime::fromMSecsSinceStartOfDay(0);
- StatusFlags newStatus;
+ QDateTimePrivate::StatusFlags newStatus = 0;
// Set date value and status
qint64 days = 0;
if (date.isValid()) {
days = date.toJulianDay() - JULIAN_DAY_FOR_EPOCH;
- newStatus = ValidDate;
- } else if (date.isNull()) {
- newStatus = NullDate;
+ newStatus = QDateTimePrivate::ValidDate;
}
// Set time value and status
int ds = 0;
if (useTime.isValid()) {
ds = useTime.msecsSinceStartOfDay();
- newStatus |= ValidTime;
- } else if (time.isNull()) {
- newStatus |= NullTime;
+ newStatus |= QDateTimePrivate::ValidTime;
}
// Set msecs serial value
- m_msecs = (days * MSECS_PER_DAY) + ds;
- m_status = newStatus;
+ qint64 msecs = (days * MSECS_PER_DAY) + ds;
+ if (d.isShort()) {
+ // let's see if we can keep this short
+ d.data.msecs = qintptr(msecs);
+ if (d.data.msecs == msecs) {
+ // yes, we can
+ d.data.status &= ~(QDateTimePrivate::ValidityMask | QDateTimePrivate::DaylightMask);
+ d.data.status |= newStatus;
+ } else {
+ // nope...
+ d.detach();
+ }
+ }
+ if (!d.isShort()) {
+ d.detach();
+ d->m_msecs = msecs;
+ d->m_status &= ~(QDateTimePrivate::ValidityMask | QDateTimePrivate::DaylightMask);
+ d->m_status |= newStatus;
+ }
// Set if date and time are valid
- checkValidDateTime();
+ checkValidDateTime(d);
}
-QPair<QDate, QTime> QDateTimePrivate::getDateTime() const
+static QPair<QDate, QTime> getDateTime(const QDateTimeData &d)
{
QPair<QDate, QTime> result;
- msecsToTime(m_msecs, &result.first, &result.second);
+ qint64 msecs = getMSecs(d);
+ auto status = getStatus(d);
+ msecsToTime(msecs, &result.first, &result.second);
- if (isNullDate())
+ if (!status.testFlag(QDateTimePrivate::ValidDate))
result.first = QDate();
- if (isNullTime())
+ if (!status.testFlag(QDateTimePrivate::ValidTime))
result.second = QTime();
return result;
}
-// Set the Daylight Status if LocalTime set via msecs
-void QDateTimePrivate::setDaylightStatus(QDateTimePrivate::DaylightStatus status)
-{
- if (status == DaylightTime) {
- m_status = m_status & ~SetToStandardTime;
- m_status = m_status | SetToDaylightTime;
- } else if (status == StandardTime) {
- m_status = m_status & ~SetToDaylightTime;
- m_status = m_status | SetToStandardTime;
+/*****************************************************************************
+ QDateTime::Data member functions
+ *****************************************************************************/
+
+inline QDateTime::Data::Data(Qt::TimeSpec spec)
+{
+ if (CanBeSmall && Q_LIKELY(specCanBeSmall(spec))) {
+ d = reinterpret_cast<QDateTimePrivate *>(int(mergeSpec(QDateTimePrivate::ShortData, spec)));
} else {
- clearSetToDaylightStatus();
+ // the structure is too small, we need to detach
+ d = new QDateTimePrivate;
+ d->ref.ref();
+ d->m_status = mergeSpec(0, spec);
}
}
-// Get the DST Status if LocalTime set via msecs
-QDateTimePrivate::DaylightStatus QDateTimePrivate::daylightStatus() const
+inline QDateTime::Data::Data(const Data &other)
+ : d(other.d)
{
- if ((m_status & SetToDaylightTime) == SetToDaylightTime)
- return DaylightTime;
- if ((m_status & SetToStandardTime) == SetToStandardTime)
- return StandardTime;
- return UnknownDaylightTime;
+ if (!isShort()) {
+ // check if we could shrink
+ ShortData sd;
+ sd.msecs = qintptr(d->m_msecs);
+ if (CanBeSmall && specCanBeSmall(extractSpec(d->m_status)) && sd.msecs == d->m_msecs) {
+ sd.status = d->m_status | QDateTimePrivate::ShortData;
+ data = sd;
+ } else {
+ // no, have to keep it big
+ d->ref.ref();
+ }
+ }
}
-qint64 QDateTimePrivate::toMSecsSinceEpoch() const
+inline QDateTime::Data::Data(Data &&other)
+ : d(other.d)
{
- switch (m_spec) {
- case Qt::OffsetFromUTC:
- case Qt::UTC:
- return (m_msecs - (m_offsetFromUtc * 1000));
-
- case Qt::LocalTime: {
- // recalculate the local timezone
- DaylightStatus status = daylightStatus();
- return localMSecsToEpochMSecs(m_msecs, &status);
+ // reset the other to a short state, if we can
+ if (CanBeSmall) {
+ Data dummy(Qt::LocalTime);
+ Q_ASSERT(dummy.isShort());
+ other.d = dummy.d;
+ } else if (!isShort()) {
+ // can't be small, so do implicit sharing
+ d->ref.ref();
}
+}
- case Qt::TimeZone:
-#ifdef QT_BOOTSTRAPPED
- break;
-#else
- return zoneMSecsToEpochMSecs(m_msecs, m_timeZone);
-#endif
+inline QDateTime::Data &QDateTime::Data::operator=(const Data &other)
+{
+ if (d == other.d)
+ return *this;
+
+ auto x = d;
+ d = other.d;
+ if (!other.isShort()) {
+ // check if we could shrink
+ ShortData sd;
+ sd.msecs = qintptr(other.d->m_msecs);
+ if (CanBeSmall && specCanBeSmall(extractSpec(other.d->m_status)) && sd.msecs == other.d->m_msecs) {
+ sd.status = other.d->m_status | QDateTimePrivate::ShortData;
+ data = sd;
+ } else {
+ // no, have to keep it big
+ other.d->ref.ref();
+ }
}
- Q_UNREACHABLE();
- return 0;
+
+ if (!(CanBeSmall && quintptr(x) & QDateTimePrivate::ShortData) && !x->ref.deref())
+ delete x;
+ return *this;
}
-// Check the UTC / offsetFromUTC validity
-void QDateTimePrivate::checkValidDateTime()
+inline QDateTime::Data::~Data()
{
- switch (m_spec) {
- case Qt::OffsetFromUTC:
- case Qt::UTC:
- // for these, a valid date and a valid time imply a valid QDateTime
- if (isValidDate() && isValidTime())
- setValidDateTime();
- else
- clearValidDateTime();
- break;
- case Qt::TimeZone:
- case Qt::LocalTime:
- // for these, we need to check whether the timezone is valid and whether
- // the time is valid in that timezone. Expensive, but no other option.
- refreshDateTime();
- break;
- }
+ if (!isShort() && !d->ref.deref())
+ delete d;
}
-// Refresh the LocalTime validity and offset
-void QDateTimePrivate::refreshDateTime()
+inline bool QDateTime::Data::isShort() const
{
- switch (m_spec) {
- case Qt::OffsetFromUTC:
- case Qt::UTC:
- // Always set by setDateTime so just return
- return;
- case Qt::TimeZone:
- case Qt::LocalTime:
- break;
- }
+ return CanBeSmall && quintptr(d) & QDateTimePrivate::ShortData;
+}
- // If not valid date and time then is invalid
- if (!isValidDate() || !isValidTime()) {
- clearValidDateTime();
- m_offsetFromUtc = 0;
- return;
- }
+inline void QDateTime::Data::detach()
+{
+ QDateTimePrivate *x;
+ bool wasShort = isShort();
+ if (wasShort) {
+ // force enlarging
+ x = new QDateTimePrivate;
+ x->m_status = QDateTimePrivate::StatusFlag(data.status & ~QDateTimePrivate::ShortData);
+ x->m_msecs = data.msecs;
+ } else {
+ if (d->ref.load() == 1)
+ return;
-#ifndef QT_BOOTSTRAPPED
- // If not valid time zone then is invalid
- if (m_spec == Qt::TimeZone && !m_timeZone.isValid()) {
- clearValidDateTime();
- m_offsetFromUtc = 0;
- return;
+ x = new QDateTimePrivate(*d);
}
-#endif // QT_BOOTSTRAPPED
- // We have a valid date and time and a Qt::LocalTime or Qt::TimeZone that needs calculating
- // LocalTime and TimeZone might fall into a "missing" DST transition hour
- // Calling toEpochMSecs will adjust the returned date/time if it does
- QDate testDate;
- QTime testTime;
- qint64 epochMSecs = 0;
- if (m_spec == Qt::LocalTime) {
- DaylightStatus status = daylightStatus();
- epochMSecs = localMSecsToEpochMSecs(m_msecs, &status, &testDate, &testTime);
-#ifndef QT_BOOTSTRAPPED
- } else {
- epochMSecs = zoneMSecsToEpochMSecs(m_msecs, m_timeZone, &testDate, &testTime);
-#endif // QT_BOOTSTRAPPED
- }
- if (timeToMSecs(testDate, testTime) == m_msecs) {
- setValidDateTime();
- // Cache the offset to use in toMSecsSinceEpoch()
- m_offsetFromUtc = (m_msecs - epochMSecs) / 1000;
- } else {
- clearValidDateTime();
- m_offsetFromUtc = 0;
- }
+ x->ref.store(1);
+ if (!wasShort && !d->ref.deref())
+ delete d;
+ d = x;
+}
+
+inline const QDateTimePrivate *QDateTime::Data::operator->() const
+{
+ Q_ASSERT(!isShort());
+ return d;
+}
+
+inline QDateTimePrivate *QDateTime::Data::operator->()
+{
+ // should we attempt to detach here?
+ Q_ASSERT(!isShort());
+ Q_ASSERT(d->ref.load() == 1);
+ return d;
+}
+
+/*****************************************************************************
+ QDateTimePrivate member functions
+ *****************************************************************************/
+
+Q_NEVER_INLINE
+QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
+ int offsetSeconds)
+{
+ QDateTime::Data result(toSpec);
+ setTimeSpec(result, toSpec, offsetSeconds);
+ setDateTime(result, toDate, toTime);
+ return result;
}
#ifndef QT_BOOTSTRAPPED
+inline QDateTime::Data QDateTimePrivate::create(const QDate &toDate, const QTime &toTime,
+ const QTimeZone &toTimeZone)
+{
+ QDateTime::Data result(Qt::TimeZone);
+ Q_ASSERT(!result.isShort());
+
+ result.d->m_status = mergeSpec(result.d->m_status, Qt::TimeZone);
+ result.d->m_timeZone = toTimeZone;
+ setDateTime(result, toDate, toTime);
+ return result;
+}
+
// Convert a TimeZone time expressed in zone msecs encoding into a UTC epoch msecs
-qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone &zone,
- QDate *localDate, QTime *localTime)
+inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone &zone,
+ QDate *localDate, QTime *localTime)
{
// Get the effective data from QTimeZone
QTimeZonePrivate::Data data = zone.d->dataForLocalTime(zoneMSecs);
@@ -2958,8 +3029,8 @@ qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QTimeZone
\sa isValid()
*/
-QDateTime::QDateTime()
- : d(*defaultDateTimePrivate())
+QDateTime::QDateTime() Q_DECL_NOEXCEPT_EXPR(Data::CanBeSmall)
+ : d(Qt::LocalTime)
{
}
@@ -2970,7 +3041,7 @@ QDateTime::QDateTime()
*/
QDateTime::QDateTime(const QDate &date)
- : d(new QDateTimePrivate(date, QTime(0, 0, 0), Qt::LocalTime, 0))
+ : d(QDateTimePrivate::create(date, QTime(0, 0, 0), Qt::LocalTime, 0))
{
}
@@ -2990,7 +3061,7 @@ QDateTime::QDateTime(const QDate &date)
*/
QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec)
- : d(new QDateTimePrivate(date, time, spec, 0))
+ : d(QDateTimePrivate::create(date, time, spec, 0))
{
}
@@ -3013,7 +3084,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec)
*/
QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec, int offsetSeconds)
- : d(new QDateTimePrivate(date, time, spec, offsetSeconds))
+ : d(QDateTimePrivate::create(date, time, spec, offsetSeconds))
{
}
@@ -3030,7 +3101,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec, in
*/
QDateTime::QDateTime(const QDate &date, const QTime &time, const QTimeZone &timeZone)
- : d(new QDateTimePrivate(date, time, timeZone))
+ : d(QDateTimePrivate::create(date, time, timeZone))
{
}
#endif // QT_BOOTSTRAPPED
@@ -3038,13 +3109,22 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, const QTimeZone &time
/*!
Constructs a copy of the \a other datetime.
*/
-
-QDateTime::QDateTime(const QDateTime &other)
+QDateTime::QDateTime(const QDateTime &other) Q_DECL_NOTHROW
: d(other.d)
{
}
/*!
+ \since 5.8
+ Moves the content of the temporary \a other datetime to this object and
+ leaves \a other in an unspecified (but proper) state.
+*/
+QDateTime::QDateTime(QDateTime &&other) Q_DECL_NOTHROW
+ : d(std::move(other.d))
+{
+}
+
+/*!
Destroys the datetime.
*/
QDateTime::~QDateTime()
@@ -3056,7 +3136,7 @@ QDateTime::~QDateTime()
copy.
*/
-QDateTime &QDateTime::operator=(const QDateTime &other)
+QDateTime &QDateTime::operator=(const QDateTime &other) Q_DECL_NOTHROW
{
d = other.d;
return *this;
@@ -3078,7 +3158,9 @@ QDateTime &QDateTime::operator=(const QDateTime &other)
bool QDateTime::isNull() const
{
- return d->isNullDate() && d->isNullTime();
+ auto status = getStatus(d);
+ return !status.testFlag(QDateTimePrivate::ValidDate) &&
+ !status.testFlag(QDateTimePrivate::ValidTime);
}
/*!
@@ -3095,7 +3177,8 @@ bool QDateTime::isNull() const
bool QDateTime::isValid() const
{
- return (d->isValidDateTime());
+ auto status = getStatus(d);
+ return status & QDateTimePrivate::ValidDateTime;
}
/*!
@@ -3106,10 +3189,11 @@ bool QDateTime::isValid() const
QDate QDateTime::date() const
{
- if (d->isNullDate())
+ auto status = getStatus(d);
+ if (!status.testFlag(QDateTimePrivate::ValidDate))
return QDate();
QDate dt;
- msecsToTime(d->m_msecs, &dt, 0);
+ msecsToTime(getMSecs(d), &dt, 0);
return dt;
}
@@ -3121,10 +3205,11 @@ QDate QDateTime::date() const
QTime QDateTime::time() const
{
- if (d->isNullTime())
+ auto status = getStatus(d);
+ if (!status.testFlag(QDateTimePrivate::ValidTime))
return QTime();
QTime tm;
- msecsToTime(d->m_msecs, 0, &tm);
+ msecsToTime(getMSecs(d), 0, &tm);
return tm;
}
@@ -3136,7 +3221,7 @@ QTime QDateTime::time() const
Qt::TimeSpec QDateTime::timeSpec() const
{
- return d->m_spec;
+ return getSpec(d);
}
#ifndef QT_BOOTSTRAPPED
@@ -3154,7 +3239,7 @@ Qt::TimeSpec QDateTime::timeSpec() const
QTimeZone QDateTime::timeZone() const
{
- switch (d->m_spec) {
+ switch (getSpec(d)) {
case Qt::UTC:
return QTimeZone::utc();
case Qt::OffsetFromUTC:
@@ -3189,7 +3274,20 @@ QTimeZone QDateTime::timeZone() const
int QDateTime::offsetFromUtc() const
{
- return d->m_offsetFromUtc;
+ if (!d.isShort())
+ return d->m_offsetFromUtc;
+ if (!isValid())
+ return 0;
+
+ auto spec = getSpec(d);
+ if (spec == Qt::LocalTime) {
+ // we didn't cache the value, so we need to calculate it now...
+ qint64 msecs = getMSecs(d);
+ return (msecs - toMSecsSinceEpoch()) / 1000;
+ }
+
+ Q_ASSERT(spec == Qt::UTC);
+ return 0;
}
/*!
@@ -3215,7 +3313,7 @@ int QDateTime::offsetFromUtc() const
QString QDateTime::timeZoneAbbreviation() const
{
- switch (d->m_spec) {
+ switch (getSpec(d)) {
case Qt::UTC:
return QTimeZonePrivate::utcQString();
case Qt::OffsetFromUTC:
@@ -3224,12 +3322,12 @@ QString QDateTime::timeZoneAbbreviation() const
#ifdef QT_BOOTSTRAPPED
break;
#else
- return d->m_timeZone.d->abbreviation(d->toMSecsSinceEpoch());
+ return d->m_timeZone.d->abbreviation(toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
QString abbrev;
- QDateTimePrivate::DaylightStatus status = d->daylightStatus();
- localMSecsToEpochMSecs(d->m_msecs, &status, 0, 0, &abbrev);
+ auto status = extractDaylightStatus(getStatus(d));
+ localMSecsToEpochMSecs(getMSecs(d), &status, 0, 0, &abbrev);
return abbrev;
}
}
@@ -3249,7 +3347,7 @@ QString QDateTime::timeZoneAbbreviation() const
bool QDateTime::isDaylightTime() const
{
- switch (d->m_spec) {
+ switch (getSpec(d)) {
case Qt::UTC:
case Qt::OffsetFromUTC:
return false;
@@ -3260,9 +3358,9 @@ bool QDateTime::isDaylightTime() const
return d->m_timeZone.d->isDaylightTime(toMSecsSinceEpoch());
#endif // QT_BOOTSTRAPPED
case Qt::LocalTime: {
- QDateTimePrivate::DaylightStatus status = d->daylightStatus();
+ auto status = extractDaylightStatus(getStatus(d));
if (status == QDateTimePrivate::UnknownDaylightTime)
- localMSecsToEpochMSecs(d->m_msecs, &status);
+ localMSecsToEpochMSecs(getMSecs(d), &status);
return (status == QDateTimePrivate::DaylightTime);
}
}
@@ -3278,7 +3376,7 @@ bool QDateTime::isDaylightTime() const
void QDateTime::setDate(const QDate &date)
{
- d->setDateTime(date, time());
+ setDateTime(d, date, time());
}
/*!
@@ -3296,7 +3394,7 @@ void QDateTime::setDate(const QDate &date)
void QDateTime::setTime(const QTime &time)
{
- d->setDateTime(date(), time);
+ setDateTime(d, date(), time);
}
/*!
@@ -3317,9 +3415,8 @@ void QDateTime::setTime(const QTime &time)
void QDateTime::setTimeSpec(Qt::TimeSpec spec)
{
- QDateTimePrivate *d = this->d.data(); // detaches (and shadows d)
- d->setTimeSpec(spec, 0);
- d->checkValidDateTime();
+ QT_PREPEND_NAMESPACE(setTimeSpec(d, spec, 0));
+ checkValidDateTime(d);
}
/*!
@@ -3339,9 +3436,8 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec)
void QDateTime::setOffsetFromUtc(int offsetSeconds)
{
- QDateTimePrivate *d = this->d.data(); // detaches (and shadows d)
- d->setTimeSpec(Qt::OffsetFromUTC, offsetSeconds);
- d->checkValidDateTime();
+ QT_PREPEND_NAMESPACE(setTimeSpec(d, Qt::OffsetFromUTC, offsetSeconds));
+ checkValidDateTime(d);
}
#ifndef QT_BOOTSTRAPPED
@@ -3358,11 +3454,11 @@ void QDateTime::setOffsetFromUtc(int offsetSeconds)
void QDateTime::setTimeZone(const QTimeZone &toZone)
{
- QDateTimePrivate *d = this->d.data(); // detaches (and shadows d)
- d->m_spec = Qt::TimeZone;
+ d.detach(); // always detach
+ d->m_status = mergeSpec(d->m_status, Qt::TimeZone);
d->m_offsetFromUtc = 0;
d->m_timeZone = toZone;
- d->refreshDateTime();
+ refreshDateTime(d);
}
#endif // QT_BOOTSTRAPPED
@@ -3383,7 +3479,28 @@ void QDateTime::setTimeZone(const QTimeZone &toZone)
*/
qint64 QDateTime::toMSecsSinceEpoch() const
{
- return d->toMSecsSinceEpoch();
+ switch (getSpec(d)) {
+ case Qt::UTC:
+ return getMSecs(d);
+
+ case Qt::OffsetFromUTC:
+ return d->m_msecs - (d->m_offsetFromUtc * 1000);
+
+ case Qt::LocalTime: {
+ // recalculate the local timezone
+ auto status = extractDaylightStatus(getStatus(d));
+ return localMSecsToEpochMSecs(getMSecs(d), &status);
+ }
+
+ case Qt::TimeZone:
+#ifdef QT_BOOTSTRAPPED
+ break;
+#else
+ return QDateTimePrivate::zoneMSecsToEpochMSecs(d->m_msecs, d->m_timeZone);
+#endif
+ }
+ Q_UNREACHABLE();
+ return 0;
}
/*!
@@ -3412,7 +3529,7 @@ uint QDateTime::toTime_t() const
{
if (!isValid())
return uint(-1);
- qint64 retval = d->toMSecsSinceEpoch() / 1000;
+ qint64 retval = toMSecsSinceEpoch() / 1000;
if (quint64(retval) >= Q_UINT64_C(0xFFFFFFFF))
return uint(-1);
return uint(retval);
@@ -3434,51 +3551,67 @@ uint QDateTime::toTime_t() const
*/
void QDateTime::setMSecsSinceEpoch(qint64 msecs)
{
- QDateTimePrivate *d = this->d.data(); // detaches (and shadows d)
+ const auto spec = getSpec(d);
+ auto status = getStatus(d);
- d->m_status = 0;
- switch (d->m_spec) {
+ status &= ~QDateTimePrivate::ValidityMask;
+ switch (spec) {
case Qt::UTC:
- d->m_msecs = msecs;
- d->m_status = d->m_status
+ status = status
| QDateTimePrivate::ValidDate
| QDateTimePrivate::ValidTime
| QDateTimePrivate::ValidDateTime;
break;
case Qt::OffsetFromUTC:
- d->m_msecs = msecs + (d->m_offsetFromUtc * 1000);
- d->m_status = d->m_status
+ msecs = msecs + (d->m_offsetFromUtc * 1000);
+ status = status
| QDateTimePrivate::ValidDate
| QDateTimePrivate::ValidTime
| QDateTimePrivate::ValidDateTime;
break;
case Qt::TimeZone:
+ Q_ASSERT(!d.isShort());
#ifndef QT_BOOTSTRAPPED
// Docs state any LocalTime before 1970-01-01 will *not* have any DST applied
// but all affected times afterwards will have DST applied.
+ d.detach();
if (msecs >= 0)
d->m_offsetFromUtc = d->m_timeZone.d->offsetFromUtc(msecs);
else
d->m_offsetFromUtc = d->m_timeZone.d->standardTimeOffset(msecs);
- d->m_msecs = msecs + (d->m_offsetFromUtc * 1000);
- d->m_status = d->m_status
+ msecs = msecs + (d->m_offsetFromUtc * 1000);
+ status = status
| QDateTimePrivate::ValidDate
| QDateTimePrivate::ValidTime
| QDateTimePrivate::ValidDateTime;
- d->refreshDateTime();
#endif // QT_BOOTSTRAPPED
break;
case Qt::LocalTime: {
QDate dt;
QTime tm;
- QDateTimePrivate::DaylightStatus status;
- epochMSecsToLocalTime(msecs, &dt, &tm, &status);
- d->setDateTime(dt, tm);
- d->setDaylightStatus(status);
- d->refreshDateTime();
+ QDateTimePrivate::DaylightStatus dstStatus;
+ epochMSecsToLocalTime(msecs, &dt, &tm, &dstStatus);
+ setDateTime(d, dt, tm);
+ msecs = getMSecs(d);
+ status = mergeDaylightStatus(getStatus(d), dstStatus);
break;
}
}
+
+ ShortData sd;
+ sd.msecs = msecs;
+ if (d.isShort() && sd.msecs == msecs) {
+ // we can keep short
+ sd.status = status;
+ d.data = sd;
+ } else {
+ d.detach();
+ d->m_status = status;
+ d->m_msecs = msecs;
+ }
+
+ if (spec == Qt::LocalTime || spec == Qt::TimeZone)
+ refreshDateTime(d);
}
/*!
@@ -3565,13 +3698,13 @@ QString QDateTime::toString(Qt::DateFormat format) const
return QLocale().toString(*this, QLocale::LongFormat);
case Qt::RFC2822Date: {
buf = QLocale::c().toString(*this, QStringLiteral("dd MMM yyyy hh:mm:ss "));
- buf += toOffsetString(Qt::TextDate, d->m_offsetFromUtc);
+ buf += toOffsetString(Qt::TextDate, offsetFromUtc());
return buf;
}
default:
#ifndef QT_NO_TEXTDATE
case Qt::TextDate: {
- const QPair<QDate, QTime> p = d->getDateTime();
+ const QPair<QDate, QTime> p = getDateTime(d);
const QDate &dt = p.first;
const QTime &tm = p.second;
//We cant use date.toString(Qt::TextDate) as we need to insert the time before the year
@@ -3582,14 +3715,14 @@ QString QDateTime::toString(Qt::DateFormat format) const
.arg(dt.year());
if (timeSpec() != Qt::LocalTime) {
buf += QStringLiteral(" GMT");
- if (d->m_spec == Qt::OffsetFromUTC)
- buf += toOffsetString(Qt::TextDate, d->m_offsetFromUtc);
+ if (getSpec(d) == Qt::OffsetFromUTC)
+ buf += toOffsetString(Qt::TextDate, offsetFromUtc());
}
return buf;
}
#endif
case Qt::ISODate: {
- const QPair<QDate, QTime> p = d->getDateTime();
+ const QPair<QDate, QTime> p = getDateTime(d);
const QDate &dt = p.first;
const QTime &tm = p.second;
buf = dt.toString(Qt::ISODate);
@@ -3597,12 +3730,12 @@ QString QDateTime::toString(Qt::DateFormat format) const
return QString(); // failed to convert
buf += QLatin1Char('T');
buf += tm.toString(Qt::ISODate);
- switch (d->m_spec) {
+ switch (getSpec(d)) {
case Qt::UTC:
buf += QLatin1Char('Z');
break;
case Qt::OffsetFromUTC:
- buf += toOffsetString(Qt::ISODate, d->m_offsetFromUtc);
+ buf += toOffsetString(Qt::ISODate, offsetFromUtc());
break;
default:
break;
@@ -3691,12 +3824,7 @@ QString QDateTime::toString(const QString& format) const
}
#endif //QT_NO_DATESTRING
-static void massageAdjustedDateTime(Qt::TimeSpec spec,
-#ifndef QT_BOOTSTRAPPED
- const QTimeZone &zone,
-#endif // QT_BOOTSTRAPPED
- QDate *date,
- QTime *time)
+static inline void massageAdjustedDateTime(const QDateTimeData &d, QDate *date, QTime *time)
{
/*
If we have just adjusted to a day with a DST transition, our given time
@@ -3706,24 +3834,20 @@ static void massageAdjustedDateTime(Qt::TimeSpec spec,
to its DST-ness); but for a time in spring's missing hour it'll adjust the
time while picking a DST-ness. (Handling of autumn is trickier, as either
DST-ness is valid, without adjusting the time. We might want to propagate
- d->daylightStatus() in that case, but it's hard to do so without breaking
+ the daylight status in that case, but it's hard to do so without breaking
(far more common) other cases; and it makes little difference, as the two
answers do then differ only in DST-ness.)
*/
+ auto spec = getSpec(d);
if (spec == Qt::LocalTime) {
QDateTimePrivate::DaylightStatus status = QDateTimePrivate::UnknownDaylightTime;
localMSecsToEpochMSecs(timeToMSecs(*date, *time), &status, date, time);
#ifndef QT_BOOTSTRAPPED
} else if (spec == Qt::TimeZone) {
- QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(*date, *time), zone, date, time);
+ QDateTimePrivate::zoneMSecsToEpochMSecs(timeToMSecs(*date, *time), d->m_timeZone, date, time);
#endif // QT_BOOTSTRAPPED
}
}
-#ifdef QT_BOOTSTRAPPED // Avoid duplicate #if-ery in uses.
-#define MASSAGEADJUSTEDDATETIME(s, z, d, t) massageAdjustedDateTime(s, d, t)
-#else
-#define MASSAGEADJUSTEDDATETIME(s, z, d, t) massageAdjustedDateTime(s, z, d, t)
-#endif // QT_BOOTSTRAPPED
/*!
Returns a QDateTime object containing a datetime \a ndays days
@@ -3742,12 +3866,12 @@ static void massageAdjustedDateTime(Qt::TimeSpec spec,
QDateTime QDateTime::addDays(qint64 ndays) const
{
QDateTime dt(*this);
- QPair<QDate, QTime> p = d->getDateTime();
+ QPair<QDate, QTime> p = getDateTime(d);
QDate &date = p.first;
QTime &time = p.second;
date = date.addDays(ndays);
- MASSAGEADJUSTEDDATETIME(d->m_spec, d->m_timeZone, &date, &time);
- dt.d->setDateTime(date, time);
+ massageAdjustedDateTime(dt.d, &date, &time);
+ setDateTime(dt.d, date, time);
return dt;
}
@@ -3768,12 +3892,12 @@ QDateTime QDateTime::addDays(qint64 ndays) const
QDateTime QDateTime::addMonths(int nmonths) const
{
QDateTime dt(*this);
- QPair<QDate, QTime> p = d->getDateTime();
+ QPair<QDate, QTime> p = getDateTime(d);
QDate &date = p.first;
QTime &time = p.second;
date = date.addMonths(nmonths);
- MASSAGEADJUSTEDDATETIME(d->m_spec, d->m_timeZone, &date, &time);
- dt.d->setDateTime(date, time);
+ massageAdjustedDateTime(dt.d, &date, &time);
+ setDateTime(dt.d, date, time);
return dt;
}
@@ -3794,15 +3918,14 @@ QDateTime QDateTime::addMonths(int nmonths) const
QDateTime QDateTime::addYears(int nyears) const
{
QDateTime dt(*this);
- QPair<QDate, QTime> p = d->getDateTime();
+ QPair<QDate, QTime> p = getDateTime(d);
QDate &date = p.first;
QTime &time = p.second;
date = date.addYears(nyears);
- MASSAGEADJUSTEDDATETIME(d->m_spec, d->m_timeZone, &date, &time);
- dt.d->setDateTime(date, time);
+ massageAdjustedDateTime(dt.d, &date, &time);
+ setDateTime(dt.d, date, time);
return dt;
}
-#undef MASSAGEADJUSTEDDATETIME
/*!
Returns a QDateTime object containing a datetime \a s seconds
@@ -3834,12 +3957,25 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const
return QDateTime();
QDateTime dt(*this);
- if (d->m_spec == Qt::LocalTime || d->m_spec == Qt::TimeZone)
+ auto spec = getSpec(d);
+ if (spec == Qt::LocalTime || spec == Qt::TimeZone) {
// Convert to real UTC first in case crosses DST transition
- dt.setMSecsSinceEpoch(d->toMSecsSinceEpoch() + msecs);
- else
+ dt.setMSecsSinceEpoch(toMSecsSinceEpoch() + msecs);
+ } else {
// No need to convert, just add on
- dt.d->m_msecs = dt.d->m_msecs + msecs;
+ if (d.isShort()) {
+ // need to check if we need to enlarge first
+ msecs += dt.d.data.msecs;
+ dt.d.data.msecs = qintptr(msecs);
+ if (dt.d.data.msecs != msecs) {
+ dt.d.detach();
+ dt.d->m_msecs = msecs;
+ }
+ } else {
+ dt.d.detach();
+ dt.d->m_msecs += msecs;
+ }
+ }
return dt;
}
@@ -3905,7 +4041,7 @@ qint64 QDateTime::msecsTo(const QDateTime &other) const
if (!isValid() || !other.isValid())
return 0;
- return other.d->toMSecsSinceEpoch() - d->toMSecsSinceEpoch();
+ return other.toMSecsSinceEpoch() - toMSecsSinceEpoch();
}
/*!
@@ -3928,7 +4064,7 @@ qint64 QDateTime::msecsTo(const QDateTime &other) const
QDateTime QDateTime::toTimeSpec(Qt::TimeSpec spec) const
{
- if (d->m_spec == spec && (spec == Qt::UTC || spec == Qt::LocalTime))
+ if (getSpec(d) == spec && (spec == Qt::UTC || spec == Qt::LocalTime))
return *this;
if (!isValid()) {
@@ -3937,7 +4073,7 @@ QDateTime QDateTime::toTimeSpec(Qt::TimeSpec spec) const
return ret;
}
- return fromMSecsSinceEpoch(d->toMSecsSinceEpoch(), spec, 0);
+ return fromMSecsSinceEpoch(toMSecsSinceEpoch(), spec, 0);
}
/*!
@@ -3955,7 +4091,8 @@ QDateTime QDateTime::toTimeSpec(Qt::TimeSpec spec) const
QDateTime QDateTime::toOffsetFromUtc(int offsetSeconds) const
{
- if (d->m_spec == Qt::OffsetFromUTC && d->m_offsetFromUtc == offsetSeconds)
+ if (getSpec(d) == Qt::OffsetFromUTC
+ && d->m_offsetFromUtc == offsetSeconds)
return *this;
if (!isValid()) {
@@ -3964,7 +4101,7 @@ QDateTime QDateTime::toOffsetFromUtc(int offsetSeconds) const
return ret;
}
- return fromMSecsSinceEpoch(d->toMSecsSinceEpoch(), Qt::OffsetFromUTC, offsetSeconds);
+ return fromMSecsSinceEpoch(toMSecsSinceEpoch(), Qt::OffsetFromUTC, offsetSeconds);
}
#ifndef QT_BOOTSTRAPPED
@@ -3978,7 +4115,7 @@ QDateTime QDateTime::toOffsetFromUtc(int offsetSeconds) const
QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const
{
- if (d->m_spec == Qt::TimeZone && d->m_timeZone == timeZone)
+ if (getSpec(d) == Qt::TimeZone && d->m_timeZone == timeZone)
return *this;
if (!isValid()) {
@@ -3987,7 +4124,7 @@ QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const
return ret;
}
- return fromMSecsSinceEpoch(d->toMSecsSinceEpoch(), timeZone);
+ return fromMSecsSinceEpoch(toMSecsSinceEpoch(), timeZone);
}
#endif // QT_BOOTSTRAPPED
@@ -4000,10 +4137,9 @@ QDateTime QDateTime::toTimeZone(const QTimeZone &timeZone) const
bool QDateTime::operator==(const QDateTime &other) const
{
- if (d->m_spec == Qt::LocalTime
- && other.d->m_spec == Qt::LocalTime
- && d->m_status == other.d->m_status) {
- return (d->m_msecs == other.d->m_msecs);
+ if (getSpec(d) == Qt::LocalTime
+ && getStatus(d) == getStatus(other.d)) {
+ return getMSecs(d) == getMSecs(other.d);
}
// Convert to UTC and compare
return (toMSecsSinceEpoch() == other.toMSecsSinceEpoch());
@@ -4028,10 +4164,9 @@ bool QDateTime::operator==(const QDateTime &other) const
bool QDateTime::operator<(const QDateTime &other) const
{
- if (d->m_spec == Qt::LocalTime
- && other.d->m_spec == Qt::LocalTime
- && d->m_status == other.d->m_status) {
- return (d->m_msecs < other.d->m_msecs);
+ if (getSpec(d) == Qt::LocalTime
+ && getStatus(d) == getStatus(other.d)) {
+ return getMSecs(d) < getMSecs(other.d);
}
// Convert to UTC and compare
return (toMSecsSinceEpoch() < other.toMSecsSinceEpoch());
@@ -4109,9 +4244,6 @@ QTime QTime::currentTime()
memset(&st, 0, sizeof(SYSTEMTIME));
GetLocalTime(&st);
ct.setHMS(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
-#if defined(Q_OS_WINCE)
- ct.startTick = GetTickCount() % MSECS_PER_DAY;
-#endif
return ct;
}
@@ -4186,39 +4318,6 @@ qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW
#error "What system is this?"
#endif
-/*! \fn QDateTime QDateTime::fromCFDate(CFDateRef date)
- \since 5.5
-
- Constructs a new QDateTime containing a copy of the CFDate \a date.
-
- \sa toCFDate()
-*/
-
-/*! \fn CFDateRef QDateTime::toCFDate() const
- \since 5.5
-
- Creates a CFDate from a QDateTime. The caller owns the CFDate object
- and is responsible for releasing it.
-
- \sa fromCFDate()
-*/
-
-/*! \fn QDateTime QDateTime::fromNSDate(const NSDate *date)
- \since 5.5
-
- Constructs a new QDateTime containing a copy of the NSDate \a date.
-
- \sa toNSDate()
-*/
-
-/*! \fn NSDate QDateTime::toNSDate() const
- \since 5.5
-
- Creates an NSDate from a QDateTime. The NSDate object is autoreleased.
-
- \sa fromNSDate()
-*/
-
/*!
\since 4.2
@@ -4310,7 +4409,7 @@ QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs)
QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetSeconds)
{
QDateTime dt;
- dt.d->setTimeSpec(spec, offsetSeconds);
+ QT_PREPEND_NAMESPACE(setTimeSpec(dt.d, spec, offsetSeconds));
dt.setMSecsSinceEpoch(msecs);
return dt;
}
@@ -4817,7 +4916,7 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
if (out.version() >= QDataStream::Qt_5_2) {
// In 5.2 we switched to using Qt::TimeSpec and added offset support
- dateAndTime = dateTime.d->getDateTime();
+ dateAndTime = getDateTime(dateTime.d);
out << dateAndTime << qint8(dateTime.timeSpec());
if (dateTime.timeSpec() == Qt::OffsetFromUTC)
out << qint32(dateTime.offsetFromUtc());
@@ -4832,13 +4931,13 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
// This approach is wrong and should not be used again; it breaks
// the guarantee that a deserialised local datetime is the same time
// of day, regardless of which timezone it was serialised in.
- dateAndTime = (dateTime.isValid() ? dateTime.toUTC() : dateTime).d->getDateTime();
+ dateAndTime = getDateTime((dateTime.isValid() ? dateTime.toUTC() : dateTime).d);
out << dateAndTime << qint8(dateTime.timeSpec());
} else if (out.version() >= QDataStream::Qt_4_0) {
// From 4.0 to 5.1 (except 5.0) we used QDateTimePrivate::Spec
- dateAndTime = dateTime.d->getDateTime();
+ dateAndTime = getDateTime(dateTime.d);
out << dateAndTime;
switch (dateTime.timeSpec()) {
case Qt::UTC:
@@ -4858,7 +4957,7 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime)
} else { // version < QDataStream::Qt_4_0
// Before 4.0 there was no TimeSpec, only Qt::LocalTime was supported
- dateAndTime = dateTime.d->getDateTime();
+ dateAndTime = getDateTime(dateTime.d);
out << dateAndTime;
}
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index ee3be5553b..0af13dd45f 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -46,11 +47,9 @@
#include <limits>
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFDate);
-# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSDate);
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -148,15 +147,9 @@ Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE);
class Q_CORE_EXPORT QTime
{
explicit Q_DECL_CONSTEXPR QTime(int ms) : mds(ms)
-#if defined(Q_OS_WINCE)
- , startTick(NullTime)
-#endif
{}
public:
Q_DECL_CONSTEXPR QTime(): mds(NullTime)
-#if defined(Q_OS_WINCE)
- , startTick(NullTime)
-#endif
{}
QTime(int h, int m, int s = 0, int ms = 0);
@@ -202,9 +195,6 @@ private:
enum TimeFlag { NullTime = -1 };
Q_DECL_CONSTEXPR inline int ds() const { return mds == -1 ? 0 : mds; }
int mds;
-#if defined(Q_OS_WINCE)
- int startTick;
-#endif
friend class QDateTime;
friend class QDateTimePrivate;
@@ -219,8 +209,45 @@ class QDateTimePrivate;
class Q_CORE_EXPORT QDateTime
{
+ // ### Qt 6: revisit the optimization
+ struct ShortData {
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ quintptr status : 8;
+#endif
+ // note: this is only 24 bits on 32-bit systems...
+ qintptr msecs : sizeof(void *) * 8 - 8;
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ quintptr status : 8;
+#endif
+ };
+
+ union Data {
+ enum {
+ // To be of any use, we need at least 60 years around 1970, which
+ // is 1,893,456,000,000 ms. That requires 41 bits to store, plus
+ // the sign bit. With the status byte, the minimum size is 50 bits.
+ CanBeSmall = sizeof(ShortData) * 8 > 50
+ };
+
+ Data(Qt::TimeSpec);
+ Data(const Data &other);
+ Data(Data &&other);
+ Data &operator=(const Data &other);
+ ~Data();
+
+ bool isShort() const;
+ void detach();
+
+ const QDateTimePrivate *operator->() const;
+ QDateTimePrivate *operator->();
+
+ QDateTimePrivate *d;
+ ShortData data;
+ };
+
public:
- QDateTime();
+ QDateTime() Q_DECL_NOEXCEPT_EXPR(Data::CanBeSmall);
explicit QDateTime(const QDate &);
QDateTime(const QDate &, const QTime &, Qt::TimeSpec spec = Qt::LocalTime);
// ### Qt 6: Merge with above with default offsetSeconds = 0
@@ -228,15 +255,16 @@ public:
#ifndef QT_BOOTSTRAPPED
QDateTime(const QDate &date, const QTime &time, const QTimeZone &timeZone);
#endif // QT_BOOTSTRAPPED
- QDateTime(const QDateTime &other);
+ QDateTime(const QDateTime &other) Q_DECL_NOTHROW;
+ QDateTime(QDateTime &&other) Q_DECL_NOTHROW;
~QDateTime();
#ifdef Q_COMPILER_RVALUE_REFS
QDateTime &operator=(QDateTime &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
- QDateTime &operator=(const QDateTime &other);
+ QDateTime &operator=(const QDateTime &other) Q_DECL_NOTHROW;
- void swap(QDateTime &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
+ void swap(QDateTime &other) Q_DECL_NOTHROW { qSwap(d.d, other.d.d); }
bool isNull() const;
bool isValid() const;
@@ -322,22 +350,17 @@ public:
#endif
static qint64 currentMSecsSinceEpoch() Q_DECL_NOTHROW;
-#if defined(Q_OS_MAC) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QDateTime fromCFDate(CFDateRef date);
CFDateRef toCFDate() const Q_DECL_CF_RETURNS_RETAINED;
-# if defined(__OBJC__) || defined(Q_QDOC)
static QDateTime fromNSDate(const NSDate *date);
NSDate *toNSDate() const Q_DECL_NS_RETURNS_AUTORELEASED;
-# endif
#endif
private:
friend class QDateTimePrivate;
- // ### Qt6: Using a private here has high impact on runtime
- // on users such as QFileInfo. In Qt 6, the data members
- // should be inlined.
- QSharedDataPointer<QDateTimePrivate> d;
+ Data d;
#ifndef QT_NO_DATASTREAM
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QDateTime &);
diff --git a/src/corelib/tools/qdatetime_mac.mm b/src/corelib/tools/qdatetime_mac.mm
deleted file mode 100644
index d61ea28636..0000000000
--- a/src/corelib/tools/qdatetime_mac.mm
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2014 Petroules Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdatetime.h"
-
-#import <Foundation/Foundation.h>
-
-QT_BEGIN_NAMESPACE
-
-QDateTime QDateTime::fromCFDate(CFDateRef date)
-{
- if (!date)
- return QDateTime();
- return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>((CFDateGetAbsoluteTime(date)
- + kCFAbsoluteTimeIntervalSince1970) * 1000));
-}
-
-CFDateRef QDateTime::toCFDate() const
-{
- return CFDateCreate(kCFAllocatorDefault, (static_cast<CFAbsoluteTime>(toMSecsSinceEpoch())
- / 1000) - kCFAbsoluteTimeIntervalSince1970);
-}
-
-QDateTime QDateTime::fromNSDate(const NSDate *date)
-{
- if (!date)
- return QDateTime();
- return QDateTime::fromMSecsSinceEpoch(static_cast<qint64>([date timeIntervalSince1970] * 1000));
-}
-
-NSDate *QDateTime::toNSDate() const
-{
- return [NSDate
- dateWithTimeIntervalSince1970:static_cast<NSTimeInterval>(toMSecsSinceEpoch()) / 1000];
-}
-
-QT_END_NAMESPACE
diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h
index 104cbccbd4..c4d00c99f9 100644
--- a/src/corelib/tools/qdatetime_p.h
+++ b/src/corelib/tools/qdatetime_p.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -60,9 +61,13 @@
QT_BEGIN_NAMESPACE
-class QDateTimePrivate : public QSharedData
+class QDateTimePrivate
{
public:
+ // forward the declarations from QDateTime (this makes them public)
+ typedef QDateTime::ShortData QDateTimeShortData;
+ typedef QDateTime::Data QDateTimeData;
+
// Never change or delete this enum, it is required for backwards compatible
// serialization of QDateTime before 5.2, so is essentially public API
enum Spec {
@@ -76,7 +81,6 @@ public:
// Daylight Time Status
enum DaylightStatus {
- NoDaylightTime = -2,
UnknownDaylightTime = -1,
StandardTime = 0,
DaylightTime = 1
@@ -84,62 +88,46 @@ public:
// Status of date/time
enum StatusFlag {
- NullDate = 0x01,
- NullTime = 0x02,
- ValidDate = 0x04, // just the date field
- ValidTime = 0x08, // just the time field
- ValidDateTime = 0x10, // the whole object (including timezone)
+ ShortData = 0x01,
+
+ ValidDate = 0x02,
+ ValidTime = 0x04,
+ ValidDateTime = 0x08,
+
+ TimeSpecMask = 0x30,
+
SetToStandardTime = 0x40,
SetToDaylightTime = 0x80
};
Q_DECLARE_FLAGS(StatusFlags, StatusFlag)
+ enum {
+ TimeSpecShift = 4,
+ ValidityMask = ValidDate | ValidTime | ValidDateTime,
+ DaylightMask = SetToStandardTime | SetToDaylightTime
+ };
+
QDateTimePrivate() : m_msecs(0),
- m_spec(Qt::LocalTime),
+ m_status(StatusFlag(Qt::LocalTime << TimeSpecShift)),
m_offsetFromUtc(0),
- m_status(NullDate | NullTime)
- {}
+ ref(0)
+ {
+ }
- QDateTimePrivate(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
- int offsetSeconds);
+ static QDateTime::Data create(const QDate &toDate, const QTime &toTime, Qt::TimeSpec toSpec,
+ int offsetSeconds);
#ifndef QT_BOOTSTRAPPED
- QDateTimePrivate(const QDate &toDate, const QTime &toTime, const QTimeZone & timeZone);
+ static QDateTime::Data create(const QDate &toDate, const QTime &toTime, const QTimeZone & timeZone);
#endif // QT_BOOTSTRAPPED
- // ### XXX: when the tooling situation improves, look at fixing the padding.
- // 4 bytes padding
-
qint64 m_msecs;
- Qt::TimeSpec m_spec;
+ StatusFlags m_status;
int m_offsetFromUtc;
+ mutable QAtomicInt ref;
#ifndef QT_BOOTSTRAPPED
QTimeZone m_timeZone;
#endif // QT_BOOTSTRAPPED
- StatusFlags m_status;
-
- void setTimeSpec(Qt::TimeSpec spec, int offsetSeconds);
- void setDateTime(const QDate &date, const QTime &time);
- QPair<QDate, QTime> getDateTime() const;
-
- void setDaylightStatus(DaylightStatus status);
- DaylightStatus daylightStatus() const;
-
- // Returns msecs since epoch, assumes offset value is current
- inline qint64 toMSecsSinceEpoch() const;
-
- void checkValidDateTime();
- void refreshDateTime();
-
- // Get/set date and time status
- inline bool isNullDate() const { return m_status & NullDate; }
- inline bool isNullTime() const { return m_status & NullTime; }
- inline bool isValidDate() const { return m_status & ValidDate; }
- inline bool isValidTime() const { return m_status & ValidTime; }
- inline bool isValidDateTime() const { return m_status & ValidDateTime; }
- inline void setValidDateTime() { m_status |= ValidDateTime; }
- inline void clearValidDateTime() { m_status &= ~ValidDateTime; }
- inline void clearSetToDaylightStatus() { m_status &= ~(SetToStandardTime | SetToDaylightTime); }
#ifndef QT_BOOTSTRAPPED
static qint64 zoneMSecsToEpochMSecs(qint64 msecs, const QTimeZone &zone,
diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp
index 734aaf80f2..520126d262 100644
--- a/src/corelib/tools/qelapsedtimer_win.cpp
+++ b/src/corelib/tools/qelapsedtimer_win.cpp
@@ -40,35 +40,21 @@
#include "qelapsedtimer.h"
#include <qt_windows.h>
-typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void);
-#if defined(Q_OS_WINRT)
- static const PtrGetTickCount64 ptrGetTickCount64 = &GetTickCount64;
-#else
- static PtrGetTickCount64 ptrGetTickCount64 = 0;
-#endif
-
QT_BEGIN_NAMESPACE
// Result of QueryPerformanceFrequency, 0 indicates that the high resolution timer is unavailable
static quint64 counterFrequency = 0;
-static void resolveLibs()
+static void resolveCounterFrequency()
{
static bool done = false;
if (done)
return;
-#if !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
- // try to get GetTickCount64 from the system
- HMODULE kernel32 = GetModuleHandleW(L"kernel32");
- if (!kernel32)
- return;
- ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64");
-#endif // !Q_OS_WINRT && !Q_OS_WINCE
-
// Retrieve the number of high-resolution performance counter ticks per second
LARGE_INTEGER frequency;
if (!QueryPerformanceFrequency(&frequency)) {
+ qFatal("QueryPerformanceFrequency failed, even though Microsoft documentation promises it wouldn't.");
counterFrequency = 0;
} else {
counterFrequency = frequency.QuadPart;
@@ -92,35 +78,20 @@ static inline qint64 ticksToNanoseconds(qint64 ticks)
static quint64 getTickCount()
{
- resolveLibs();
+ resolveCounterFrequency();
// This avoids a division by zero and disables the high performance counter if it's not available
if (counterFrequency > 0) {
LARGE_INTEGER counter;
- if (QueryPerformanceCounter(&counter)) {
- return counter.QuadPart;
- } else {
- qWarning("QueryPerformanceCounter failed, although QueryPerformanceFrequency succeeded.");
- return 0;
- }
+ bool ok = QueryPerformanceCounter(&counter);
+ Q_ASSERT_X(ok, "QElapsedTimer::start()",
+ "QueryPerformanceCounter failed, although QueryPerformanceFrequency succeeded.");
+ Q_UNUSED(ok);
+ return counter.QuadPart;
}
-#ifndef Q_OS_WINRT
- if (ptrGetTickCount64)
- return ptrGetTickCount64();
-
- static quint32 highdword = 0;
- static quint32 lastval = 0;
- quint32 val = GetTickCount();
- if (val < lastval)
- ++highdword;
- lastval = val;
- return val | (quint64(highdword) << 32);
-#else // !Q_OS_WINRT
- // ptrGetTickCount64 is always set on WinRT but GetTickCount is not available
- return ptrGetTickCount64();
-#endif // Q_OS_WINRT
+ return GetTickCount64();
}
quint64 qt_msectime()
@@ -130,7 +101,7 @@ quint64 qt_msectime()
QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
{
- resolveLibs();
+ resolveCounterFrequency();
if (counterFrequency > 0)
return PerformanceCounter;
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index b004f74be9..8942292a3d 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -214,6 +214,14 @@ QT_BEGIN_NAMESPACE
Returns this line translated the distance specified by \a dx and \a dy.
*/
+/*!
+ \fn QPoint QLine::center() const
+
+ \since 5.8
+
+ Returns the center point of this line. This is equivalent to
+ (p1() + p2()) / 2, except it will never overflow.
+*/
/*!
\fn void QLine::setP1(const QPoint &p1)
@@ -351,6 +359,12 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
translate() function, and can be traversed using the pointAt()
function.
+ \section1 Constraints
+
+ QLine is limited to the minimum and maximum values for the
+ \c int type. Operations on a QLine that could potentially result
+ in values outside this range will result in undefined behavior.
+
\sa QLine, QPolygonF, QRectF
*/
@@ -711,6 +725,15 @@ QLineF::IntersectType QLineF::intersect(const QLineF &l, QPointF *intersectionPo
*/
/*!
+ \fn QPointF QLineF::center() const
+
+ \since 5.8
+
+ Returns the center point of this line. This is equivalent to
+ 0.5 * p1() + 0.5 * p2().
+*/
+
+/*!
\fn void QLineF::setP1(const QPointF &p1)
\since 4.4
diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h
index 819dd3fd3b..5b5ca3b4c8 100644
--- a/src/corelib/tools/qline.h
+++ b/src/corelib/tools/qline.h
@@ -76,6 +76,8 @@ public:
Q_DECL_CONSTEXPR inline QLine translated(const QPoint &p) const Q_REQUIRED_RESULT;
Q_DECL_CONSTEXPR inline QLine translated(int dx, int dy) const Q_REQUIRED_RESULT;
+ Q_DECL_CONSTEXPR inline QPoint center() const Q_REQUIRED_RESULT;
+
inline void setP1(const QPoint &p1);
inline void setP2(const QPoint &p2);
inline void setPoints(const QPoint &p1, const QPoint &p2);
@@ -165,6 +167,11 @@ Q_DECL_CONSTEXPR inline QLine QLine::translated(int adx, int ady) const
return translated(QPoint(adx, ady));
}
+Q_DECL_CONSTEXPR inline QPoint QLine::center() const
+{
+ return QPoint(int((qint64(pt1.x()) + pt2.x()) / 2), int((qint64(pt1.y()) + pt2.y()) / 2));
+}
+
inline void QLine::setP1(const QPoint &aP1)
{
pt1 = aP1;
@@ -253,6 +260,8 @@ public:
Q_DECL_CONSTEXPR inline QLineF translated(const QPointF &p) const Q_REQUIRED_RESULT;
Q_DECL_CONSTEXPR inline QLineF translated(qreal dx, qreal dy) const Q_REQUIRED_RESULT;
+ Q_DECL_CONSTEXPR inline QPointF center() const Q_REQUIRED_RESULT;
+
inline void setP1(const QPointF &p1);
inline void setP2(const QPointF &p2);
inline void setPoints(const QPointF &p1, const QPointF &p2);
@@ -357,6 +366,11 @@ Q_DECL_CONSTEXPR inline QLineF QLineF::translated(qreal adx, qreal ady) const
return translated(QPointF(adx, ady));
}
+Q_DECL_CONSTEXPR inline QPointF QLineF::center() const
+{
+ return QPointF(0.5 * pt1.x() + 0.5 * pt2.x(), 0.5 * pt1.y() + 0.5 * pt2.y());
+}
+
inline void QLineF::setLength(qreal len)
{
if (isNull())
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 90ed5072e7..c7f27abdd6 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -118,7 +118,10 @@ struct Q_CORE_EXPORT QListData {
};
template <typename T>
-class QList : public QListSpecialMethods<T>
+class QList
+#ifndef Q_QDOC
+ : public QListSpecialMethods<T>
+#endif
{
public:
struct MemoryLayout
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index ea5d74d9bb..7809c513d6 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -61,7 +61,6 @@
#include "qvariant.h"
#include "qstringbuilder.h"
#include "private/qnumeric_p.h"
-#include "private/qsystemlibrary_p.h"
#ifdef Q_OS_WIN
# include <qt_windows.h>
# include <time.h>
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index 4b1d190705..4f6efc8832 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -390,9 +390,6 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &
static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str)
{
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_6)
- return QVariant();
-
QString begin, end;
QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
switch (type) {
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 88bfada515..f8b9f86ac6 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -44,9 +44,6 @@
#include "qstringlist.h"
#include "qvariant.h"
#include "qdatetime.h"
-
-#include "private/qsystemlibrary_p.h"
-
#include "qdebug.h"
#ifdef Q_OS_WIN
@@ -67,7 +64,6 @@ QT_BEGIN_NAMESPACE
#ifndef Q_OS_WINRT
static QByteArray getWinLocaleName(LCID id = LOCALE_USER_DEFAULT);
-static const char *winLangCodeToIsoName(int code);
static QString winIso639LangName(LCID id = LOCALE_USER_DEFAULT);
static QString winIso3116CtryName(LCID id = LOCALE_USER_DEFAULT);
#else // !Q_OS_WINRT
@@ -600,50 +596,32 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS
QVariant QSystemLocalePrivate::uiLanguages()
{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
- typedef BOOL (WINAPI *GetUserPreferredUILanguagesFunc) (
- DWORD dwFlags,
- PULONG pulNumLanguages,
- PWSTR pwszLanguagesBuffer,
- PULONG pcchLanguagesBuffer);
- static GetUserPreferredUILanguagesFunc GetUserPreferredUILanguages_ptr = 0;
#ifndef Q_OS_WINRT
- if (!GetUserPreferredUILanguages_ptr) {
- QSystemLibrary lib(QLatin1String("kernel32"));
- if (lib.load())
- GetUserPreferredUILanguages_ptr = (GetUserPreferredUILanguagesFunc)lib.resolve("GetUserPreferredUILanguages");
- }
-#endif // !Q_OS_WINRT
- if (GetUserPreferredUILanguages_ptr) {
- unsigned long cnt = 0;
- QVarLengthArray<wchar_t, 64> buf(64);
- unsigned long size = buf.size();
- if (!GetUserPreferredUILanguages_ptr(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size)) {
- size = 0;
- if (GetLastError() == ERROR_INSUFFICIENT_BUFFER &&
- GetUserPreferredUILanguages_ptr(MUI_LANGUAGE_NAME, &cnt, NULL, &size)) {
- buf.resize(size);
- if (!GetUserPreferredUILanguages_ptr(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size))
- return QStringList();
- }
- }
- QStringList result;
- result.reserve(cnt);
- const wchar_t *str = buf.constData();
- for (; cnt > 0; --cnt) {
- QString s = QString::fromWCharArray(str);
- if (s.isEmpty())
- break; // something is wrong
- result.append(s);
- str += s.size()+1;
- }
- return result;
+ unsigned long cnt = 0;
+ QVarLengthArray<wchar_t, 64> buf(64);
+# if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE) // Not present in MinGW 4.9/bootstrap builds.
+ unsigned long size = buf.size();
+ if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size)) {
+ size = 0;
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER &&
+ GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &cnt, NULL, &size)) {
+ buf.resize(size);
+ if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &cnt, buf.data(), &size))
+ return QStringList();
}
}
-
-#ifndef Q_OS_WINRT
- // old Windows before Vista
- return QStringList(QString::fromLatin1(winLangCodeToIsoName(GetUserDefaultUILanguage())));
+# endif // !QT_BOOTSTRAPPED && !QT_BUILD_QMAKE
+ QStringList result;
+ result.reserve(cnt);
+ const wchar_t *str = buf.constData();
+ for (; cnt > 0; --cnt) {
+ QString s = QString::fromWCharArray(str);
+ if (s.isEmpty())
+ break; // something is wrong
+ result.append(s);
+ str += s.size() + 1;
+ }
+ return result;
#else // !Q_OS_WINRT
QStringList result;
ComPtr<ABI::Windows::Globalization::IApplicationLanguagesStatics> appLanguagesStatics;
@@ -1161,19 +1139,16 @@ static QByteArray getWinLocaleName(LPWSTR id)
}
}
-#if defined(Q_OS_WINCE)
- result = winLangCodeToIsoName(id != LOCALE_USER_DEFAULT ? id : GetUserDefaultLCID());
-#else // !Q_OS_WINCE
-# ifndef Q_OS_WINRT
+#ifndef Q_OS_WINRT
if (id == LOCALE_USER_DEFAULT)
id = GetUserDefaultLCID();
-# else // !Q_OS_WINRT
+#else // !Q_OS_WINRT
WCHAR lcName[LOCALE_NAME_MAX_LENGTH];
if (QString::fromWCharArray(id) == QString::fromWCharArray(LOCALE_NAME_USER_DEFAULT)) {
GetUserDefaultLocaleName(lcName, LOCALE_NAME_MAX_LENGTH);
id = lcName;
}
-# endif // Q_OS_WINRT
+#endif // Q_OS_WINRT
QString resultuage = winIso639LangName(id);
QString country = winIso3116CtryName(id);
result = resultuage.toLatin1();
@@ -1181,7 +1156,6 @@ static QByteArray getWinLocaleName(LPWSTR id)
result += '_';
result += country.toLatin1();
}
-#endif // !Q_OS_WINCE
return result;
}
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h
index 4e2e6b91a6..e2d7f4372a 100644
--- a/src/corelib/tools/qpoint.h
+++ b/src/corelib/tools/qpoint.h
@@ -42,6 +42,10 @@
#include <QtCore/qnamespace.h>
+#if defined(Q_OS_DARWIN)
+struct CGPoint;
+#endif
+
QT_BEGIN_NAMESPACE
@@ -89,6 +93,10 @@ public:
friend Q_DECL_CONSTEXPR inline const QPoint operator-(const QPoint &);
friend Q_DECL_CONSTEXPR inline const QPoint operator/(const QPoint &, qreal);
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ CGPoint toCGPoint() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#endif
+
private:
friend class QTransform;
int xp;
@@ -247,6 +255,11 @@ public:
Q_DECL_CONSTEXPR QPoint toPoint() const;
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ static QPointF fromCGPoint(CGPoint point) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ CGPoint toCGPoint() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#endif
+
private:
friend class QMatrix;
friend class QTransform;
diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h
index b376b6b999..8ce668f8ec 100644
--- a/src/corelib/tools/qrect.h
+++ b/src/corelib/tools/qrect.h
@@ -48,6 +48,10 @@
#error qrect.h must be included before any header file that defines topLeft
#endif
+#if defined(Q_OS_DARWIN)
+struct CGRect;
+#endif
+
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QRect
@@ -149,6 +153,10 @@ public:
friend Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) Q_DECL_NOTHROW;
friend Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) Q_DECL_NOTHROW;
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ CGRect toCGRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#endif
+
private:
int x1;
int y1;
@@ -604,6 +612,11 @@ public:
Q_DECL_CONSTEXPR inline QRect toRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
QRect toAlignedRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ static QRectF fromCGRect(CGRect rect) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ CGRect toCGRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#endif
+
private:
qreal xp;
qreal yp;
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 1a37e0bc9c..67d11660e1 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -193,6 +193,48 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn bool operator==(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t)
+ \relates QScopedPointer
+ \since 5.8
+
+ Returns \c true if the scoped pointer \a lhs is a null pointer.
+
+ \sa QScopedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator==(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs)
+ \relates QScopedPointer
+ \since 5.8
+
+ Returns \c true if the scoped pointer \a rhs is a null pointer.
+
+ \sa QScopedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator!=(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t)
+ \relates QScopedPointer
+ \since 5.8
+
+ Returns \c true if the scoped pointer \a lhs is a valid (i.e. a non-null)
+ pointer.
+
+ \sa QScopedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator!=(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs)
+ \relates QScopedPointer
+ \since 5.8
+
+ Returns \c true if the scoped pointer \a rhs is a valid (i.e. a non-null)
+ pointer.
+
+ \sa QScopedPointer::isNull()
+*/
+
+/*!
\fn bool QScopedPointer::isNull() const
Returns \c true if this object is holding a pointer that is \c null.
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index 3e6af97a33..92d7df6e5d 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -97,7 +97,7 @@ class QScopedPointer
{
typedef T *QScopedPointer:: *RestrictedBool;
public:
- explicit inline QScopedPointer(T *p = Q_NULLPTR) : d(p)
+ explicit QScopedPointer(T *p = Q_NULLPTR) Q_DECL_NOTHROW : d(p)
{
}
@@ -113,13 +113,12 @@ public:
return *d;
}
- inline T *operator->() const
+ T *operator->() const Q_DECL_NOTHROW
{
- Q_ASSERT(d);
return d;
}
- inline bool operator!() const
+ bool operator!() const Q_DECL_NOTHROW
{
return !d;
}
@@ -130,23 +129,23 @@ public:
return isNull() ? Q_NULLPTR : &QScopedPointer::d;
}
#else
- inline operator RestrictedBool() const
+ operator RestrictedBool() const Q_DECL_NOTHROW
{
return isNull() ? Q_NULLPTR : &QScopedPointer::d;
}
#endif
- inline T *data() const
+ T *data() const Q_DECL_NOTHROW
{
return d;
}
- inline bool isNull() const
+ bool isNull() const Q_DECL_NOTHROW
{
return !d;
}
- inline void reset(T *other = Q_NULLPTR)
+ void reset(T *other = Q_NULLPTR) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval<T *>())))
{
if (d == other)
return;
@@ -155,7 +154,7 @@ public:
Cleanup::cleanup(oldD);
}
- inline T *take()
+ T *take() Q_DECL_NOTHROW
{
T *oldD = d;
d = Q_NULLPTR;
@@ -177,18 +176,42 @@ private:
};
template <class T, class Cleanup>
-inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
+inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW
{
return lhs.data() == rhs.data();
}
template <class T, class Cleanup>
-inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
+inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW
{
return lhs.data() != rhs.data();
}
template <class T, class Cleanup>
+inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t) Q_DECL_NOTHROW
+{
+ return lhs.isNull();
+}
+
+template <class T, class Cleanup>
+inline bool operator==(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW
+{
+ return rhs.isNull();
+}
+
+template <class T, class Cleanup>
+inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t) Q_DECL_NOTHROW
+{
+ return !lhs.isNull();
+}
+
+template <class T, class Cleanup>
+inline bool operator!=(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW
+{
+ return !rhs.isNull();
+}
+
+template <class T, class Cleanup>
inline void swap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) Q_DECL_NOTHROW
{ p1.swap(p2); }
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 84afb0c5db..af09ef6f40 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -442,15 +442,20 @@
*/
/*!
- \fn QSharedPointer::QSharedPointer(T *ptr)
+ \fn QSharedPointer::QSharedPointer(X *ptr)
Creates a QSharedPointer that points to \a ptr. The pointer \a ptr
becomes managed by this QSharedPointer and must not be passed to
another QSharedPointer object or deleted outside this object.
+
+ Since Qt 5.8, when the last reference to this QSharedPointer gets
+ destroyed, \a ptr will be deleted by calling \c X's destructor (even if \c
+ X is not the same as QSharedPointer's template parameter \c T). Previously,
+ the destructor for \c T was called.
*/
/*!
- \fn QSharedPointer::QSharedPointer(T *ptr, Deleter deleter)
+ \fn QSharedPointer::QSharedPointer(X *ptr, Deleter deleter)
Creates a QSharedPointer that points to \a ptr. The pointer \a ptr
becomes managed by this QSharedPointer and must not be passed to
@@ -477,6 +482,9 @@
}
\endcode
+ Note that the custom deleter function will be called with a pointer to type
+ \c X, even if the QSharedPointer template parameter \c T is not the same.
+
It is also possible to specify a member function directly, as in:
\code
QSharedPointer<MyObject> obj =
@@ -487,6 +495,22 @@
*/
/*!
+ \fn QSharedPointer::QSharedPointer(std::nullptr_t)
+ \since 5.8
+
+ Creates a QSharedPointer that is null. This is equivalent to the
+ QSharedPointer default constructor.
+*/
+
+/*!
+ \fn QSharedPointer::QSharedPointer(std::nullptr_t, Deleter)
+ \since 5.8
+
+ Creates a QSharedPointer that is null. This is equivalent to the
+ QSharedPointer default constructor.
+*/
+
+/*!
\fn QSharedPointer::QSharedPointer(const QSharedPointer<T> &other)
Creates a QSharedPointer object that shares \a other's pointer.
@@ -1124,6 +1148,90 @@
*/
/*!
+ \fn bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t)
+ \relates QSharedPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a lhs is a null pointer.
+
+ \sa QSharedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs)
+ \relates QSharedPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a rhs is a null pointer.
+
+ \sa QSharedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t)
+ \relates QSharedPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a lhs is a valid (i.e.
+ non-null) pointer.
+
+ \sa QSharedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs)
+ \relates QSharedPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a rhs is a valid (i.e.
+ non-null) pointer.
+
+ \sa QSharedPointer::isNull()
+*/
+
+/*!
+ \fn bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t)
+ \relates QWeakPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a lhs is a null pointer.
+
+ \sa QWeakPointer::isNull()
+*/
+
+/*!
+ \fn bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs)
+ \relates QWeakPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a rhs is a null pointer.
+
+ \sa QWeakPointer::isNull()
+*/
+
+/*!
+ \fn bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t)
+ \relates QWeakPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a lhs is a valid (i.e.
+ non-null) pointer.
+
+ \sa QWeakPointer::isNull()
+*/
+
+/*!
+ \fn bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs)
+ \relates QWeakPointer
+ \since 5.8
+
+ Returns \c true if the pointer referenced by \a rhs is a valid (i.e.
+ non-null) pointer.
+
+ \sa QWeakPointer::isNull()
+*/
+
+/*!
\fn bool operator!=(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
\relates QWeakPointer
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index 72976637d5..3b86eb238b 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -67,8 +67,10 @@ public:
// constructors
QSharedPointer();
- explicit QSharedPointer(T *ptr);
- QSharedPointer(T *ptr, Deleter d);
+ template <typename X> explicit QSharedPointer(X *ptr);
+ template <typename X, typename Deleter> QSharedPointer(X *ptr, Deleter d);
+ QSharedPointer(std::nullptr_t);
+ template <typename Deleter> QSharedPointer(std::nullptr_t, Deleter d);
QSharedPointer(const QSharedPointer<T> &other);
QSharedPointer(const QWeakPointer<T> &other);
@@ -147,6 +149,14 @@ template<class T, class X> bool operator==(const QWeakPointer<T> &ptr1, const QS
template<class T, class X> bool operator!=(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2);
template<class T, class X> bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2);
template<class T, class X> bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2);
+template<class T> bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t);
+template<class T> bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t);
+template<class T> bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs);
+template<class T> bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs);
+template<class T> bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t);
+template<class T> bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t);
+template<class T> bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs);
+template<class T> bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs);
template <class X, class T> QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &other);
template <class X, class T> QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &other);
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index e9a5443121..0f769ffa86 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -305,23 +305,29 @@ public:
typedef const value_type &const_reference;
typedef qptrdiff difference_type;
- inline T *data() const { return value; }
- inline bool isNull() const { return !data(); }
- inline operator RestrictedBool() const { return isNull() ? Q_NULLPTR : &QSharedPointer::value; }
- inline bool operator !() const { return isNull(); }
- inline T &operator*() const { return *data(); }
- inline T *operator->() const { return data(); }
-
- QSharedPointer() Q_DECL_NOTHROW : value(Q_NULLPTR), d(Q_NULLPTR) {}
+ T *data() const Q_DECL_NOTHROW { return value; }
+ bool isNull() const Q_DECL_NOTHROW { return !data(); }
+ operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QSharedPointer::value; }
+ bool operator !() const Q_DECL_NOTHROW { return isNull(); }
+ T &operator*() const { return *data(); }
+ T *operator->() const Q_DECL_NOTHROW { return data(); }
+
+ Q_DECL_CONSTEXPR QSharedPointer() Q_DECL_NOTHROW : value(nullptr), d(nullptr) { }
~QSharedPointer() { deref(); }
- inline explicit QSharedPointer(T *ptr) : value(ptr) // noexcept
+ Q_DECL_CONSTEXPR QSharedPointer(std::nullptr_t) Q_DECL_NOTHROW : value(nullptr), d(nullptr) { }
+
+ template <class X>
+ inline explicit QSharedPointer(X *ptr) : value(ptr) // noexcept
{ internalConstruct(ptr, QtSharedPointer::NormalDeleter()); }
- template <typename Deleter>
- inline QSharedPointer(T *ptr, Deleter deleter) : value(ptr) // throws
+ template <class X, typename Deleter>
+ inline QSharedPointer(X *ptr, Deleter deleter) : value(ptr) // throws
{ internalConstruct(ptr, deleter); }
+ template <typename Deleter>
+ QSharedPointer(std::nullptr_t, Deleter) : value(nullptr), d(nullptr) { }
+
QSharedPointer(const QSharedPointer &other) Q_DECL_NOTHROW : value(other.value), d(other.d)
{ if (d) ref(); }
QSharedPointer &operator=(const QSharedPointer &other) Q_DECL_NOTHROW
@@ -363,7 +369,7 @@ public:
#endif
template <class X>
- inline QSharedPointer(const QSharedPointer<X> &other) : value(other.value), d(other.d)
+ QSharedPointer(const QSharedPointer<X> &other) Q_DECL_NOTHROW : value(other.value), d(other.d)
{ if (d) ref(); }
template <class X>
@@ -511,15 +517,15 @@ private:
inline void enableSharedFromThis(...) {}
- template <typename Deleter>
- inline void internalConstruct(T *ptr, Deleter deleter)
+ template <typename X, typename Deleter>
+ inline void internalConstruct(X *ptr, Deleter deleter)
{
if (!ptr) {
d = Q_NULLPTR;
return;
}
- typedef QtSharedPointer::ExternalRefCountWithCustomDeleter<T, Deleter> Private;
+ typedef QtSharedPointer::ExternalRefCountWithCustomDeleter<X, Deleter> Private;
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
typename Private::DestroyerFn actualDeleter = &Private::safetyCheckDeleter;
# else
@@ -598,10 +604,10 @@ public:
typedef const value_type &const_reference;
typedef qptrdiff difference_type;
- inline bool isNull() const { return d == Q_NULLPTR || d->strongref.load() == 0 || value == Q_NULLPTR; }
- inline operator RestrictedBool() const { return isNull() ? Q_NULLPTR : &QWeakPointer::value; }
- inline bool operator !() const { return isNull(); }
- inline T *data() const { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; }
+ bool isNull() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 || value == Q_NULLPTR; }
+ operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QWeakPointer::value; }
+ bool operator !() const Q_DECL_NOTHROW { return isNull(); }
+ T *data() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; }
inline QWeakPointer() Q_DECL_NOTHROW : d(Q_NULLPTR), value(Q_NULLPTR) { }
inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; }
@@ -668,11 +674,11 @@ public:
}
template <class X>
- inline bool operator==(const QWeakPointer<X> &o) const
+ bool operator==(const QWeakPointer<X> &o) const Q_DECL_NOTHROW
{ return d == o.d && value == static_cast<const T *>(o.value); }
template <class X>
- inline bool operator!=(const QWeakPointer<X> &o) const
+ bool operator!=(const QWeakPointer<X> &o) const Q_DECL_NOTHROW
{ return !(*this == o); }
template <class X>
@@ -688,11 +694,11 @@ public:
}
template <class X>
- inline bool operator==(const QSharedPointer<X> &o) const
+ bool operator==(const QSharedPointer<X> &o) const Q_DECL_NOTHROW
{ return d == o.d; }
template <class X>
- inline bool operator!=(const QSharedPointer<X> &o) const
+ bool operator!=(const QSharedPointer<X> &o) const Q_DECL_NOTHROW
{ return !(*this == o); }
inline void clear() { *this = QWeakPointer(); }
@@ -774,48 +780,96 @@ public:
// operator== and operator!=
//
template <class T, class X>
-bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
+bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW
{
return ptr1.data() == ptr2.data();
}
template <class T, class X>
-bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
+bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW
{
return ptr1.data() != ptr2.data();
}
template <class T, class X>
-bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2)
+bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2) Q_DECL_NOTHROW
{
return ptr1.data() == ptr2;
}
template <class T, class X>
-bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2)
+bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW
{
return ptr1 == ptr2.data();
}
template <class T, class X>
-bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2)
+bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2) Q_DECL_NOTHROW
{
return !(ptr1 == ptr2);
}
template <class T, class X>
-bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2)
+bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW
{
return !(ptr2 == ptr1);
}
template <class T, class X>
-bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2)
+bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) Q_DECL_NOTHROW
{
return ptr2 == ptr1;
}
template <class T, class X>
-bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2)
+bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) Q_DECL_NOTHROW
{
return ptr2 != ptr1;
}
+template<class T>
+inline bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW
+{
+ return lhs.isNull();
+}
+
+template<class T>
+inline bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW
+{
+ return !lhs.isNull();
+}
+
+template<class T>
+inline bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs) Q_DECL_NOTHROW
+{
+ return rhs.isNull();
+}
+
+template<class T>
+inline bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs) Q_DECL_NOTHROW
+{
+ return !rhs.isNull();
+}
+
+template<class T>
+inline bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW
+{
+ return lhs.isNull();
+}
+
+template<class T>
+inline bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW
+{
+ return !lhs.isNull();
+}
+
+template<class T>
+inline bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs) Q_DECL_NOTHROW
+{
+ return rhs.isNull();
+}
+
+template<class T>
+inline bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs) Q_DECL_NOTHROW
+{
+ return !rhs.isNull();
+}
+
//
// operator-
//
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index c869c4e089..d4edf459de 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -48,16 +48,8 @@
#endif
#if defined(Q_OS_WIN)
-# if defined(Q_OS_WINCE)
-# include <qt_windows.h>
-# if _WIN32_WCE < 0x800
-# include <cmnintrin.h>
-# endif
-# endif
# if !defined(Q_CC_GNU)
-# ifndef Q_OS_WINCE
-# include <intrin.h>
-# endif
+# include <intrin.h>
# endif
#elif defined(Q_OS_LINUX) && (defined(Q_PROCESSOR_ARM) || defined(Q_PROCESSOR_MIPS_32))
#include "private/qcore_unix_p.h"
@@ -93,25 +85,6 @@ static inline uint detectProcessorFeatures()
{
return 0;
}
-#elif defined (Q_OS_WINCE)
-static inline quint64 detectProcessorFeatures()
-{
- quint64 features = 0;
-
-#if defined (ARM)
-# ifdef PF_ARM_NEON
- if (IsProcessorFeaturePresent(PF_ARM_NEON))
- features |= Q_UINT64_C(1) << CpuFeatureNEON;
-# endif
-#elif defined(_X86_)
- if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE))
- features |= Q_UINT64_C(1) << CpuFeatureSSE2;
- if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
- features |= Q_UINT64_C(1) << CpuFeatureSSE3;
-#endif
- return features;
-}
-
#elif defined(Q_PROCESSOR_ARM)
static inline quint64 detectProcessorFeatures()
{
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 7002d34654..259da3cfec 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -139,7 +139,7 @@
* }
*/
-#if defined(__MINGW64_VERSION_MAJOR) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE))
+#if defined(__MINGW64_VERSION_MAJOR) || defined(Q_CC_MSVC)
#include <intrin.h>
#endif
@@ -465,65 +465,6 @@ static inline quint64 qCpuFeatures()
#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (Q_UINT64_C(1) << CpuFeature ## feature)) \
|| (qCpuFeatures() & (Q_UINT64_C(1) << CpuFeature ## feature)))
-#if QT_HAS_BUILTIN(__builtin_clz) && QT_HAS_BUILTIN(__builtin_ctz) && defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
-static Q_ALWAYS_INLINE unsigned _bit_scan_reverse(unsigned val)
-{
- Q_ASSERT(val != 0); // if val==0, the result is undefined.
- unsigned result = static_cast<unsigned>(__builtin_clz(val)); // Count Leading Zeros
- // Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
- // and the lsb inde is 0. The result for _bit_scan_reverse is expected to be the index when
- // counting up: msb index is 0 (because it starts there), and the lsb index is 31.
- result ^= sizeof(unsigned) * 8 - 1;
- return result;
-}
-static Q_ALWAYS_INLINE unsigned _bit_scan_forward(unsigned val)
-{
- Q_ASSERT(val != 0); // if val==0, the result is undefined.
- return static_cast<unsigned>(__builtin_ctz(val)); // Count Trailing Zeros
-}
-#elif defined(Q_PROCESSOR_X86)
-// Bit scan functions for x86
-# if defined(Q_CC_MSVC)
-# if defined _WIN32_WCE && _WIN32_WCE < 0x800
-extern "C" unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
-extern "C" unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask);
-# pragma intrinsic(_BitScanForward)
-# pragma intrinsic(_BitScanReverse)
-# endif
-// MSVC calls it _BitScanReverse and returns the carry flag, which we don't need
-static __forceinline unsigned long _bit_scan_reverse(uint val)
-{
- unsigned long result;
- _BitScanReverse(&result, val);
- return result;
-}
-static __forceinline unsigned long _bit_scan_forward(uint val)
-{
- unsigned long result;
- _BitScanForward(&result, val);
- return result;
-}
-# elif (defined(Q_CC_CLANG) || (defined(Q_CC_GNU) && Q_CC_GNU < 405)) \
- && !defined(Q_CC_INTEL)
-// Clang is missing the intrinsic for _bit_scan_reverse
-// GCC only added it in version 4.5
-static inline __attribute__((always_inline))
-unsigned _bit_scan_reverse(unsigned val)
-{
- unsigned result;
- asm("bsr %1, %0" : "=r" (result) : "r" (val));
- return result;
-}
-static inline __attribute__((always_inline))
-unsigned _bit_scan_forward(unsigned val)
-{
- unsigned result;
- asm("bsf %1, %0" : "=r" (result) : "r" (val));
- return result;
-}
-# endif
-#endif // Q_PROCESSOR_X86
-
#define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \
for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i)
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index 5d40c4079a..74698224f2 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -42,6 +42,10 @@
#include <QtCore/qnamespace.h>
+#if defined(Q_OS_DARWIN)
+struct CGSize;
+#endif
+
QT_BEGIN_NAMESPACE
@@ -86,6 +90,10 @@ public:
friend inline Q_DECL_CONSTEXPR const QSize operator*(qreal, const QSize &) Q_DECL_NOTHROW;
friend inline const QSize operator/(const QSize &, qreal);
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#endif
+
private:
int wd;
int ht;
@@ -248,6 +256,11 @@ public:
Q_DECL_CONSTEXPR inline QSize toSize() const Q_DECL_NOTHROW;
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+ static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+ CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT;
+#endif
+
private:
qreal wd;
qreal ht;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 85da174366..c79bced52e 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -81,9 +81,6 @@
#ifdef Q_OS_WIN
# include <qt_windows.h>
-# ifdef Q_OS_WINCE
-# include <winnls.h>
-# endif
#endif
#ifdef truncate
@@ -471,7 +468,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, int l)
uint mask = ~_mm_movemask_epi8(result);
if (ushort(mask)) {
// found a different byte
- uint idx = uint(_bit_scan_forward(mask));
+ uint idx = qCountTrailingZeroBits(mask);
return reinterpret_cast<const QChar *>(ptr + idx)->unicode()
- reinterpret_cast<const QChar *>(ptr + distance + idx)->unicode();
}
@@ -574,7 +571,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
# endif
if (mask) {
// found a different character
- uint idx = uint(_bit_scan_forward(mask));
+ uint idx = qCountTrailingZeroBits(mask);
return uc[offset + idx / 2] - c[offset + idx / 2];
}
}
@@ -592,7 +589,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
uint mask = ~_mm_movemask_epi8(result);
if (ushort(mask)) {
// found a different character
- uint idx = uint(_bit_scan_forward(mask));
+ uint idx = qCountTrailingZeroBits(mask);
return uc[offset + idx / 2] - c[offset + idx / 2];
}
@@ -686,7 +683,7 @@ static int findChar(const QChar *str, int len, QChar ch, int from,
// found a match
// same as: return n - s + _bit_scan_forward(mask) / 2
return (reinterpret_cast<const char *>(n) - reinterpret_cast<const char *>(s)
- + _bit_scan_forward(mask)) >> 1;
+ + qCountTrailingZeroBits(mask)) >> 1;
}
}
@@ -1151,7 +1148,7 @@ const QString::Null QString::null = { };
has a ref count of 1, whereas QString::append() needs an extra
test).
- There are three ways you can access this improved method of string
+ There are two ways you can access this improved method of string
construction. The straightforward way is to include
\c{QStringBuilder} wherever you want to use it, and use the
\c{'%'} operator instead of \c{'+'} when concatenating strings:
@@ -3273,7 +3270,7 @@ int QString::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) co
{
const int sl = str.size();
if (sl == 1)
- return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
+ return lastIndexOf(str.at(0), from, cs);
const int l = d->size;
if (from < 0)
@@ -5522,7 +5519,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_WINCE) && !defined (Q_OS_MAC)
+#if defined(QT_USE_ICU) && !defined(Q_OS_WIN32) && !defined(Q_OS_DARWIN)
Q_GLOBAL_STATIC(QThreadStorage<QCollator>, defaultCollator)
#endif
@@ -5537,12 +5534,12 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
if (length1 == 0 || length2 == 0)
return ucstrcmp(data1, length1, data2, length2);
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-#ifndef Q_OS_WINRT
+#if defined(Q_OS_WIN)
+# ifndef Q_OS_WINRT
int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2);
-#else
+# else
int res = CompareStringEx(LOCALE_NAME_USER_DEFAULT, 0, (LPCWSTR)data1, length1, (LPCWSTR)data2, length2, NULL, NULL, 0);
-#endif
+# endif
switch (res) {
case CSTR_LESS_THAN:
@@ -7949,40 +7946,6 @@ QString QString::multiArg(int numArgs, const QString **args) const
return result;
}
-
-/*! \fn QString QString::fromCFString(CFStringRef string)
- \since 5.2
-
- Constructs a new QString containing a copy of the \a string CFString.
-
- \note this function is only available on OS X and iOS.
-*/
-
-/*! \fn CFStringRef QString::toCFString() const
- \since 5.2
-
- Creates a CFString from a QString. The caller owns the CFString and is
- responsible for releasing it.
-
- \note this function is only available on OS X and iOS.
-*/
-
-/*! \fn QString QString::fromNSString(const NSString *string)
- \since 5.2
-
- Constructs a new QString containing a copy of the \a string NSString.
-
- \note this function is only available on OS X and iOS.
-*/
-
-/*! \fn NSString QString::toNSString() const
- \since 5.2
-
- Creates a NSString from a QString. The NSString is autoreleased.
-
- \note this function is only available on OS X and iOS.
-*/
-
/*! \fn bool QString::isSimpleText() const
\internal
@@ -8332,6 +8295,78 @@ QString &QString::setRawData(const QChar *unicode, int size)
Returns the size of the Latin-1 string stored in this object.
*/
+/*! \fn QLatin1Char QLatin1String::at(int pos) const
+ \since 5.8
+
+ Returns the character at position \a pos in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a pos < 0 or \a pos ≥ size().
+
+ \sa operator[]()
+*/
+
+/*! \fn QLatin1Char QLatin1String::operator[](int pos) const
+ \since 5.8
+
+ Returns the character at position \a pos in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a pos < 0 or \a pos ≥ size().
+
+ \sa at()
+*/
+
+/*! \fn QLatin1String QLatin1String::mid(int start) const
+ \since 5.8
+
+ Returns the substring starting at position \a start in this object,
+ and extending to the end of the string.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a start < 0 or \a start > size().
+
+ \sa left(), right()
+*/
+
+/*! \fn QLatin1String QLatin1String::mid(int start, int length) const
+ \since 5.8
+ \overload
+
+ Returns the substring of length \a length starting at position
+ \a start in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \a start < 0, \length < 0,
+ or \a start + \a length > size().
+
+ \sa left(), right()
+*/
+
+/*! \fn QLatin1String QLatin1String::left(int length) const
+ \since 5.8
+
+ Returns the substring of length \a length starting at position
+ 0 in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \length < 0 or \a length > size().
+
+ \sa mid(), right()
+*/
+
+/*! \fn QLatin1String QLatin1String::right(int length) const
+ \since 5.8
+
+ Returns the substring of length \a length starting at position
+ size() - \a length in this object.
+
+ \note This function performs no error checking.
+ The behavior is undefined when \length < 0 or \a length > size().
+
+ \sa mid(), left()
+*/
+
/*! \fn bool QLatin1String::operator==(const QString &other) const
Returns \c true if this string is equal to string \a other;
@@ -9364,6 +9399,24 @@ QStringRef QStringRef::appendTo(QString *string) const
*/
/*!
+ \overload
+ \fn int QStringRef::compare(const QByteArray &other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \since 5.8
+
+ Compares this string with \a other and returns an
+ integer less than, equal to, or greater than zero if this string
+ is less than, equal to, or greater than the \a other byte array,
+ interpreted as a UTF-8 sequence.
+
+ If \a cs is Qt::CaseSensitive, the comparison is case sensitive;
+ otherwise the comparison is case insensitive.
+
+ Equivalent to \c {compare(*this, other, cs)}.
+
+ \sa QString::compare()
+*/
+
+/*!
\fn int QStringRef::localeAwareCompare(const QStringRef &s1, const QString & s2)
\since 4.5
@@ -9747,7 +9800,7 @@ int QStringRef::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs)
{
const int sl = str.size();
if (sl == 1)
- return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs);
+ return lastIndexOf(str.at(0), from, cs);
const int l = size();
if (from < 0)
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 793a859228..16a48515e8 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -68,11 +68,9 @@ namespace std
#error qstring.h must be included before any header file that defines truncate
#endif
-#ifdef Q_OS_MAC
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFString);
-# ifdef __OBJC__
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
-# endif
#endif
QT_BEGIN_NAMESPACE
@@ -99,6 +97,18 @@ public:
Q_DECL_CONSTEXPR int size() const Q_DECL_NOTHROW { return m_size; }
Q_DECL_CONSTEXPR const char *data() const Q_DECL_NOTHROW { return m_data; }
+ Q_DECL_CONSTEXPR QLatin1Char at(int i) const { return QLatin1Char(m_data[i]); }
+ Q_DECL_CONSTEXPR QLatin1Char operator[](int i) const { return at(i); }
+
+ Q_DECL_CONSTEXPR QLatin1String mid(int pos) const
+ { return QLatin1String(m_data + pos, m_size - pos); }
+ Q_DECL_CONSTEXPR QLatin1String mid(int pos, int n) const
+ { return QLatin1String(m_data + pos, n); }
+ Q_DECL_CONSTEXPR QLatin1String left(int n) const
+ { return QLatin1String(m_data, n); }
+ Q_DECL_CONSTEXPR QLatin1String right(int n) const
+ { return QLatin1String(m_data + m_size - n, n); }
+
inline bool operator==(const QString &s) const Q_DECL_NOTHROW;
inline bool operator!=(const QString &s) const Q_DECL_NOTHROW;
inline bool operator>(const QString &s) const Q_DECL_NOTHROW;
@@ -593,7 +603,7 @@ public:
Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW
{ return -s2.compare(s1, cs); }
- int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW;
+ inline int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW;
static int compare(const QString &s1, const QStringRef &s2,
Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW;
@@ -768,13 +778,11 @@ public:
inline std::u32string toStdU32String() const;
#endif
-#if defined(Q_OS_MAC) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QString fromCFString(CFStringRef string);
CFStringRef toCFString() const Q_DECL_CF_RETURNS_RETAINED;
-# if defined(__OBJC__) || defined(Q_QDOC)
static QString fromNSString(const NSString *string);
NSString *toNSString() const Q_DECL_NS_RETURNS_AUTORELEASED;
-# endif
#endif
// compatibility
struct Null { };
@@ -802,6 +810,16 @@ private:
Data *d;
+ friend inline bool operator==(QChar, const QString &) Q_DECL_NOTHROW;
+ friend inline bool operator< (QChar, const QString &) Q_DECL_NOTHROW;
+ friend inline bool operator> (QChar, const QString &) Q_DECL_NOTHROW;
+ friend inline bool operator==(QChar, const QStringRef &) Q_DECL_NOTHROW;
+ friend inline bool operator< (QChar, const QStringRef &) Q_DECL_NOTHROW;
+ friend inline bool operator> (QChar, const QStringRef &) Q_DECL_NOTHROW;
+ friend inline bool operator==(QChar, QLatin1String) Q_DECL_NOTHROW;
+ friend inline bool operator< (QChar, QLatin1String) Q_DECL_NOTHROW;
+ friend inline bool operator> (QChar, QLatin1String) Q_DECL_NOTHROW;
+
void reallocData(uint alloc, bool grow = false);
void expand(int i);
QString multiArg(int numArgs, const QString **args) const;
@@ -1483,6 +1501,10 @@ public:
int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW;
int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW;
int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW;
+#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
+ int compare(const QByteArray &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ { return QString::compare_helper(unicode(), size(), s.data(), qstrnlen(s.data(), s.size()), cs); }
+#endif
static int compare(const QStringRef &s1, const QString &s2,
Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW;
static int compare(const QStringRef &s1, const QStringRef &s2,
@@ -1518,24 +1540,10 @@ inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize)
inline QStringRef::QStringRef(const QString *aString)
:m_string(aString), m_position(0), m_size(aString?aString->size() : 0){}
+// QStringRef <> QStringRef
Q_CORE_EXPORT bool operator==(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW;
inline bool operator!=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW
{ return !(s1 == s2); }
-Q_CORE_EXPORT bool operator==(const QString &s1, const QStringRef &s2) Q_DECL_NOTHROW;
-inline bool operator!=(const QString &s1, const QStringRef &s2) Q_DECL_NOTHROW
-{ return !(s1 == s2); }
-inline bool operator==(const QStringRef &s1, const QString &s2) Q_DECL_NOTHROW
-{ return s2 == s1; }
-inline bool operator!=(const QStringRef &s1, const QString &s2) Q_DECL_NOTHROW
-{ return s2 != s1; }
-Q_CORE_EXPORT bool operator==(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW;
-inline bool operator!=(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW
-{ return !(s1 == s2); }
-inline bool operator==(const QStringRef &s1, QLatin1String s2) Q_DECL_NOTHROW
-{ return s2 == s1; }
-inline bool operator!=(const QStringRef &s1, QLatin1String s2) Q_DECL_NOTHROW
-{ return s2 != s1; }
-
Q_CORE_EXPORT bool operator<(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW;
inline bool operator>(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW
{ return s2 < s1; }
@@ -1544,7 +1552,127 @@ inline bool operator<=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHRO
inline bool operator>=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW
{ return !(s1 < s2); }
+// QString <> QStringRef
+Q_CORE_EXPORT bool operator==(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW;
+inline bool operator!=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) != 0; }
+inline bool operator< (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) < 0; }
+inline bool operator> (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) > 0; }
+inline bool operator<=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) <= 0; }
+inline bool operator>=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) >= 0; }
+
+inline bool operator==(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs == lhs; }
+inline bool operator!=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs != lhs; }
+inline bool operator< (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs > lhs; }
+inline bool operator> (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs < lhs; }
+inline bool operator<=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs >= lhs; }
+inline bool operator>=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs <= lhs; }
+
+inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
+{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
+inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
+{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
+inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
+{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
+inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
+{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
+inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
+{ return QString::compare_helper(constData(), length(), s, cs); }
+inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
+{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
+inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
+{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
+inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
+{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
+
+// QLatin1String <> QStringRef
+Q_CORE_EXPORT bool operator==(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW;
+inline bool operator!=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) != 0; }
+inline bool operator< (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) > 0; }
+inline bool operator> (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) < 0; }
+inline bool operator<=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) >= 0; }
+inline bool operator>=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) <= 0; }
+
+inline bool operator==(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs == lhs; }
+inline bool operator!=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs != lhs; }
+inline bool operator< (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs > lhs; }
+inline bool operator> (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs < lhs; }
+inline bool operator<=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs >= lhs; }
+inline bool operator>=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs <= lhs; }
+
+// QChar <> QString
+inline bool operator==(QChar lhs, const QString &rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) == 0; }
+inline bool operator< (QChar lhs, const QString &rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; }
+inline bool operator> (QChar lhs, const QString &rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; }
+
+inline bool operator!=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); }
+inline bool operator<=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs > rhs); }
+inline bool operator>=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs < rhs); }
+
+inline bool operator==(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; }
+inline bool operator!=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); }
+inline bool operator< (const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; }
+inline bool operator> (const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; }
+inline bool operator<=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); }
+inline bool operator>=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); }
+
+// QChar <> QStringRef
+inline bool operator==(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) == 0; }
+inline bool operator< (QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; }
+inline bool operator> (QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; }
+
+inline bool operator!=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); }
+inline bool operator<=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs > rhs); }
+inline bool operator>=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs < rhs); }
+
+inline bool operator==(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; }
+inline bool operator!=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); }
+inline bool operator< (const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; }
+inline bool operator> (const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; }
+inline bool operator<=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); }
+inline bool operator>=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); }
+
+// QChar <> QLatin1String
+inline bool operator==(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs) == 0; }
+inline bool operator< (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs) < 0; }
+inline bool operator> (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW
+{ return QString::compare_helper(&lhs, 1, rhs) > 0; }
+
+inline bool operator!=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs == rhs); }
+inline bool operator<=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs > rhs); }
+inline bool operator>=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs < rhs); }
+
+inline bool operator==(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; }
+inline bool operator!=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); }
+inline bool operator< (QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; }
+inline bool operator> (QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; }
+inline bool operator<=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); }
+inline bool operator>=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); }
+
#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
+// QStringRef <> QByteArray
+inline QT_ASCII_CAST_WARN bool operator==(const QStringRef &lhs, const QByteArray &rhs) { return lhs.compare(rhs) == 0; }
+inline QT_ASCII_CAST_WARN bool operator!=(const QStringRef &lhs, const QByteArray &rhs) { return lhs.compare(rhs) != 0; }
+inline QT_ASCII_CAST_WARN bool operator< (const QStringRef &lhs, const QByteArray &rhs) { return lhs.compare(rhs) < 0; }
+inline QT_ASCII_CAST_WARN bool operator> (const QStringRef &lhs, const QByteArray &rhs) { return lhs.compare(rhs) > 0; }
+inline QT_ASCII_CAST_WARN bool operator<=(const QStringRef &lhs, const QByteArray &rhs) { return lhs.compare(rhs) <= 0; }
+inline QT_ASCII_CAST_WARN bool operator>=(const QStringRef &lhs, const QByteArray &rhs) { return lhs.compare(rhs) >= 0; }
+
+inline QT_ASCII_CAST_WARN bool operator==(const QByteArray &lhs, const QStringRef &rhs) { return rhs.compare(lhs) == 0; }
+inline QT_ASCII_CAST_WARN bool operator!=(const QByteArray &lhs, const QStringRef &rhs) { return rhs.compare(lhs) != 0; }
+inline QT_ASCII_CAST_WARN bool operator< (const QByteArray &lhs, const QStringRef &rhs) { return rhs.compare(lhs) > 0; }
+inline QT_ASCII_CAST_WARN bool operator> (const QByteArray &lhs, const QStringRef &rhs) { return rhs.compare(lhs) < 0; }
+inline QT_ASCII_CAST_WARN bool operator<=(const QByteArray &lhs, const QStringRef &rhs) { return rhs.compare(lhs) >= 0; }
+inline QT_ASCII_CAST_WARN bool operator>=(const QByteArray &lhs, const QStringRef &rhs) { return rhs.compare(lhs) <= 0; }
+
+// QStringRef <> const char *
inline QT_ASCII_CAST_WARN bool QStringRef::operator==(const char *s) const
{ return QString::compare_helper(constData(), size(), s, -1) == 0; }
inline QT_ASCII_CAST_WARN bool QStringRef::operator!=(const char *s) const
@@ -1572,23 +1700,6 @@ inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QStringRef &s2)
{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; }
#endif // !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
-inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
-{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
-inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
-{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
-inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
-{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
-inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
-{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
-inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW
-{ return QString::compare_helper(constData(), length(), s, cs); }
-inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
-{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
-inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
-{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
-inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
-{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
-
inline int QString::localeAwareCompare(const QStringRef &s) const
{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2)
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index e01f9e16e8..87f15528bf 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -149,6 +149,7 @@ public:
Q_DECLARE_TYPEINFO(QStringList, Q_MOVABLE_TYPE);
+#ifndef Q_QDOC
inline QStringList *QListSpecialMethods<QString>::self()
{ return static_cast<QStringList *>(this); }
inline const QStringList *QListSpecialMethods<QString>::self() const
@@ -284,6 +285,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons
}
#endif // QT_NO_REGULAREXPRESSION
#endif // QT_BOOTSTRAPPED
+#endif // Q_QDOC
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp
index 8e32db48de..4febeda537 100644
--- a/src/corelib/tools/qtimezoneprivate_win.cpp
+++ b/src/corelib/tools/qtimezoneprivate_win.cpp
@@ -383,17 +383,11 @@ static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitio
static QLocale::Country userCountry()
{
-#if defined(Q_OS_WINCE)
- // Guess that the syslem locale country is the right one to use
- // TODO Find if WinCE has equivalent api
- return QLocale::system().country();
-#else
const GEOID id = GetUserGeoID(GEOCLASS_NATION);
wchar_t code[3];
const int size = GetGeoInfo(id, GEO_ISO2, code, 3, 0);
return (size == 3) ? QLocalePrivate::codeToCountry(reinterpret_cast<const QChar*>(code), size)
: QLocale::AnyCountry;
-#endif // Q_OS_WINCE
}
// Create the system default time zone
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index b64ec756ba..4d77f4e43f 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -133,9 +133,6 @@ false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
SOURCES += tools/qelapsedtimer_mac.cpp
OBJECTIVE_SOURCES += tools/qlocale_mac.mm \
tools/qtimezoneprivate_mac.mm \
- tools/qstring_mac.mm \
- tools/qbytearray_mac.mm \
- tools/qdatetime_mac.mm
}
else:android {
SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp tools/qtimezoneprivate_android.cpp
@@ -152,11 +149,11 @@ else:win32 {
} else:integrity:SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp
else:SOURCES += tools/qelapsedtimer_generic.cpp
-contains(QT_CONFIG, zlib) {
- include($$PWD/../../3rdparty/zlib.pri)
+contains(QT_CONFIG, system-zlib) {
+ include($$PWD/../../3rdparty/zlib_dependency.pri)
} else {
CONFIG += no_core_dep
- include($$PWD/../../3rdparty/zlib_dependency.pri)
+ include($$PWD/../../3rdparty/zlib.pri)
}
contains(QT_CONFIG,icu) {
@@ -198,12 +195,10 @@ INCLUDEPATH += ../3rdparty/md5 \
../3rdparty/md4 \
../3rdparty/sha3
-contains(QT_CONFIG, doubleconversion) {
- include($$PWD/../../3rdparty/double-conversion/double-conversion.pri)
-} else:contains(QT_CONFIG, system-doubleconversion) {
+contains(QT_CONFIG, system-doubleconversion) {
LIBS_PRIVATE += -ldouble-conversion
-} else {
- DEFINES += QT_NO_DOUBLECONVERSION
+} else: contains(QT_CONFIG, doubleconversion) {
+ include($$PWD/../../3rdparty/double-conversion/double-conversion.pri)
}
# Note: libm should be present by default becaue this is C++
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index fa67fc17ef..c50f0b6b9c 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -3,15 +3,15 @@ QT = core-private
CONFIG += link_pkgconfig
MODULE_CONFIG = dbusadaptors dbusinterfaces
-!contains(QT_LIBS_DBUS, .*dbus-1.*) {
- win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d
- else:QT_LIBS_DBUS += -ldbus-1
+!contains(QMAKE_LIBS_DBUS, .*dbus-1.*) {
+ win32:CONFIG(debug, debug|release):QMAKE_LIBS_DBUS += -ldbus-1d
+ else:QMAKE_LIBS_DBUS += -ldbus-1
}
DEFINES += DBUS_API_SUBJECT_TO_CHANGE
-QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_DBUS
contains(QT_CONFIG, dbus-linked) {
- LIBS_PRIVATE += $$QT_LIBS_DBUS
+ LIBS_PRIVATE += $$QMAKE_LIBS_DBUS
DEFINES += QT_LINKED_LIBDBUS
}
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index bd25d8a6bf..cddb7dfb95 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -69,10 +69,6 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_OS_WIN
-static void preventDllUnload();
-#endif
-
Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager)
// can be replaced with a lambda in Qt 5.7
@@ -161,10 +157,6 @@ 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();
}
@@ -1290,31 +1282,4 @@ QT_END_NAMESPACE
#include "qdbusconnection.moc"
-#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/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h
index a785c89761..b7de1b22e8 100644
--- a/src/dbus/qdbusservicewatcher.h
+++ b/src/dbus/qdbusservicewatcher.h
@@ -63,6 +63,7 @@ public:
WatchForOwnerChange = 0x03
};
Q_DECLARE_FLAGS(WatchMode, WatchModeFlag)
+ Q_FLAG(WatchMode)
explicit QDBusServiceWatcher(QObject *parent = Q_NULLPTR);
QDBusServiceWatcher(const QString &service, const QDBusConnection &connection,
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 8db944e5e3..657b57c0cd 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -71,11 +71,11 @@ SOURCES += \
image/qxbmhandler.cpp \
image/qxpmhandler.cpp
-!contains(QT_CONFIG, no-png):include($$PWD/qpnghandler.pri)
-else:DEFINES *= QT_NO_IMAGEFORMAT_PNG
-
-contains(QT_CONFIG, jpeg):include($$PWD/qjpeghandler.pri)
-contains(QT_CONFIG, gif):include($$PWD/qgifhandler.pri)
+contains(QT_CONFIG, png) {
+ HEADERS += image/qpnghandler_p.h
+ SOURCES += image/qpnghandler.cpp
+ include($$PWD/../../3rdparty/png_dependency.pri)
+}
# SIMD
SSE2_SOURCES += image/qimage_sse2.cpp
diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri
deleted file mode 100644
index ec33101451..0000000000
--- a/src/gui/image/qgifhandler.pri
+++ /dev/null
@@ -1,3 +0,0 @@
-# common to plugin and built-in forms
-HEADERS += $$PWD/qgifhandler_p.h
-SOURCES += $$PWD/qgifhandler.cpp
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 2f24165069..38782ac0a0 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -431,21 +431,23 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
QString contentDir = contentDirs.at(i) + QLatin1Char('/');
for (int j = 0; j < subDirs.size() ; ++j) {
const QIconDirInfo &dirInfo = subDirs.at(j);
- QString subdir = dirInfo.path;
- QDir currentDir(contentDir + subdir);
- if (currentDir.exists(pngIconName)) {
+ const QString subDir = contentDir + dirInfo.path + QLatin1Char('/');
+ const QString pngPath = subDir + pngIconName;
+ if (QFile::exists(pngPath)) {
PixmapEntry *iconEntry = new PixmapEntry;
iconEntry->dir = dirInfo;
- iconEntry->filename = currentDir.filePath(pngIconName);
+ iconEntry->filename = pngPath;
// Notice we ensure that pixmap entries always come before
// scalable to preserve search order afterwards
info.entries.prepend(iconEntry);
- } else if (m_supportsSvg &&
- currentDir.exists(svgIconName)) {
- ScalableEntry *iconEntry = new ScalableEntry;
- iconEntry->dir = dirInfo;
- iconEntry->filename = currentDir.filePath(svgIconName);
- info.entries.append(iconEntry);
+ } else if (m_supportsSvg) {
+ const QString svgPath = subDir + svgIconName;
+ if (QFile::exists(svgPath)) {
+ ScalableEntry *iconEntry = new ScalableEntry;
+ iconEntry->dir = dirInfo;
+ iconEntry->filename = svgPath;
+ info.entries.append(iconEntry);
+ }
}
}
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 36595025f5..3a31af8645 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -780,9 +780,8 @@ QImage::QImage() Q_DECL_NOEXCEPT
drawing onto it with QPainter.
*/
QImage::QImage(int width, int height, Format format)
- : QPaintDevice()
+ : QImage(QSize(width, height), format)
{
- d = QImageData::create(QSize(width, height), format);
}
/*!
@@ -2288,7 +2287,7 @@ QRgb QImage::pixel(int x, int y) const
const QPixelLayout *layout = &qPixelLayouts[d->format];
uint result;
const uint *ptr = qFetchPixels[layout->bpp](&result, s, x, 1);
- return *layout->convertToARGB32PM(&result, ptr, 1, layout, 0);
+ return *layout->convertToARGB32PM(&result, ptr, 1, 0, 0);
}
/*!
@@ -2390,7 +2389,7 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
const QPixelLayout *layout = &qPixelLayouts[d->format];
uint result;
- const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, layout, 0);
+ const uint *ptr = layout->convertFromARGB32PM(&result, &index_or_rgb, 1, 0, 0);
qStorePixels[layout->bpp](s, ptr, x, 1);
}
@@ -2576,7 +2575,7 @@ bool QImage::allGray() const
while (x < d->width) {
int l = qMin(d->width - x, buffer_size);
const uint *ptr = fetch(buffer, b, x, l);
- ptr = layout->convertToARGB32PM(buffer, ptr, l, layout, 0);
+ ptr = layout->convertToARGB32PM(buffer, ptr, l, 0, 0);
for (int i = 0; i < l; ++i) {
if (!qIsGray(ptr[i]))
return false;
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 3c80b070e3..16789c802e 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -108,7 +108,7 @@ void qGamma_correct_back_to_linear_cs(QImage *image)
// The drawhelper conversions from/to RGB32 are passthroughs which is not always correct for general image conversion.
static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply(src[i]);
@@ -116,7 +116,7 @@ static const uint *QT_FASTCALL convertRGB32FromARGB32PM(uint *buffer, const uint
}
static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 |src[i];
@@ -124,10 +124,11 @@ static const uint *QT_FASTCALL convertRGB32ToARGB32PM(uint *buffer, const uint *
}
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
-extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+extern const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
#endif
-void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags flags)
{
// Cannot be used with indexed formats.
Q_ASSERT(dest->format > QImage::Format_Indexed8);
@@ -158,14 +159,20 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
convertFromARGB32PM = convertRGB32FromARGB32PM;
}
}
+ QDitherInfo dither;
+ QDitherInfo *ditherPtr = 0;
+ if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
+ ditherPtr = &dither;
for (int y = 0; y < src->height; ++y) {
+ dither.y = y;
int x = 0;
while (x < src->width) {
+ dither.x = x;
int l = qMin(src->width - x, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l);
- ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);
- ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);
+ ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr);
store(destData, ptr, x, l);
x += l;
}
@@ -174,7 +181,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
}
}
-bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags)
+bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags flags)
{
// Cannot be used with indexed formats or between formats with different pixel depths.
Q_ASSERT(dst_format > QImage::Format_Indexed8);
@@ -207,14 +214,20 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
convertFromARGB32PM = convertRGB32FromARGB32PM;
}
}
+ QDitherInfo dither;
+ QDitherInfo *ditherPtr = 0;
+ if ((flags & Qt::PreferDither) && (flags & Qt::Dither_Mask) != Qt::ThresholdDither)
+ ditherPtr = &dither;
for (int y = 0; y < data->height; ++y) {
+ dither.y = y;
int x = 0;
while (x < data->width) {
+ dither.x = x;
int l = qMin(data->width - x, buffer_size);
const uint *ptr = fetch(buffer, srcData, x, l);
- ptr = convertToARGB32PM(buffer, ptr, l, srcLayout, 0);
- ptr = convertFromARGB32PM(buffer, ptr, l, destLayout, 0);
+ ptr = convertToARGB32PM(buffer, ptr, l, 0, ditherPtr);
+ ptr = convertFromARGB32PM(buffer, ptr, l, 0, ditherPtr);
// The conversions might be passthrough and not use the buffer, in that case we are already done.
if (srcData != (const uchar*)ptr)
store(srcData, ptr, x, l);
diff --git a/src/gui/image/qimage_sse4.cpp b/src/gui/image/qimage_sse4.cpp
index 1f3f8f0d3f..0e2c2f492e 100644
--- a/src/gui/image/qimage_sse4.cpp
+++ b/src/gui/image/qimage_sse4.cpp
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertRGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = 0xff000000 | qUnpremultiply_sse4(src[i]);
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 4dada4ca82..0102ff5981 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -155,12 +155,6 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
-#include <private/qjpeghandler_p.h>
-#endif
-#ifdef QT_BUILTIN_GIF_READER
-#include <private/qgifhandler_p.h>
-#endif
#include <algorithm>
@@ -175,13 +169,6 @@ enum _qt_BuiltInFormatType {
#ifndef QT_NO_IMAGEFORMAT_PNG
_qt_PngFormat,
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- _qt_JpgFormat,
- _qt_JpegFormat,
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- _qt_GifFormat,
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
_qt_BmpFormat,
#endif
@@ -210,13 +197,6 @@ static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[] = {
#ifndef QT_NO_IMAGEFORMAT_PNG
{"png", "image/png"},
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- {"jpg", "image/jpeg"},
- {"jpeg", "image/jpeg"},
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- {"gif", "image/gif"},
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
{"bmp", "image/bmp"},
#endif
@@ -357,14 +337,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- } else if (testFormat == "jpg" || testFormat == "jpeg") {
- handler = new QJpegHandler;
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- } else if (testFormat == "gif") {
- handler = new QGifHandler;
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@@ -442,19 +414,6 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
handler = new QPngHandler;
break;
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- case _qt_JpgFormat:
- case _qt_JpegFormat:
- if (QJpegHandler::canRead(device))
- handler = new QJpegHandler;
- break;
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- case _qt_GifFormat:
- if (QGifHandler::canRead(device))
- handler = new QGifHandler;
- break;
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
case _qt_BmpFormat:
if (QBmpHandler::canRead(device))
@@ -491,8 +450,8 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
if (handler) {
#ifdef QIMAGEREADER_DEBUG
- qDebug() << "QImageReader::createReadHandler: the" << _qt_BuiltInFormats[currentFormat].extension
- << "built-in handler can read this data";
+ qDebug("QImageReader::createReadHandler: the %s built-in handler can read this data",
+ _qt_BuiltInFormats[currentFormat].extension);
#endif
break;
}
@@ -674,12 +633,9 @@ QImageReader::QImageReader(QIODevice *device, const QByteArray &format)
\sa setFileName()
*/
QImageReader::QImageReader(const QString &fileName, const QByteArray &format)
- : d(new QImageReaderPrivate(this))
+ : QImageReader(new QFile(fileName), format)
{
- QFile *file = new QFile(fileName);
- d->device = file;
d->deleteDevice = true;
- d->format = format;
}
/*!
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 35db038601..f3af2738af 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -115,12 +115,6 @@
#ifndef QT_NO_IMAGEFORMAT_PNG
#include <private/qpnghandler_p.h>
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
-#include <private/qjpeghandler_p.h>
-#endif
-#ifdef QT_BUILTIN_GIF_READER
-#include <private/qgifhandler_p.h>
-#endif
#include <algorithm>
@@ -184,14 +178,6 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
} else if (testFormat == "png") {
handler = new QPngHandler;
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- } else if (testFormat == "jpg" || testFormat == "jpeg") {
- handler = new QJpegHandler;
-#endif
-#ifdef QT_BUILTIN_GIF_READER
- } else if (testFormat == "gif") {
- handler = new QGifHandler;
-#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
} else if (testFormat == "bmp") {
handler = new QBmpHandler;
@@ -340,12 +326,9 @@ QImageWriter::QImageWriter(QIODevice *device, const QByteArray &format)
by inspecting the extension of \a fileName.
*/
QImageWriter::QImageWriter(const QString &fileName, const QByteArray &format)
- : d(new QImageWriterPrivate(this))
+ : QImageWriter(new QFile(fileName), format)
{
- QFile *file = new QFile(fileName);
- d->device = file;
d->deleteDevice = true;
- d->format = format;
}
/*!
@@ -910,9 +893,6 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
#ifndef QT_NO_IMAGEFORMAT_PNG
formats << "png";
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- formats << "jpg" << "jpeg";
-#endif
#ifndef QT_NO_IMAGEFORMATPLUGIN
supportedImageHandlerFormats(loader(), QImageIOPlugin::CanWrite, &formats);
@@ -951,9 +931,6 @@ QList<QByteArray> QImageWriter::supportedMimeTypes()
#ifndef QT_NO_IMAGEFORMAT_PNG
mimeTypes << "image/png";
#endif
-#ifndef QT_NO_IMAGEFORMAT_JPEG
- mimeTypes << "image/jpeg";
-#endif
#ifndef QT_NO_IMAGEFORMATPLUGIN
supportedImageHandlerMimeTypes(loader(), QImageIOPlugin::CanWrite, &mimeTypes);
diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri
deleted file mode 100644
index de40c6742e..0000000000
--- a/src/gui/image/qjpeghandler.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-# common to plugin and built-in forms
-HEADERS += $$PWD/qjpeghandler_p.h
-SOURCES += $$PWD/qjpeghandler.cpp
-contains(QT_CONFIG, system-jpeg) {
- msvc: \
- LIBS += libjpeg.lib
- else: \
- LIBS += -ljpeg
-} else {
- include($$PWD/../../3rdparty/libjpeg.pri)
-}
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 09d23c0084..18df8c35a6 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -125,12 +125,8 @@ QPixmap::QPixmap()
*/
QPixmap::QPixmap(int w, int h)
- : QPaintDevice()
+ : QPixmap(QSize(w, h))
{
- if (!qt_pixmap_thread_test())
- doInit(0, 0, QPlatformPixmap::PixmapType);
- else
- doInit(w, h, QPlatformPixmap::PixmapType);
}
/*!
@@ -144,12 +140,8 @@ QPixmap::QPixmap(int w, int h)
*/
QPixmap::QPixmap(const QSize &size)
- : QPaintDevice()
+ : QPixmap(size, QPlatformPixmap::PixmapType)
{
- if (!qt_pixmap_thread_test())
- doInit(0, 0, QPlatformPixmap::PixmapType);
- else
- doInit(size.width(), size.height(), QPlatformPixmap::PixmapType);
}
/*!
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 0906b65d96..4032176efc 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -152,7 +152,7 @@ void QBlittablePlatformPixmap::fill(const QColor &color)
uint pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[blittable()->lock()->format()];
Q_ASSERT(layout->convertFromARGB32PM);
- layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0);
+ layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
//so premultiplied formats are supported and ARGB32 and RGB32
blittable()->lock()->fill(pixel);
@@ -298,10 +298,8 @@ QRectF QBlittablePlatformPixmap::clipAndTransformRect(const QRectF &rect) const
if (clipData->hasRectClip) {
transformationRect &= clipData->clipRect;
} else if (clipData->hasRegionClip) {
- const QVector<QRect> rects = clipData->clipRegion.rects();
- for (int i = 0; i < rects.size(); i++) {
- transformationRect &= rects.at(i);
- }
+ for (const QRect &rect : clipData->clipRegion)
+ transformationRect &= rect;
}
}
}
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 13104ce17f..45047f556c 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -195,7 +195,7 @@ void QRasterPlatformPixmap::fill(const QColor &color)
}
pixel = qPremultiply(color.rgba());
const QPixelLayout *layout = &qPixelLayouts[image.format()];
- layout->convertFromARGB32PM(&pixel, &pixel, 1, layout, 0);
+ layout->convertFromARGB32PM(&pixel, &pixel, 1, 0, 0);
} else if (image.format() == QImage::Format_Alpha8) {
pixel = qAlpha(color.rgba());
} else if (image.format() == QImage::Format_Grayscale8) {
@@ -335,7 +335,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
} else if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
image = sourceImage;
} else {
- image = sourceImage.convertToFormat(format);
+ image = sourceImage.convertToFormat(format, flags);
}
if (image.d) {
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 7f20586156..92f6964783 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -48,84 +48,6 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_OS_WINCE
-#define GetDIBits(a,b,c,d,e,f,g) qt_wince_GetDIBits(a,b,c,d,e,f,g)
-int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint)
-{
- if (!lpvBits) {
- qWarning("::GetDIBits(), lpvBits NULL");
- return 0;
- }
- BITMAP bm;
- GetObject(hSourceBitmap, sizeof(BITMAP), &bm);
- bm.bmHeight = qAbs(bm.bmHeight);
-
- HBITMAP hTargetBitmap;
- void *pixels;
-
- BITMAPINFO dibInfo;
- memset(&dibInfo, 0, sizeof(dibInfo));
- dibInfo.bmiHeader.biBitCount = 32;
- dibInfo.bmiHeader.biClrImportant = 0;
- dibInfo.bmiHeader.biClrUsed = 0;
- dibInfo.bmiHeader.biCompression = BI_RGB;;
- dibInfo.bmiHeader.biHeight = -bm.bmHeight;
- dibInfo.bmiHeader.biWidth = bm.bmWidth;
- dibInfo.bmiHeader.biPlanes = 1;
- dibInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- dibInfo.bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4;
-
- HDC displayDC = GetDC(NULL);
- if (!displayDC) {
- qWarning("::GetDIBits(), failed to GetDC");
- return 0;
- }
-
- int ret = bm.bmHeight;
-
- hTargetBitmap = CreateDIBSection(displayDC, (const BITMAPINFO*) &dibInfo, DIB_RGB_COLORS,
- (void**)&pixels, NULL, 0);
- if (!hTargetBitmap) {
- qWarning("::GetDIBits(), failed to CreateDIBSection");
- return 0;
- }
-
- HDC hdcSrc = CreateCompatibleDC(displayDC);
- HDC hdcDst = CreateCompatibleDC(displayDC);
-
- if (!(hdcDst && hdcSrc)) {
- qWarning("::GetDIBits(), failed to CreateCompatibleDC");
- ret = 0;
- }
-
- HBITMAP hOldBitmap1 = (HBITMAP) SelectObject(hdcSrc, hSourceBitmap);
- HBITMAP hOldBitmap2 = (HBITMAP) SelectObject(hdcDst, hTargetBitmap);
-
- if (!(hOldBitmap1 && hOldBitmap2)) {
- qWarning("::GetDIBits(), failed to SelectObject for bitmaps");
- ret = 0;
- }
-
- if (!BitBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY)) {
- qWarning("::GetDIBits(), BitBlt failed");
- ret = 0;
- }
-
- SelectObject(hdcSrc, hOldBitmap1);
- SelectObject(hdcDst, hOldBitmap2);
-
- DeleteDC(hdcSrc);
- DeleteDC(hdcDst);
-
- ReleaseDC(NULL, displayDC);
-
- memcpy(lpvBits, pixels, dibInfo.bmiHeader.biSizeImage);
-
- DeleteObject(hTargetBitmap);
- return ret;
-}
-#endif
-
static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih)
{
memset(bih, 0, sizeof(BITMAPINFOHEADER));
@@ -325,8 +247,6 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p)
return hIcon;
}
-#ifndef Q_OS_WINCE
-
Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h)
{
QImage image(w, h, QImage::Format_ARGB32_Premultiplied);
@@ -415,95 +335,5 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
DeleteDC(hdc);
return QPixmap::fromImage(image);
}
-#else //ifndef Q_OS_WINCE
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon)
-{
- HDC screenDevice = GetDC(0);
- HDC hdc = CreateCompatibleDC(screenDevice);
- ReleaseDC(0, screenDevice);
-
- ICONINFO iconinfo;
- bool result = GetIconInfo(icon, &iconinfo);
- if (!result)
- qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()");
-
- int w = 0;
- int h = 0;
- if (!iconinfo.xHotspot || !iconinfo.yHotspot) {
- // We could not retrieve the icon size via GetIconInfo,
- // so we try again using the icon bitmap.
- BITMAP bm;
- int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm);
- if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm);
- if (!result) {
- qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size");
- return QPixmap();
- }
- w = bm.bmWidth;
- h = bm.bmHeight;
- } else {
- // x and y Hotspot describes the icon center
- w = iconinfo.xHotspot * 2;
- h = iconinfo.yHotspot * 2;
- }
- const DWORD dwImageSize = w * h * 4;
-
- BITMAPINFO bmi;
- memset(&bmi, 0, sizeof(bmi));
- bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
- bmi.bmiHeader.biWidth = w;
- bmi.bmiHeader.biHeight = -h;
- bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biBitCount = 32;
- bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiHeader.biSizeImage = dwImageSize;
-
- uchar* bits;
-
- HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0);
- if (winBitmap )
- memset(bits, 0xff, dwImageSize);
- if (!winBitmap) {
- qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()");
- return QPixmap();
- }
-
- HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap);
- if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL))
- qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
-
- uint mask = 0xff000000;
- // Create image and copy data into image.
- QImage image(w, h, QImage::Format_ARGB32);
-
- if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = w * sizeof(QRgb);
- for (int y=0; y < h; ++y) {
- QRgb *dest = (QRgb *) image.scanLine(y);
- const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x < w; ++x) {
- dest[x] = src[x];
- }
- }
- }
- if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK))
- qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
- if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = w * sizeof(QRgb);
- for (int y=0; y < h; ++y) {
- QRgb *dest = (QRgb *) image.scanLine(y);
- const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x < w; ++x) {
- if (!src[x])
- dest[x] = dest[x] | mask;
- }
- }
- }
- SelectObject(hdc, oldhdc); //restore state
- DeleteObject(winBitmap);
- DeleteDC(hdc);
- return QPixmap::fromImage(image);
-}
-#endif //ifndef Q_OS_WINCE
QT_END_NAMESPACE
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index d021e6f09f..96d6be502d 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -75,20 +75,8 @@
# endif
#endif
-#ifdef Q_OS_WINCE
-#define CALLBACK_CALL_TYPE __cdecl
-#else
-#define CALLBACK_CALL_TYPE
-#endif
-
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE) && defined(STANDARDSHELL_UI_MODEL)
-# define Q_INTERNAL_WIN_NO_THROW __declspec(nothrow)
-#else
-# define Q_INTERNAL_WIN_NO_THROW
-#endif
-
// avoid going through QImage::scanLine() which calls detach
#define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl)
@@ -190,7 +178,7 @@ private:
extern "C" {
static
-void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
+void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
QIODevice *in = d->q->device();
@@ -215,7 +203,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz
static
-void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
+void qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QPNGImageWriter* qpiw = (QPNGImageWriter*)png_get_io_ptr(png_ptr);
QIODevice* out = qpiw->device();
@@ -229,7 +217,7 @@ void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_s
static
-void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */)
+void qpiw_flush_fn(png_structp /* png_ptr */)
{
}
@@ -487,7 +475,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
}
extern "C" {
-static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
+static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
{
qWarning("libpng warning: %s", message);
}
@@ -495,7 +483,7 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const
}
-void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
+void QPngHandlerPrivate::readPngTexts(png_info *info)
{
png_textp text_ptr;
int num_text=0;
@@ -522,7 +510,7 @@ void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info)
}
-bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
+bool QPngHandlerPrivate::readPngHeader()
{
state = Error;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
@@ -566,7 +554,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
return true;
}
-bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
+bool QPngHandlerPrivate::readPngImage(QImage *outImage)
{
if (state == Error)
return false;
@@ -810,7 +798,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y)
return writeImage(image, -1, QString(), off_x, off_y);
}
-bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description,
+bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description,
int off_x_in, int off_y_in)
{
QPoint offset = image.offset();
diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri
index 505d214130..e69de29bb2 100644
--- a/src/gui/image/qpnghandler.pri
+++ b/src/gui/image/qpnghandler.pri
@@ -1,4 +0,0 @@
-HEADERS += $$PWD/qpnghandler_p.h
-SOURCES += $$PWD/qpnghandler.cpp
-
-include($$PWD/../../3rdparty/png_dependency.pri)
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index c8dd589673..756e31318f 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -845,7 +845,7 @@ static bool read_xpm_header(
if (!read_xpm_string(buf, device, source, index, state))
return false;
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
+#ifdef Q_CC_MSVC
if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
#else
if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4)
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 3861eb8b40..973e5c4333 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -705,20 +705,16 @@ void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent,
Constructs an item.
*/
QStandardItem::QStandardItem()
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(*new QStandardItemPrivate)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
}
/*!
Constructs an item with the given \a text.
*/
QStandardItem::QStandardItem(const QString &text)
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(*new QStandardItemPrivate)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
setText(text);
}
@@ -726,22 +722,17 @@ QStandardItem::QStandardItem(const QString &text)
Constructs an item with the given \a icon and \a text.
*/
QStandardItem::QStandardItem(const QIcon &icon, const QString &text)
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(text)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
setIcon(icon);
- setText(text);
}
/*!
Constructs an item with \a rows rows and \a columns columns of child items.
*/
QStandardItem::QStandardItem(int rows, int columns)
- : d_ptr(new QStandardItemPrivate)
+ : QStandardItem(*new QStandardItemPrivate)
{
- Q_D(QStandardItem);
- d->q_ptr = this;
setRowCount(rows);
setColumnCount(columns);
}
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 21dbdadcf8..e9da36a42a 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -553,7 +553,7 @@ bool QClipboard::ownsFindBuffer() const
bool QClipboard::supportsMode(Mode mode) const
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
- return clipboard->supportsMode(mode);
+ return clipboard && clipboard->supportsMode(mode);
}
/*!
@@ -565,7 +565,7 @@ bool QClipboard::supportsMode(Mode mode) const
bool QClipboard::ownsMode(Mode mode) const
{
QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
- return clipboard->ownsMode(mode);
+ return clipboard && clipboard->ownsMode(mode);
}
/*!
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index f4f07d555b..6adbea6da6 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -289,7 +289,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton but
QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers)
- : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons), caps(0)
+ : QMouseEvent(type, localPos, localPos, screenPos, button, buttons, modifiers)
{}
/*!
@@ -342,7 +342,7 @@ QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &wind
QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos,
Qt::MouseButton button, Qt::MouseButtons buttons,
Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
- : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons), caps(0)
+ : QMouseEvent(type, localPos, windowPos, screenPos, button, buttons, modifiers)
{
QGuiApplicationPrivate::setMouseEventSource(this, source);
}
@@ -829,9 +829,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
- src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
+ : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
+ buttons, modifiers, Qt::NoScrollPhase)
{}
/*!
@@ -860,9 +859,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase),
- src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
+ : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
+ buttons, modifiers, phase, Qt::MouseEventNotSynthesized)
{}
/*!
@@ -896,9 +894,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),
- invertedScrolling(false)
+ : QWheelEvent(pos, globalPos, pixelDelta, angleDelta, qt4Delta, qt4Orientation,
+ buttons, modifiers, phase, source, false)
{}
/*!
@@ -1767,7 +1764,7 @@ QIconDragEvent::~QIconDragEvent()
coordinates.
*/
QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos)
- : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason)
+ : QContextMenuEvent(reason, pos, globalPos, Qt::NoModifier)
{}
/*!
@@ -2065,6 +2062,16 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
*/
/*!
+ \fn QInputMethodEvent::Attribute::Attribute(AttributeType type, int start, int length)
+ \overload
+ \since 5.7
+
+ Constructs an input method attribute with no value. \a type
+ specifies the type of attribute, and \a start and \a length
+ the position of the attribute.
+*/
+
+/*!
Constructs an event of type QEvent::InputMethod. The
attributes(), preeditString(), commitString(), replacementStart(),
and replacementLength() are initialized to default values.
@@ -2440,19 +2447,8 @@ QTabletEvent::QTabletEvent(Type type, const QPointF &pos, const QPointF &globalP
int device, int pointerType,
qreal pressure, int xTilt, int yTilt, qreal tangentialPressure,
qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID)
- : QInputEvent(type, keyState),
- mPos(pos),
- mGPos(globalPos),
- mDev(device),
- mPointerType(pointerType),
- mXT(xTilt),
- mYT(yTilt),
- mZ(z),
- mPress(pressure),
- mTangential(tangentialPressure),
- mRot(rotation),
- mUnique(uniqueID),
- mExtra(new QTabletEventPrivate(Qt::NoButton, Qt::NoButton))
+ : QTabletEvent(type, pos, globalPos, device, pointerType, pressure, xTilt, yTilt,
+ tangentialPressure, rotation, z, keyState, uniqueID, Qt::NoButton, Qt::NoButton)
{
}
@@ -4414,6 +4410,7 @@ QTouchEvent::~QTouchEvent()
The values of this enum describe additional information about a touch point.
\value Pen Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger.
+ \value Token Indicates that the contact has been made by a fiducial object (e.g. a knob or other token) instead of a finger.
*/
/*!
@@ -4460,6 +4457,22 @@ int QTouchEvent::TouchPoint::id() const
}
/*!
+ \since 5.8
+ Returns the unique ID of this touch point or token, if any.
+
+ It is normally invalid (with a \l {QPointerUniqueId::numeric()} {numeric()} value of -1),
+ because touchscreens cannot uniquely identify fingers. But when the
+ \l {TouchPoint::InfoFlag} {Token} flag is set, it is expected to uniquely
+ identify a specific token (fiducial object).
+
+ \sa flags
+*/
+QPointerUniqueId QTouchEvent::TouchPoint::uniqueId() const
+{
+ return d->uniqueId;
+}
+
+/*!
Returns the current state of this touch point.
*/
Qt::TouchPointState QTouchEvent::TouchPoint::state() const
@@ -4663,6 +4676,19 @@ qreal QTouchEvent::TouchPoint::pressure() const
}
/*!
+ \since 5.8
+ Returns the angular orientation of this touch point. The return value is in degrees,
+ where zero (the default) indicates the finger or token is pointing upwards,
+ a negative angle means it's rotated to the left, and a positive angle means
+ it's rotated to the right. Most touchscreens do not detect rotation, so
+ zero is the most common value.
+*/
+qreal QTouchEvent::TouchPoint::rotation() const
+{
+ return d->rotation;
+}
+
+/*!
Returns a velocity vector for this touch point.
The vector is in the screen's coordinate system, using pixels per seconds for the magnitude.
@@ -4713,6 +4739,14 @@ void QTouchEvent::TouchPoint::setId(int id)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setUniqueId(qint64 uid)
+{
+ if (d->ref.load() != 1)
+ d = d->detach();
+ d->uniqueId = QPointerUniqueId(uid);
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
{
if (d->ref.load() != 1)
@@ -4849,6 +4883,14 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure)
}
/*! \internal */
+void QTouchEvent::TouchPoint::setRotation(qreal angle)
+{
+ if (d->ref.load() != 1)
+ d = d->detach();
+ d->rotation = angle;
+}
+
+/*! \internal */
void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
{
if (d->ref.load() != 1)
@@ -5119,4 +5161,37 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const
return m_applicationState;
}
+/*!
+ \class QPointerUniqueId
+ \since 5.8
+ \ingroup events
+ \inmodule QtGui
+
+ \brief QPointerUniqueId identifies a unique object, such as a tagged token
+ or stylus, which is used with a pointing device.
+
+ \sa QTouchEvent::TouchPoint
+*/
+
+/*!
+ Constructs a unique pointer ID with a numeric \a id provided by the hardware.
+ The default is -1, which means an invalid pointer ID.
+*/
+QPointerUniqueId::QPointerUniqueId(qint64 id)
+ : m_numericId(id)
+{
+}
+
+/*!
+ \property QPointerUniqueId::numeric
+ \brief the numeric unique ID of the token represented by a touchpoint
+
+ This is the numeric unique ID if the device provides that type of ID;
+ otherwise it is -1.
+*/
+qint64 QPointerUniqueId::numeric()
+{
+ return m_numericId;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 0a207667ad..785884681f 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -535,8 +535,9 @@ public:
class Attribute {
public:
Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(qMove(val)) {}
- AttributeType type;
+ Attribute(AttributeType t, int s, int l) : type(t), start(s), length(l), value() {}
+ AttributeType type;
int start;
int length;
QVariant value;
@@ -789,6 +790,22 @@ inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ?
inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
#endif // QT_NO_SHORTCUT
+class QPointerUniqueIdPrivate;
+class Q_GUI_EXPORT QPointerUniqueId
+{
+ Q_GADGET
+ Q_PROPERTY(qint64 numeric READ numeric CONSTANT)
+public:
+ explicit QPointerUniqueId(qint64 id = -1);
+
+ qint64 numeric();
+
+private:
+ // TODO for TUIO 2, or any other type of complex token ID, a d-pointer can replace
+ // m_numericId without changing the size of this class.
+ qint64 m_numericId;
+};
+
class QTouchEventTouchPointPrivate;
class Q_GUI_EXPORT QTouchEvent : public QInputEvent
{
@@ -797,7 +814,8 @@ public:
{
public:
enum InfoFlag {
- Pen = 0x0001
+ Pen = 0x0001,
+ Token = 0x0002
};
#ifndef Q_MOC_RUN
// otherwise moc gives
@@ -823,6 +841,7 @@ public:
{ qSwap(d, other.d); }
int id() const;
+ QPointerUniqueId uniqueId() const;
Qt::TouchPointState state() const;
@@ -847,12 +866,14 @@ public:
QRectF screenRect() const;
qreal pressure() const;
+ qreal rotation() const;
QVector2D velocity() const;
InfoFlags flags() const;
QVector<QPointF> rawScreenPositions() const;
// internal
void setId(int id);
+ void setUniqueId(qint64 uid);
void setState(Qt::TouchPointStates state);
void setPos(const QPointF &pos);
void setScenePos(const QPointF &scenePos);
@@ -870,6 +891,7 @@ public:
void setSceneRect(const QRectF &sceneRect);
void setScreenRect(const QRectF &screenRect);
void setPressure(qreal pressure);
+ void setRotation(qreal angle);
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
void setRawScreenPositions(const QVector<QPointF> &positions);
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 726aa05d36..b37045c5d8 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -65,7 +65,8 @@ public:
: ref(1),
id(id),
state(Qt::TouchPointReleased),
- pressure(qreal(-1.))
+ pressure(qreal(-1.)),
+ rotation(qreal(0.))
{ }
inline QTouchEventTouchPointPrivate *detach()
@@ -79,12 +80,14 @@ public:
QAtomicInt ref;
int id;
+ QPointerUniqueId uniqueId;
Qt::TouchPointStates state;
QRectF rect, sceneRect, screenRect;
QPointF normalizedPos,
startPos, startScenePos, startScreenPos, startNormalizedPos,
lastPos, lastScenePos, lastScreenPos, lastNormalizedPos;
qreal pressure;
+ qreal rotation;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
QVector<QPointF> rawScreenPositions;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 137310ffbd..7afeadcced 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -104,13 +104,13 @@
#if defined(Q_OS_MAC)
# include "private/qcore_mac_p.h"
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#elif defined(Q_OS_WIN)
# include <QtCore/qt_windows.h>
# include <QtCore/QLibraryInfo>
# if defined(Q_OS_WINPHONE)
# include <Objbase.h>
# endif
-#endif // Q_OS_WIN && !Q_OS_WINCE
+#endif // Q_OS_WIN
#include <ctype.h>
@@ -656,9 +656,20 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
*/
void QGuiApplication::setApplicationDisplayName(const QString &name)
{
- if (!QGuiApplicationPrivate::displayName)
- QGuiApplicationPrivate::displayName = new QString;
- *QGuiApplicationPrivate::displayName = name;
+ if (!QGuiApplicationPrivate::displayName) {
+ QGuiApplicationPrivate::displayName = new QString(name);
+ if (qGuiApp) {
+ disconnect(qGuiApp, &QGuiApplication::applicationNameChanged,
+ qGuiApp, &QGuiApplication::applicationDisplayNameChanged);
+
+ if (QGuiApplicationPrivate::displayName != applicationName())
+ emit qGuiApp->applicationDisplayNameChanged();
+ }
+ } else if (name != *QGuiApplicationPrivate::displayName) {
+ *QGuiApplicationPrivate::displayName = name;
+ if (qGuiApp)
+ emit qGuiApp->applicationDisplayNameChanged();
+ }
}
QString QGuiApplication::applicationDisplayName()
@@ -1054,7 +1065,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
\li \c eglfs is a platform plugin for running Qt5 applications on top of
EGL and OpenGL ES 2.0 without an actual windowing system (like X11
or Wayland). For more information, see \l{EGLFS}.
- \li \c ios
+ \li \c ios (also used for tvOS)
\li \c kms is an experimental platform plugin using kernel modesetting
and \l{http://dri.freedesktop.org/wiki/DRM}{DRM} (Direct Rendering
Manager).
@@ -1102,12 +1113,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform
keys.join(QStringLiteral(", ")));
}
fatalMessage += QStringLiteral("Reinstalling the application may fix this problem.");
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Windows: Display message box unless it is a console application
// or debug build showing an assert box.
if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow())
MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR);
-#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN && !Q_OS_WINRT
qFatal("%s", qPrintable(fatalMessage));
return;
}
@@ -1186,7 +1197,7 @@ static void init_plugins(const QList<QByteArray> &pluginList)
if (plugin)
QGuiApplicationPrivate::generic_plugin_list.append(plugin);
else
- qWarning() << "No such plugin for spec " << pluginSpec;
+ qWarning("No such plugin for spec \"%s\"", pluginSpec.constData());
}
}
@@ -1310,7 +1321,7 @@ void QGuiApplicationPrivate::init()
#ifndef QT_NO_SESSIONMANAGER
QString session_id;
QString session_key;
-# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+# if defined(Q_OS_WIN)
wchar_t guidstr[40];
GUID guid;
CoCreateGuid(&guid);
@@ -1424,9 +1435,8 @@ void QGuiApplicationPrivate::init()
init_plugins(pluginList);
QWindowSystemInterface::flushWindowSystemEvents();
-#ifndef QT_NO_SESSIONMANAGER
Q_Q(QGuiApplication);
-
+#ifndef QT_NO_SESSIONMANAGER
// connect to the session manager
session_manager = new QSessionManager(q, session_id, session_key);
#endif
@@ -1455,6 +1465,10 @@ void QGuiApplicationPrivate::init()
if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);
+
+ if (!QGuiApplicationPrivate::displayName)
+ QObject::connect(q, &QGuiApplication::applicationNameChanged,
+ q, &QGuiApplication::applicationDisplayNameChanged);
}
extern void qt_cleanupFontDatabase();
@@ -2450,6 +2464,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QWindow *window = e->window.data();
typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents;
+ bool velocityOnly = false;
for (int i = 0; i < e->points.count(); ++i) {
QTouchEvent::TouchPoint touchPoint = e->points.at(i);
@@ -2526,8 +2541,14 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// Stationary points might not be delivered down to the receiving item
// and get their position transformed, keep the old values instead.
- if (touchPoint.state() != Qt::TouchPointStationary)
+ if (touchPoint.state() == Qt::TouchPointStationary) {
+ if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) {
+ touchInfo.touchPoint.setVelocity(touchPoint.velocity());
+ velocityOnly = true;
+ }
+ } else {
touchInfo.touchPoint = touchPoint;
+ }
break;
}
@@ -2561,7 +2582,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
case Qt::TouchPointStationary:
// don't send the event if nothing changed
- continue;
+ if (velocityOnly)
+ eventType = QEvent::TouchUpdate;
+ else
+ continue;
default:
eventType = QEvent::TouchUpdate;
break;
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 10057c5b7f..725d7cb59d 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -72,7 +72,7 @@ class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
{
Q_OBJECT
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
- Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName)
+ Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName NOTIFY applicationDisplayNameChanged)
Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
Q_PROPERTY(QString platformName READ platformName STORED false)
@@ -183,6 +183,7 @@ Q_SIGNALS:
void saveStateRequest(QSessionManager &sessionManager);
#endif
void paletteChanged(const QPalette &pal);
+ void applicationDisplayNameChanged();
protected:
bool event(QEvent *) Q_DECL_OVERRIDE;
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index 4cc9e95e81..d6e467db59 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -68,10 +68,11 @@ static inline qreal initialGlobalScaleFactor()
}
} else {
if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) {
- qWarning() << "Warning:" << legacyDevicePixelEnvVar << "is deprecated. Instead use:" << endl
- << " " << autoScreenEnvVar << "to enable platform plugin controlled per-screen factors." << endl
- << " " << screenFactorsEnvVar << "to set per-screen factors." << endl
- << " " << scaleFactorEnvVar << "to set the application global scale factor.";
+ qWarning("Warning: %s is deprecated. Instead use:\n"
+ " %s to enable platform plugin controlled per-screen factors.\n"
+ " %s to set per-screen factors.\n"
+ " %s to set the application global scale factor.",
+ legacyDevicePixelEnvVar, autoScreenEnvVar, screenFactorsEnvVar, scaleFactorEnvVar);
int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar);
if (dpr > 0)
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index eb3a9d5545..e790e3094f 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -382,8 +382,7 @@ inline QRegion fromNativeLocalRegion(const QRegion &pixelRegion, const QWindow *
qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
- const auto rects = pixelRegion.rects();
- for (const QRect &rect : rects) {
+ for (const QRect &rect : pixelRegion) {
pointRegion += QRect(fromNative(rect.topLeft(), scaleFactor),
fromNative(rect.size(), scaleFactor));
}
@@ -399,7 +398,7 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
const qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pointRegion;
- foreach (const QRect &rect, pixelRegion.rects()) {
+ for (const QRect &rect : pixelRegion) {
const QPointF topLeftP = QPointF(rect.topLeft()) / scaleFactor;
const QPointF bottomRightP = QPointF(rect.bottomRight()) / scaleFactor;
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
@@ -415,8 +414,7 @@ inline QRegion toNativeLocalRegion(const QRegion &pointRegion, const QWindow *wi
qreal scaleFactor = QHighDpiScaling::factor(window);
QRegion pixelRegon;
- const auto rects = pointRegion.rects();
- for (const QRect &rect : rects) {
+ for (const QRect &rect : pointRegion) {
pixelRegon += QRect(toNative(rect.topLeft(), scaleFactor),
toNative(rect.size(), scaleFactor));
}
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 0f7bbfd2e1..7e5697e5d8 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -940,13 +940,20 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
If \a surface is 0 this is equivalent to calling doneCurrent().
- Do not call this function from a different thread than the one the
+ Avoid calling this function from a different thread than the one the
QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a
different thread you should first call make sure it's not current in the
current thread, by calling doneCurrent() if necessary. Then call
moveToThread(otherThread) before using it in the other thread.
- \sa functions(), doneCurrent()
+ By default Qt employs a check that enforces the above condition on the
+ thread affinity. It is still possible to disable this check by setting the
+ \c{Qt::AA_DontCheckOpenGLContextThreadAffinity} application attribute. Be
+ sure to understand the consequences of using QObjects from outside
+ the thread they live in, as explained in the
+ \l{QObject#Thread Affinity}{QObject thread affinity} documentation.
+
+ \sa functions(), doneCurrent(), Qt::AA_DontCheckOpenGLContextThreadAffinity
*/
bool QOpenGLContext::makeCurrent(QSurface *surface)
{
@@ -954,8 +961,10 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
if (!isValid())
return false;
- if (Q_UNLIKELY(thread() != QThread::currentThread()))
+ if (Q_UNLIKELY(!qApp->testAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity)
+ && thread() != QThread::currentThread())) {
qFatal("Cannot make QOpenGLContext current in a different thread");
+ }
if (!surface) {
doneCurrent();
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index fe4d167078..c36186b815 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -156,23 +156,33 @@ public:
QString windowTitle;
};
-QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate)
+QFontDialogOptions::QFontDialogOptions(QFontDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d)
+QFontDialogOptions::~QFontDialogOptions()
{
}
-QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs)
+namespace {
+ struct FontDialogCombined : QFontDialogOptionsPrivate, QFontDialogOptions
+ {
+ FontDialogCombined() : QFontDialogOptionsPrivate(), QFontDialogOptions(this) {}
+ FontDialogCombined(const FontDialogCombined &other)
+ : QFontDialogOptionsPrivate(other), QFontDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QFontDialogOptions> QFontDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<FontDialogCombined>::create();
}
-QFontDialogOptions::~QFontDialogOptions()
+QSharedPointer<QFontDialogOptions> QFontDialogOptions::clone() const
{
+ return QSharedPointer<FontDialogCombined>::create(*static_cast<const FontDialogCombined*>(this));
}
QString QFontDialogOptions::windowTitle() const
@@ -289,23 +299,33 @@ public:
QString windowTitle;
};
-QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate)
+QColorDialogOptions::QColorDialogOptions(QColorDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d)
+QColorDialogOptions::~QColorDialogOptions()
{
}
-QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs)
+namespace {
+ struct ColorDialogCombined : QColorDialogOptionsPrivate, QColorDialogOptions
+ {
+ ColorDialogCombined() : QColorDialogOptionsPrivate(), QColorDialogOptions(this) {}
+ ColorDialogCombined(const ColorDialogCombined &other)
+ : QColorDialogOptionsPrivate(other), QColorDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QColorDialogOptions> QColorDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<ColorDialogCombined>::create();
}
-QColorDialogOptions::~QColorDialogOptions()
+QSharedPointer<QColorDialogOptions> QColorDialogOptions::clone() const
{
+ return QSharedPointer<ColorDialogCombined>::create(*static_cast<const ColorDialogCombined*>(this));
}
QString QColorDialogOptions::windowTitle() const
@@ -436,23 +456,32 @@ public:
QStringList supportedSchemes;
};
-QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate)
+QFileDialogOptions::QFileDialogOptions(QFileDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d)
+QFileDialogOptions::~QFileDialogOptions()
{
}
-QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs)
+namespace {
+ struct FileDialogCombined : QFileDialogOptionsPrivate, QFileDialogOptions
+ {
+ FileDialogCombined() : QFileDialogOptionsPrivate(), QFileDialogOptions(this) {}
+ FileDialogCombined(const FileDialogCombined &other) : QFileDialogOptionsPrivate(other), QFileDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QFileDialogOptions> QFileDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<FileDialogCombined>::create();
}
-QFileDialogOptions::~QFileDialogOptions()
+QSharedPointer<QFileDialogOptions> QFileDialogOptions::clone() const
{
+ return QSharedPointer<FileDialogCombined>::create(*static_cast<const FileDialogCombined*>(this));
}
QString QFileDialogOptions::windowTitle() const
@@ -728,23 +757,33 @@ public:
QPlatformDialogHelper::StandardButtons buttons;
};
-QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate)
+QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd)
+ : d(dd)
{
}
-QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d)
+QMessageDialogOptions::~QMessageDialogOptions()
{
}
-QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs)
+namespace {
+ struct MessageDialogCombined : QMessageDialogOptionsPrivate, QMessageDialogOptions
+ {
+ MessageDialogCombined() : QMessageDialogOptionsPrivate(), QMessageDialogOptions(this) {}
+ MessageDialogCombined(const MessageDialogCombined &other)
+ : QMessageDialogOptionsPrivate(other), QMessageDialogOptions(this) {}
+ };
+}
+
+// static
+QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::create()
{
- if (this != &rhs)
- d = rhs.d;
- return *this;
+ return QSharedPointer<MessageDialogCombined>::create();
}
-QMessageDialogOptions::~QMessageDialogOptions()
+QSharedPointer<QMessageDialogOptions> QMessageDialogOptions::clone() const
{
+ return QSharedPointer<MessageDialogCombined>::create(*static_cast<const MessageDialogCombined*>(this));
}
QString QMessageDialogOptions::windowTitle() const
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 825dcf293d..78667643fe 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -72,6 +72,8 @@ class QFontDialogOptionsPrivate;
class QFileDialogOptionsPrivate;
class QMessageDialogOptionsPrivate;
+#define QPLATFORMDIALOGHELPERS_HAS_CREATE
+
class Q_GUI_EXPORT QPlatformDialogHelper : public QObject
{
Q_OBJECT
@@ -176,6 +178,10 @@ QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QColorDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QColorDialogOptions)
+protected:
+ explicit QColorDialogOptions(QColorDialogOptionsPrivate *dd);
+ ~QColorDialogOptions();
public:
enum ColorDialogOption {
ShowAlphaChannel = 0x00000001,
@@ -186,12 +192,8 @@ public:
Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
Q_FLAG(ColorDialogOptions)
- QColorDialogOptions();
- QColorDialogOptions(const QColorDialogOptions &rhs);
- QColorDialogOptions &operator=(const QColorDialogOptions &rhs);
- ~QColorDialogOptions();
-
- void swap(QColorDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QColorDialogOptions> create();
+ QSharedPointer<QColorDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -211,11 +213,9 @@ public:
static void setStandardColor(int index, QRgb color);
private:
- QSharedDataPointer<QColorDialogOptionsPrivate> d;
+ QColorDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QColorDialogOptions)
-
class Q_GUI_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
@@ -237,6 +237,11 @@ private:
class Q_GUI_EXPORT QFontDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QFontDialogOptions)
+protected:
+ explicit QFontDialogOptions(QFontDialogOptionsPrivate *dd);
+ ~QFontDialogOptions();
+
public:
enum FontDialogOption {
NoButtons = 0x00000001,
@@ -250,12 +255,8 @@ public:
Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
Q_FLAG(FontDialogOptions)
- QFontDialogOptions();
- QFontDialogOptions(const QFontDialogOptions &rhs);
- QFontDialogOptions &operator=(const QFontDialogOptions &rhs);
- ~QFontDialogOptions();
-
- void swap(QFontDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QFontDialogOptions> create();
+ QSharedPointer<QFontDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -266,11 +267,9 @@ public:
FontDialogOptions options() const;
private:
- QSharedDataPointer<QFontDialogOptionsPrivate> d;
+ QFontDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QFontDialogOptions)
-
class Q_GUI_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
@@ -292,6 +291,11 @@ private:
class Q_GUI_EXPORT QFileDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QFileDialogOptions)
+protected:
+ QFileDialogOptions(QFileDialogOptionsPrivate *dd);
+ ~QFileDialogOptions();
+
public:
enum ViewMode { Detail, List };
Q_ENUM(ViewMode)
@@ -319,12 +323,8 @@ public:
Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
Q_FLAG(FileDialogOptions)
- QFileDialogOptions();
- QFileDialogOptions(const QFileDialogOptions &rhs);
- QFileDialogOptions &operator=(const QFileDialogOptions &rhs);
- ~QFileDialogOptions();
-
- void swap(QFileDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QFileDialogOptions> create();
+ QSharedPointer<QFileDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -383,11 +383,9 @@ public:
static QString defaultNameFilterString();
private:
- QSharedDataPointer<QFileDialogOptionsPrivate> d;
+ QFileDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QFileDialogOptions)
-
class Q_GUI_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
@@ -423,17 +421,18 @@ private:
class Q_GUI_EXPORT QMessageDialogOptions
{
Q_GADGET
+ Q_DISABLE_COPY(QMessageDialogOptions)
+protected:
+ QMessageDialogOptions(QMessageDialogOptionsPrivate *dd);
+ ~QMessageDialogOptions();
+
public:
// Keep in sync with QMessageBox::Icon
enum Icon { NoIcon, Information, Warning, Critical, Question };
Q_ENUM(Icon)
- QMessageDialogOptions();
- QMessageDialogOptions(const QMessageDialogOptions &rhs);
- QMessageDialogOptions &operator=(const QMessageDialogOptions &rhs);
- ~QMessageDialogOptions();
-
- void swap(QMessageDialogOptions &other) { qSwap(d, other.d); }
+ static QSharedPointer<QMessageDialogOptions> create();
+ QSharedPointer<QMessageDialogOptions> clone() const;
QString windowTitle() const;
void setWindowTitle(const QString &);
@@ -454,11 +453,9 @@ public:
QPlatformDialogHelper::StandardButtons standardButtons() const;
private:
- QSharedDataPointer<QMessageDialogOptionsPrivate> d;
+ QMessageDialogOptionsPrivate *d;
};
-Q_DECLARE_SHARED(QMessageDialogOptions)
-
class Q_GUI_EXPORT QPlatformMessageDialogHelper : public QPlatformDialogHelper
{
Q_OBJECT
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 00b8e05f30..2cb9b8053f 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -469,7 +469,10 @@ QList<QTouchEvent::TouchPoint>
QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
p.setId(point->id);
+ if (point->uniqueId >= 0)
+ p.setUniqueId(point->uniqueId);
p.setPressure(point->pressure);
+ p.setRotation(point->rotation);
states |= point->state;
p.setState(point->state);
@@ -917,6 +920,17 @@ Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int
#endif
}
+namespace QTest
+{
+ Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen)
+ {
+ QTouchDevice *ret = new QTouchDevice();
+ ret->setType(devType);
+ QWindowSystemInterface::registerTouchDevice(ret);
+ return ret;
+ }
+}
+
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<QTouchEvent::TouchPoint> &points,
Qt::KeyboardModifiers mods = Qt::NoModifier)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 00437e8341..5e42f5ba90 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -117,11 +117,14 @@ public:
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
struct TouchPoint {
- TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary) { }
+ TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { }
int id; // for application use
+ qint64 uniqueId; // for TUIO: object/token ID; otherwise empty
+ // TODO for TUIO 2.0: add registerPointerUniqueID(QPointerUniqueId)
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1
+ qreal rotation; // 0 means pointing straight up; 0 if unknown (like QTabletEvent::rotation)
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
QVector2D velocity; // in screen coordinate system, pixels / seconds
QTouchEvent::TouchPoint::InfoFlags flags;
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index 5f9d78b780..fa671ea60a 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -119,10 +119,8 @@ typedef char GLchar;
#else // non-ES2 platforms
# if defined(Q_OS_MAC)
# include <OpenGL/gl.h>
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
-# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
-# include <OpenGL/gl3.h>
-# endif
+# define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
+# include <OpenGL/gl3.h>
# include <OpenGL/glext.h>
# else
# define GL_GLEXT_LEGACY // Prevents GL/gl.h from #including system glext.h
@@ -131,16 +129,11 @@ typedef char GLchar;
# endif // Q_OS_MAC
#endif // QT_OPENGL_ES_2
-// Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3.
-// Desktops, apart from Mac OS X prior to 10.9 can support OpenGL 4.
+// Desktops can support OpenGL 4.
#if !defined(QT_OPENGL_ES_2)
-# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
-# define QT_OPENGL_3
-# define QT_OPENGL_3_2
-# endif
-# if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
-# define QT_OPENGL_4
-# endif
+#define QT_OPENGL_3
+#define QT_OPENGL_3_2
+#define QT_OPENGL_4
# if !defined(Q_OS_MAC)
# define QT_OPENGL_4_3
# endif
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index 4e3d14ba37..1d3e47f93b 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -390,7 +390,7 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO
fragShader->setObjectName(QString::fromLatin1(description));
#endif
if (!fragShader->compileSourceCode(fragSource)) {
- qWarning() << "Warning:" << description << "failed to compile!";
+ qWarning("Warning: \"%s\" failed to compile!", description.constData());
break;
}
@@ -405,7 +405,7 @@ QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QO
vertexShader->setObjectName(QString::fromLatin1(description));
#endif
if (!vertexShader->compileSourceCode(vertexSource)) {
- qWarning() << "Warning:" << description << "failed to compile!";
+ qWarning("Warning: \"%s\" failed to compile!", description.constData());
break;
}
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index aa0520f695..303d4d4eb1 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -856,10 +856,8 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
\sa size(), texture()
*/
QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum target)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
+ : QOpenGLFramebufferObject(QSize(width, height), target)
{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, QSize(width, height), NoAttachment, target, effectiveInternalFormat(0));
}
/*! \overload
@@ -883,11 +881,8 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpe
*/
QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format)
- : d_ptr(new QOpenGLFramebufferObjectPrivate)
+ : QOpenGLFramebufferObject(QSize(width, height), format)
{
- Q_D(QOpenGLFramebufferObject);
- d->init(this, QSize(width, height), format.attachment(), format.textureTarget(),
- format.internalTextureFormat(), format.samples(), format.mipmap());
}
/*! \overload
diff --git a/src/gui/opengl/qopenglfunctions_1_0.cpp b/src/gui/opengl/qopenglfunctions_1_0.cpp
index 9d5a76380a..4235c9a339 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_0.cpp
@@ -74,12 +74,14 @@ QOpenGLFunctions_1_0::QOpenGLFunctions_1_0()
QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_1.cpp b/src/gui/opengl/qopenglfunctions_1_1.cpp
index 57385f1927..7d09bb40c1 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_1.cpp
@@ -76,18 +76,22 @@ QOpenGLFunctions_1_1::QOpenGLFunctions_1_1()
QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_2.cpp b/src/gui/opengl/qopenglfunctions_1_2.cpp
index 9eaa13862d..94a9d64660 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_2.cpp
@@ -78,24 +78,30 @@ QOpenGLFunctions_1_2::QOpenGLFunctions_1_2()
QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_3.cpp b/src/gui/opengl/qopenglfunctions_1_3.cpp
index 6211997302..972ef9ff70 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_3.cpp
@@ -80,30 +80,38 @@ QOpenGLFunctions_1_3::QOpenGLFunctions_1_3()
QOpenGLFunctions_1_3::~QOpenGLFunctions_1_3()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_3::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_4.cpp b/src/gui/opengl/qopenglfunctions_1_4.cpp
index 5ff2c24014..4b78253301 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_4.cpp
@@ -82,36 +82,46 @@ QOpenGLFunctions_1_4::QOpenGLFunctions_1_4()
QOpenGLFunctions_1_4::~QOpenGLFunctions_1_4()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_4::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_1_5.cpp b/src/gui/opengl/qopenglfunctions_1_5.cpp
index d07f1decec..2a0820d0cb 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.cpp
+++ b/src/gui/opengl/qopenglfunctions_1_5.cpp
@@ -83,39 +83,50 @@ QOpenGLFunctions_1_5::QOpenGLFunctions_1_5()
QOpenGLFunctions_1_5::~QOpenGLFunctions_1_5()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_1_5::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp
index b7dc8ef458..c175b13c5b 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_0.cpp
@@ -85,42 +85,54 @@ QOpenGLFunctions_2_0::QOpenGLFunctions_2_0()
QOpenGLFunctions_2_0::~QOpenGLFunctions_2_0()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_2_0::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp
index e756685d10..4e77efd121 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_1.cpp
@@ -86,45 +86,58 @@ QOpenGLFunctions_2_1::QOpenGLFunctions_2_1()
QOpenGLFunctions_2_1::~QOpenGLFunctions_2_1()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_2_1::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp
index ee7f92855d..09e3ad09ef 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_0.cpp
@@ -88,48 +88,62 @@ QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
QOpenGLFunctions_3_0::~QOpenGLFunctions_3_0()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_3_0::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_1.cpp b/src/gui/opengl/qopenglfunctions_3_1.cpp
index a459ddf244..9328f5ca89 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_1.cpp
@@ -82,36 +82,46 @@ QOpenGLFunctions_3_1::QOpenGLFunctions_3_1()
QOpenGLFunctions_3_1::~QOpenGLFunctions_3_1()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
}
bool QOpenGLFunctions_3_1::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
index 09402db09a..b90a123bfe 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
@@ -90,54 +90,70 @@ QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility()
QOpenGLFunctions_3_2_Compatibility::~QOpenGLFunctions_3_2_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_3_2_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.cpp b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
index 177dc9e25d..02c0c78b01 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.cpp
@@ -83,39 +83,50 @@ QOpenGLFunctions_3_2_Core::QOpenGLFunctions_3_2_Core()
QOpenGLFunctions_3_2_Core::~QOpenGLFunctions_3_2_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
}
bool QOpenGLFunctions_3_2_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
index 110a49ea53..c585f0fc7c 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
@@ -91,60 +91,78 @@ QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility()
QOpenGLFunctions_3_3_Compatibility::~QOpenGLFunctions_3_3_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_3_3_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.cpp b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
index 2e706724d9..7779d92b6a 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.cpp
@@ -84,42 +84,54 @@ QOpenGLFunctions_3_3_Core::QOpenGLFunctions_3_3_Core()
QOpenGLFunctions_3_3_Core::~QOpenGLFunctions_3_3_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
}
bool QOpenGLFunctions_3_3_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
index 14fb168c94..b5c423ef0c 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
@@ -92,63 +92,82 @@ QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility()
QOpenGLFunctions_4_0_Compatibility::~QOpenGLFunctions_4_0_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_0_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.cpp b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
index 6dc94153c8..4e4e8cc547 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.cpp
@@ -85,45 +85,58 @@ QOpenGLFunctions_4_0_Core::QOpenGLFunctions_4_0_Core()
QOpenGLFunctions_4_0_Core::~QOpenGLFunctions_4_0_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
index 293409ddef..72c60c74b7 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
@@ -93,66 +93,86 @@ QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility()
QOpenGLFunctions_4_1_Compatibility::~QOpenGLFunctions_4_1_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_1_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.cpp b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
index ff3d191781..5a1e1eb42f 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.cpp
@@ -86,48 +86,62 @@ QOpenGLFunctions_4_1_Core::QOpenGLFunctions_4_1_Core()
QOpenGLFunctions_4_1_Core::~QOpenGLFunctions_4_1_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_1_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
index 58527e92b5..8398ef0948 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
@@ -94,69 +94,90 @@ QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility()
QOpenGLFunctions_4_2_Compatibility::~QOpenGLFunctions_4_2_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_2_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.cpp b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
index b929abcf6a..fdfb4db455 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.cpp
@@ -87,51 +87,66 @@ QOpenGLFunctions_4_2_Core::QOpenGLFunctions_4_2_Core()
QOpenGLFunctions_4_2_Core::~QOpenGLFunctions_4_2_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_2_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
index a9f15083ad..19e67c6331 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
@@ -95,72 +95,94 @@ QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility()
QOpenGLFunctions_4_3_Compatibility::~QOpenGLFunctions_4_3_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_3_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.cpp b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
index d3f988ba0d..95e2d7bc43 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.cpp
@@ -88,54 +88,70 @@ QOpenGLFunctions_4_3_Core::QOpenGLFunctions_4_3_Core()
QOpenGLFunctions_4_3_Core::~QOpenGLFunctions_4_3_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_3_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
index 8cbb94c1a1..a33efd0b95 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.cpp
@@ -95,75 +95,98 @@ QOpenGLFunctions_4_4_Compatibility::QOpenGLFunctions_4_4_Compatibility()
QOpenGLFunctions_4_4_Compatibility::~QOpenGLFunctions_4_4_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_4_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.cpp b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
index 95bfc3a438..019a70087a 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.cpp
@@ -89,57 +89,74 @@ QOpenGLFunctions_4_4_Core::QOpenGLFunctions_4_4_Core()
QOpenGLFunctions_4_4_Core::~QOpenGLFunctions_4_4_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_4_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
index 81ee8559a5..f9d2bb9ceb 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.cpp
@@ -97,81 +97,106 @@ QOpenGLFunctions_4_5_Compatibility::QOpenGLFunctions_4_5_Compatibility()
QOpenGLFunctions_4_5_Compatibility::~QOpenGLFunctions_4_5_Compatibility()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
- if (d_4_5_Core)
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
+ if (d_4_5_Core) {
d_4_5_Core->refs.deref();
- Q_ASSERT(d_4_5_Core->refs.load());
- if (d_1_0_Deprecated)
+ Q_ASSERT(d_4_5_Core->refs.load());
+ }
+ if (d_1_0_Deprecated) {
d_1_0_Deprecated->refs.deref();
- Q_ASSERT(d_1_0_Deprecated->refs.load());
- if (d_1_1_Deprecated)
+ Q_ASSERT(d_1_0_Deprecated->refs.load());
+ }
+ if (d_1_1_Deprecated) {
d_1_1_Deprecated->refs.deref();
- Q_ASSERT(d_1_1_Deprecated->refs.load());
- if (d_1_2_Deprecated)
+ Q_ASSERT(d_1_1_Deprecated->refs.load());
+ }
+ if (d_1_2_Deprecated) {
d_1_2_Deprecated->refs.deref();
- Q_ASSERT(d_1_2_Deprecated->refs.load());
- if (d_1_3_Deprecated)
+ Q_ASSERT(d_1_2_Deprecated->refs.load());
+ }
+ if (d_1_3_Deprecated) {
d_1_3_Deprecated->refs.deref();
- Q_ASSERT(d_1_3_Deprecated->refs.load());
- if (d_1_4_Deprecated)
+ Q_ASSERT(d_1_3_Deprecated->refs.load());
+ }
+ if (d_1_4_Deprecated) {
d_1_4_Deprecated->refs.deref();
- Q_ASSERT(d_1_4_Deprecated->refs.load());
- if (d_3_3_Deprecated)
+ Q_ASSERT(d_1_4_Deprecated->refs.load());
+ }
+ if (d_3_3_Deprecated) {
d_3_3_Deprecated->refs.deref();
- Q_ASSERT(d_3_3_Deprecated->refs.load());
- if (d_4_5_Deprecated)
+ Q_ASSERT(d_3_3_Deprecated->refs.load());
+ }
+ if (d_4_5_Deprecated) {
d_4_5_Deprecated->refs.deref();
- Q_ASSERT(d_4_5_Deprecated->refs.load());
+ Q_ASSERT(d_4_5_Deprecated->refs.load());
+ }
}
bool QOpenGLFunctions_4_5_Compatibility::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.cpp b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
index 2fdb9ef855..27c0223cf9 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.cpp
@@ -90,60 +90,78 @@ QOpenGLFunctions_4_5_Core::QOpenGLFunctions_4_5_Core()
QOpenGLFunctions_4_5_Core::~QOpenGLFunctions_4_5_Core()
{
- if (d_1_0_Core)
+ if (d_1_0_Core) {
d_1_0_Core->refs.deref();
- Q_ASSERT(d_1_0_Core->refs.load());
- if (d_1_1_Core)
+ Q_ASSERT(d_1_0_Core->refs.load());
+ }
+ if (d_1_1_Core) {
d_1_1_Core->refs.deref();
- Q_ASSERT(d_1_1_Core->refs.load());
- if (d_1_2_Core)
+ Q_ASSERT(d_1_1_Core->refs.load());
+ }
+ if (d_1_2_Core) {
d_1_2_Core->refs.deref();
- Q_ASSERT(d_1_2_Core->refs.load());
- if (d_1_3_Core)
+ Q_ASSERT(d_1_2_Core->refs.load());
+ }
+ if (d_1_3_Core) {
d_1_3_Core->refs.deref();
- Q_ASSERT(d_1_3_Core->refs.load());
- if (d_1_4_Core)
+ Q_ASSERT(d_1_3_Core->refs.load());
+ }
+ if (d_1_4_Core) {
d_1_4_Core->refs.deref();
- Q_ASSERT(d_1_4_Core->refs.load());
- if (d_1_5_Core)
+ Q_ASSERT(d_1_4_Core->refs.load());
+ }
+ if (d_1_5_Core) {
d_1_5_Core->refs.deref();
- Q_ASSERT(d_1_5_Core->refs.load());
- if (d_2_0_Core)
+ Q_ASSERT(d_1_5_Core->refs.load());
+ }
+ if (d_2_0_Core) {
d_2_0_Core->refs.deref();
- Q_ASSERT(d_2_0_Core->refs.load());
- if (d_2_1_Core)
+ Q_ASSERT(d_2_0_Core->refs.load());
+ }
+ if (d_2_1_Core) {
d_2_1_Core->refs.deref();
- Q_ASSERT(d_2_1_Core->refs.load());
- if (d_3_0_Core)
+ Q_ASSERT(d_2_1_Core->refs.load());
+ }
+ if (d_3_0_Core) {
d_3_0_Core->refs.deref();
- Q_ASSERT(d_3_0_Core->refs.load());
- if (d_3_1_Core)
+ Q_ASSERT(d_3_0_Core->refs.load());
+ }
+ if (d_3_1_Core) {
d_3_1_Core->refs.deref();
- Q_ASSERT(d_3_1_Core->refs.load());
- if (d_3_2_Core)
+ Q_ASSERT(d_3_1_Core->refs.load());
+ }
+ if (d_3_2_Core) {
d_3_2_Core->refs.deref();
- Q_ASSERT(d_3_2_Core->refs.load());
- if (d_3_3_Core)
+ Q_ASSERT(d_3_2_Core->refs.load());
+ }
+ if (d_3_3_Core) {
d_3_3_Core->refs.deref();
- Q_ASSERT(d_3_3_Core->refs.load());
- if (d_4_0_Core)
+ Q_ASSERT(d_3_3_Core->refs.load());
+ }
+ if (d_4_0_Core) {
d_4_0_Core->refs.deref();
- Q_ASSERT(d_4_0_Core->refs.load());
- if (d_4_1_Core)
+ Q_ASSERT(d_4_0_Core->refs.load());
+ }
+ if (d_4_1_Core) {
d_4_1_Core->refs.deref();
- Q_ASSERT(d_4_1_Core->refs.load());
- if (d_4_2_Core)
+ Q_ASSERT(d_4_1_Core->refs.load());
+ }
+ if (d_4_2_Core) {
d_4_2_Core->refs.deref();
- Q_ASSERT(d_4_2_Core->refs.load());
- if (d_4_3_Core)
+ Q_ASSERT(d_4_2_Core->refs.load());
+ }
+ if (d_4_3_Core) {
d_4_3_Core->refs.deref();
- Q_ASSERT(d_4_3_Core->refs.load());
- if (d_4_4_Core)
+ Q_ASSERT(d_4_3_Core->refs.load());
+ }
+ if (d_4_4_Core) {
d_4_4_Core->refs.deref();
- Q_ASSERT(d_4_4_Core->refs.load());
- if (d_4_5_Core)
+ Q_ASSERT(d_4_4_Core->refs.load());
+ }
+ if (d_4_5_Core) {
d_4_5_Core->refs.deref();
- Q_ASSERT(d_4_5_Core->refs.load());
+ Q_ASSERT(d_4_5_Core->refs.load());
+ }
}
bool QOpenGLFunctions_4_5_Core::initializeOpenGLFunctions()
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 75f09d6031..e539ee0e31 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -137,7 +137,7 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size)
\sa QOpenGLContext::currentContext()
*/
QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height)
- : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height)))
+ : QOpenGLPaintDevice(QSize(width, height))
{
}
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index d93871c99b..5c05a05d80 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1012,11 +1012,11 @@ void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
funcs.glStencilMask(0xff); // Enable stencil writes
if (dirtyStencilRegion.intersects(currentScissorBounds)) {
- QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects();
+ const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds);
funcs.glClearStencil(0); // Clear to zero
- for (int i = 0; i < clearRegion.size(); ++i) {
+ for (const QRect &rect : clearRegion) {
#ifndef QT_GL_NO_SCISSOR_TEST
- setScissor(clearRegion.at(i));
+ setScissor(rect);
#endif
funcs.glClear(GL_STENCIL_BUFFER_BIT);
}
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 4134513210..f076e10e20 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -337,9 +337,10 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
// Dump the source code if we got it
if (sourceCodeBuffer) {
- qWarning("*** Problematic %s shader source code ***", type);
- qWarning() << qPrintable(QString::fromLatin1(sourceCodeBuffer));
- qWarning("***");
+ qWarning("*** Problematic %s shader source code ***\n"
+ "%ls\n"
+ "***",
+ type, qUtf16Printable(QString::fromLatin1(sourceCodeBuffer)));
}
// Cleanup
@@ -1215,8 +1216,7 @@ int QOpenGLShaderProgram::attributeLocation(const char *name) const
if (d->linked && d->programGuard && d->programGuard->id()) {
return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name);
} else {
- qWarning() << "QOpenGLShaderProgram::attributeLocation(" << name
- << "): shader program is not linked";
+ qWarning("QOpenGLShaderProgram::attributeLocation(%s): shader program is not linked", name);
return -1;
}
}
@@ -1479,7 +1479,7 @@ void QOpenGLShaderProgram::setAttributeValue
Q_D(QOpenGLShaderProgram);
Q_UNUSED(d);
if (rows < 1 || rows > 4) {
- qWarning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported";
+ qWarning("QOpenGLShaderProgram::setAttributeValue: rows %d not supported", rows);
return;
}
if (location != -1) {
@@ -1891,8 +1891,7 @@ int QOpenGLShaderProgram::uniformLocation(const char *name) const
if (d->linked && d->programGuard && d->programGuard->id()) {
return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name);
} else {
- qWarning() << "QOpenGLShaderProgram::uniformLocation(" << name
- << "): shader program is not linked";
+ qWarning("QOpenGLShaderProgram::uniformLocation(%s): shader program is not linked", name);
return -1;
}
}
@@ -2819,7 +2818,7 @@ void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *val
else if (tupleSize == 4)
d->glfuncs->glUniform4fv(location, count, values);
else
- qWarning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
+ qWarning("QOpenGLShaderProgram::setUniformValue: size %d not supported", tupleSize);
}
}
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 1db61b7ca1..0a46eea85d 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -2216,7 +2216,7 @@ QOpenGLTexture::QOpenGLTexture(Target target)
OpenGL context.
*/
QOpenGLTexture::QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps)
- : d_ptr(new QOpenGLTexturePrivate(QOpenGLTexture::Target2D, this))
+ : QOpenGLTexture(QOpenGLTexture::Target2D)
{
setData(image, genMipMaps);
}
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 283b6643b9..2f927aeddb 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -104,8 +104,8 @@ AVX2_SOURCES += painting/qdrawhelper_avx2.cpp
NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp
NEON_HEADERS += painting/qdrawhelper_neon_p.h
NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S
-!ios:contains(QT_ARCH, "arm"): CONFIG+=no_clang_integrated_as
-!ios:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS
+!uikit:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as
+!uikit:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS
MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp
MIPS_DSP_HEADERS += painting/qdrawhelper_mips_dsp_p.h painting/qt_mips_asm_dsp_p.h
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 3a296ac40c..ee1f01e850 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -458,13 +458,8 @@ QBrush::QBrush(const QImage &image)
*/
QBrush::QBrush(Qt::BrushStyle style)
+ : QBrush(QColor(Qt::black), style)
{
- if (qbrush_check_type(style))
- init(Qt::black, style);
- else {
- d.reset(nullBrushInstance());
- d->ref.ref();
- }
}
/*!
@@ -491,13 +486,8 @@ QBrush::QBrush(const QColor &color, Qt::BrushStyle style)
\sa setColor(), setStyle()
*/
QBrush::QBrush(Qt::GlobalColor color, Qt::BrushStyle style)
+ : QBrush(QColor(color), style)
{
- if (qbrush_check_type(style))
- init(color, style);
- else {
- d.reset(nullBrushInstance());
- d->ref.ref();
- }
}
/*!
@@ -1673,13 +1663,8 @@ QLinearGradient::QLinearGradient(const QPointF &start, const QPointF &finalStop)
\sa QGradient::setColorAt(), QGradient::setStops()
*/
QLinearGradient::QLinearGradient(qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop)
+ : QLinearGradient(QPointF(xStart, yStart), QPointF(xFinalStop, yFinalStop))
{
- m_type = LinearGradient;
- m_spread = PadSpread;
- m_data.linear.x1 = xStart;
- m_data.linear.y1 = yStart;
- m_data.linear.x2 = xFinalStop;
- m_data.linear.y2 = yFinalStop;
}
@@ -1882,19 +1867,8 @@ QRadialGradient::QRadialGradient(const QPointF &center, qreal radius)
*/
QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy)
+ : QRadialGradient(QPointF(cx, cy), radius, QPointF(fx, fy))
{
- m_type = RadialGradient;
- m_spread = PadSpread;
- m_data.radial.cx = cx;
- m_data.radial.cy = cy;
- m_data.radial.cradius = radius;
-
- QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(QPointF(cx, cy),
- radius,
- QPointF(fx, fy));
-
- m_data.radial.fx = adapted_focal.x();
- m_data.radial.fy = adapted_focal.y();
}
/*!
@@ -1904,14 +1878,8 @@ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qre
\sa QGradient::setColorAt(), QGradient::setStops()
*/
QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius)
+ : QRadialGradient(QPointF(cx, cy), radius)
{
- m_type = RadialGradient;
- m_spread = PadSpread;
- m_data.radial.cx = cx;
- m_data.radial.cy = cy;
- m_data.radial.cradius = radius;
- m_data.radial.fx = cx;
- m_data.radial.fy = cy;
}
@@ -2211,12 +2179,8 @@ QConicalGradient::QConicalGradient(const QPointF &center, qreal angle)
*/
QConicalGradient::QConicalGradient(qreal cx, qreal cy, qreal angle)
+ : QConicalGradient(QPointF(cx, cy), angle)
{
- m_type = ConicalGradient;
- m_spread = PadSpread;
- m_data.conical.cx = cx;
- m_data.conical.cy = cy;
- m_data.conical.angle = angle;
}
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 20dd8d7f82..269e6f2d97 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -261,7 +261,7 @@ QT_BEGIN_NAMESPACE
alpha-channel to feature \l {QColor#Alpha-Blended
Drawing}{alpha-blended drawing}.
- \sa QPalette, QBrush, QApplication::setColorSpec()
+ \sa QPalette, QBrush
*/
#define QCOLOR_INT_RANGE_CHECK(fn, var) \
diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index 9312ee9540..8d4ea58c39 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -87,6 +87,32 @@ QT_BEGIN_NAMESPACE
}\
}
+#if defined __SSE2__
+# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
+# define CONVERT(value) _mm_shufflelo_epi16(_mm_cvtsi32_si128(value), _MM_SHUFFLE(0, 0, 0, 0))
+# define STORE(ptr, value) _mm_storel_epi64(reinterpret_cast<__m128i *>(ptr), value)
+# define ADD(p, q) _mm_add_epi32(p, q)
+# define ALPHA(c) _mm_shufflelo_epi16(c, _MM_SHUFFLE(3, 3, 3, 3))
+# define CONST(n) CONVERT(n)
+# define INVALPHA(c) _mm_sub_epi32(CONST(65535), ALPHA(c))
+#elif defined __ARM_NEON__
+# define LOAD(ptr) vreinterpret_u16_u64(vld1_u64(reinterpret_cast<const uint64_t *>(ptr)))
+# define CONVERT(value) vreinterpret_u16_u64(vmov_n_u64(value))
+# define STORE(ptr, value) vst1_u64(reinterpret_cast<uint64_t *>(ptr), vreinterpret_u64_u16(value))
+# define ADD(p, q) vadd_u16(p, q)
+# define ALPHA(c) vdup_lane_u16(c, 3)
+# define CONST(n) vdup_n_u16(n)
+# define INVALPHA(c) vmvn_u16(ALPHA(c))
+#else
+# define LOAD(ptr) *ptr
+# define CONVERT(value) value
+# define STORE(ptr, value) *ptr = value
+# define ADD(p, q) (p + q)
+# define ALPHA(c) (c).alpha()
+# define CONST(n) n
+# define INVALPHA(c) (65535 - ALPHA(c))
+#endif
+
void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
{
comp_func_Clear_impl(dest, length, const_alpha);
@@ -99,7 +125,7 @@ void QT_FASTCALL comp_func_solid_Clear_rgb64(QRgba64 *dest, int length, QRgba64,
else {
int ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha255(dest[i], ialpha);
+ STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
}
}
}
@@ -116,7 +142,7 @@ void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int lengt
else {
int ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha255(dest[i], ialpha);
+ STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
}
}
}
@@ -146,9 +172,9 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
qt_memfill64((quint64*)dest, color, length);
else {
int ialpha = 255 - const_alpha;
- color = multiplyAlpha255(color, const_alpha);
+ auto c = multiplyAlpha255(CONVERT(color), const_alpha);
for (int i = 0; i < length; ++i) {
- dest[i] = color + multiplyAlpha255(dest[i], ialpha);
+ STORE(&dest[i], ADD(c, multiplyAlpha255(LOAD(&dest[i]), ialpha)));
}
}
}
@@ -174,7 +200,7 @@ void QT_FASTCALL comp_func_Source_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRg
else {
int ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- dest[i] = interpolate255(src[i], const_alpha, dest[i], ialpha);
+ STORE(&dest[i], interpolate255(LOAD(&src[i]), const_alpha, LOAD(&dest[i]), ialpha));
}
}
}
@@ -221,10 +247,12 @@ void QT_FASTCALL comp_func_solid_SourceOver_rgb64(QRgba64 *dest, int length, QRg
if (const_alpha == 255 && color.isOpaque()) {
qt_memfill64((quint64*)dest, color, length);
} else {
+ auto c = CONVERT(color);
if (const_alpha != 255)
- color = multiplyAlpha255(color, const_alpha);
+ c = multiplyAlpha255(c, const_alpha);
+ auto cAlpha = INVALPHA(c);
for (int i = 0; i < length; ++i) {
- dest[i] = color + multiplyAlpha65535(dest[i], 65535 - color.alpha());
+ STORE(&dest[i], ADD(c, multiplyAlpha65535(LOAD(&dest[i]), cAlpha)));
}
}
}
@@ -258,12 +286,12 @@ void QT_FASTCALL comp_func_SourceOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const
if (s.isOpaque())
dest[i] = s;
else if (!s.isTransparent())
- dest[i] = s + multiplyAlpha65535(dest[i], 65535 - s.alpha());
+ STORE(&dest[i], ADD(CONVERT(s), multiplyAlpha65535(LOAD(&dest[i]), 65535 - s.alpha())));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = s + multiplyAlpha65535(dest[i], 65535 - s.alpha());
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], ADD(s, multiplyAlpha65535(LOAD(&dest[i]), INVALPHA(s))));
}
}
}
@@ -287,11 +315,12 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co
void QT_FASTCALL comp_func_solid_DestinationOver_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
+ auto c = CONVERT(color);
if (const_alpha != 255)
- color = multiplyAlpha255(color, const_alpha);
+ c = multiplyAlpha255(c, const_alpha);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = d + multiplyAlpha65535(color, 65535 - d.alpha());
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], ADD(d, multiplyAlpha65535(c, INVALPHA(d))));
}
}
@@ -318,14 +347,14 @@ void QT_FASTCALL comp_func_DestinationOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = d + multiplyAlpha65535(src[i], 65535 - d.alpha());
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], ADD(d, multiplyAlpha65535(LOAD(&src[i]), INVALPHA(d))));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = d + multiplyAlpha65535(s, 65535 - d.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], ADD(d, multiplyAlpha65535(s, INVALPHA(d))));
}
}
}
@@ -393,15 +422,15 @@ void QT_FASTCALL comp_func_SourceIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const Q
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(src[i], dest[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&src[i]), dest[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
- uint cia = 65535 - ca;
+ auto cia = CONST(65535 - ca);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha65535(src[i], ca);
- dest[i] = interpolate65535(s, d.alpha(), d, cia);
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha65535(LOAD(&src[i]), ca);
+ STORE(&dest[i], interpolate65535(s, ALPHA(d), d, cia));
}
}
}
@@ -431,7 +460,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn_rgb64(QRgba64 *dest, int length,
if (const_alpha != 255)
a = qt_div_65535(a * ca64k) + 65535 - ca64k;
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(dest[i], a);
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), a));
}
}
@@ -885,14 +914,19 @@ void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint c
void QT_FASTCALL comp_func_solid_Plus_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
+ auto b = CONVERT(color);
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = addWithSaturation(dest[i], color);
+ auto a = LOAD(&dest[i]);
+ a = addWithSaturation(a, b);
+ STORE(&dest[i], a);
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = addWithSaturation(dest[i], color);
- dest[i] = interpolate255(d, const_alpha, dest[i], 255 - const_alpha);
+ auto a = LOAD(&dest[i]);
+ auto d = addWithSaturation(a, b);
+ a = interpolate255(d, const_alpha, a, 255 - const_alpha);
+ STORE(&dest[i], a);
}
}
}
@@ -924,12 +958,18 @@ void QT_FASTCALL comp_func_Plus_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = addWithSaturation(dest[i], src[i]);
+ auto a = LOAD(&dest[i]);
+ auto b = LOAD(&src[i]);
+ a = addWithSaturation(a, b);
+ STORE(&dest[i], a);
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = addWithSaturation(dest[i], src[i]);
- dest[i] = interpolate255(d, const_alpha, dest[i], 255 - const_alpha);
+ auto a = LOAD(&dest[i]);
+ auto b = LOAD(&src[i]);
+ auto d = addWithSaturation(a, b);
+ a = interpolate255(d, const_alpha, a, 255 - const_alpha);
+ STORE(&dest[i], a);
}
}
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index a325ee923e..b452019251 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -168,7 +168,7 @@ template<> Q_DECL_CONSTEXPR QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB66
template<QImage::Format Format>
static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
@@ -198,7 +198,7 @@ static const uint *QT_FASTCALL convertToRGB32(uint *buffer, const uint *src, int
template<QImage::Format Format>
static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1);
@@ -228,7 +228,7 @@ static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *sr
template<QImage::Format Format>
static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
@@ -282,7 +282,7 @@ static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint
template<QImage::Format Format>
static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1);
Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1);
@@ -336,48 +336,110 @@ static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const
template<QImage::Format Format, bool fromRGB>
static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *dither)
{
- Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1);
+ Q_CONSTEXPR uchar rWidth = redWidth<Format>();
+ Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
+ Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
+ // RGB32 -> RGB888 is not a precision loss.
+ if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) {
+ Q_CONSTEXPR uint rMask = (1 << rWidth) - 1;
+ Q_CONSTEXPR uint gMask = (1 << gWidth) - 1;
+ Q_CONSTEXPR uint bMask = (1 << bWidth) - 1;
- for (int i = 0; i < count; ++i) {
- const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
- const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
- const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
- const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
- buffer[i] = r | g | b;
+ Q_CONSTEXPR uchar rRightShift = 24 - rWidth;
+ Q_CONSTEXPR uchar gRightShift = 16 - gWidth;
+ Q_CONSTEXPR uchar bRightShift = 8 - bWidth;
+
+ for (int i = 0; i < count; ++i) {
+ const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
+ const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
+ const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
+ const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
+ buffer[i] = r | g | b;
+ }
+ } else {
+ // We do ordered dither by using a rounding conversion, but instead of
+ // adding half of input precision, we add the adjusted result from the
+ // bayer matrix before narrowing.
+ // Note: Rounding conversion in itself is different from the naive
+ // conversion we do above for non-dithering.
+ const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
+ for (int i = 0; i < count; ++i) {
+ const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]);
+ const int d = bayer_line[(dither->x + i) & 15];
+ const int dr = d - ((d + 1) >> rWidth);
+ const int dg = d - ((d + 1) >> gWidth);
+ const int db = d - ((d + 1) >> bWidth);
+ int r = qRed(c);
+ int g = qGreen(c);
+ int b = qBlue(c);
+ r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
+ g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
+ b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
+ buffer[i] = (r << redShift<Format>())
+ | (g << greenShift<Format>())
+ | (b << blueShift<Format>());
+ }
}
return buffer;
}
template<QImage::Format Format, bool fromRGB>
static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *dither)
{
- Q_CONSTEXPR uint aMask = ((1 << alphaWidth<Format>()) - 1);
- Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1);
- Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1);
- Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1);
+ Q_CONSTEXPR uchar aWidth = alphaWidth<Format>();
+ Q_CONSTEXPR uchar rWidth = redWidth<Format>();
+ Q_CONSTEXPR uchar gWidth = greenWidth<Format>();
+ Q_CONSTEXPR uchar bWidth = blueWidth<Format>();
- Q_CONSTEXPR uchar aRightShift = 32 - alphaWidth<Format>();
- Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>();
- Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>();
- Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>();
+ if (!dither) {
+ Q_CONSTEXPR uint aMask = (1 << aWidth) - 1;
+ Q_CONSTEXPR uint rMask = (1 << rWidth) - 1;
+ Q_CONSTEXPR uint gMask = (1 << gWidth) - 1;
+ Q_CONSTEXPR uint bMask = (1 << bWidth) - 1;
- Q_CONSTEXPR uint aOpaque = (0xff & aMask) << alphaShift<Format>();
- for (int i = 0; i < count; ++i) {
- const uint c = src[i];
- const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
- const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
- const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
- const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
- buffer[i] = a | r | g | b;
+ Q_CONSTEXPR uchar aRightShift = 32 - aWidth;
+ Q_CONSTEXPR uchar rRightShift = 24 - rWidth;
+ Q_CONSTEXPR uchar gRightShift = 16 - gWidth;
+ Q_CONSTEXPR uchar bRightShift = 8 - bWidth;
+
+ Q_CONSTEXPR uint aOpaque = aMask << alphaShift<Format>();
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>());
+ const uint r = ((c >> rRightShift) & rMask) << redShift<Format>();
+ const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>();
+ const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>();
+ buffer[i] = a | r | g | b;
+ }
+ } else {
+ const uint *bayer_line = qt_bayer_matrix[dither->y & 15];
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ const int d = bayer_line[(dither->x + i) & 15];
+ const int da = d - ((d + 1) >> aWidth);
+ const int dr = d - ((d + 1) >> rWidth);
+ const int dg = d - ((d + 1) >> gWidth);
+ const int db = d - ((d + 1) >> bWidth);
+ int a = qAlpha(c);
+ int r = qRed(c);
+ int g = qGreen(c);
+ int b = qBlue(c);
+ if (fromRGB)
+ a = (1 << aWidth) - 1;
+ else
+ a = (a + ((da - a) >> aWidth) + 1) >> (8 - aWidth);
+ r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth);
+ g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth);
+ b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth);
+ buffer[i] = (a << alphaShift<Format>())
+ | (r << redShift<Format>())
+ | (g << greenShift<Format>())
+ | (b << blueShift<Format>());
+ }
}
return buffer;
}
@@ -418,35 +480,35 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe
// To convert in place, let 'dest' and 'src' be the same.
static const uint *QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *clut)
+ const QVector<QRgb> *clut, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
- buffer[i] = qPremultiply(clut[src[i]]);
+ buffer[i] = qPremultiply(clut->at(src[i]));
return buffer;
}
static const QRgba64 *QT_FASTCALL convertIndexedToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *clut)
+ const QVector<QRgb> *clut, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
- buffer[i] = QRgba64::fromArgb32(clut[src[i]]).premultiplied();
+ buffer[i] = QRgba64::fromArgb32(clut->at(src[i])).premultiplied();
return buffer;
}
static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return src;
}
static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertARGB32ToARGB32PM(buffer, src, count);
}
static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = RGBA2ARGB(src[i]);
@@ -454,13 +516,13 @@ static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const u
}
static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
}
static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qRgba(0, 0, 0, src[i]);
@@ -468,7 +530,7 @@ static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *sr
}
static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qRgb(src[i], src[i], src[i]);
@@ -476,7 +538,7 @@ static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint
}
static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromRgba(0, 0, 0, src[i]);
@@ -484,7 +546,7 @@ static const QRgba64 *QT_FASTCALL convertAlpha8ToRGB64(QRgba64 *buffer, const ui
}
static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = QRgba64::fromRgba(src[i], src[i], src[i], 255);
@@ -492,7 +554,7 @@ static const QRgba64 *QT_FASTCALL convertGrayscale8ToRGB64(QRgba64 *buffer, cons
}
static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply(src[i]);
@@ -500,7 +562,7 @@ static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uin
}
static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(src[i]);
@@ -551,7 +613,7 @@ static inline void qConvertARGB32PMToARGB64PM_sse2(QRgba64 *buffer, const uint *
#endif
static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, true>(buffer, src, count);
@@ -563,7 +625,7 @@ static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uin
}
static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count);
@@ -577,7 +639,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32ToARGB64PM(QRgba64 *buffer, const
}
static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<false, false>(buffer, src, count);
@@ -589,7 +651,7 @@ static const QRgba64 *QT_FASTCALL convertARGB32PMToARGB64PM(QRgba64 *buffer, con
}
static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count);
@@ -603,7 +665,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888ToARGB64PM(QRgba64 *buffer, con
}
static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertARGB32PMToARGB64PM_sse2<true, false>(buffer, src, count);
@@ -615,7 +677,7 @@ static const QRgba64 *QT_FASTCALL convertRGBA8888PMToARGB64PM(QRgba64 *buffer, c
}
static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply(src[i]));
@@ -623,7 +685,7 @@ static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const u
}
static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | src[i]);
@@ -631,7 +693,7 @@ static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *sr
}
static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply(src[i]));
@@ -640,10 +702,28 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *dither)
{
- for (int i = 0; i < count; ++i)
- buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]);
+ if (!dither) {
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]);
+ } else {
+ for (int i = 0; i < count; ++i) {
+ const uint c = src[i];
+ short d10 = (qt_bayer_matrix[dither->y & 15][(dither->x + i) & 15] << 2);
+ short a10 = (c >> 30) * 0x155;
+ short r10 = ((c >> 20) & 0x3ff);
+ short g10 = ((c >> 10) & 0x3ff);
+ short b10 = (c & 0x3ff);
+ if (PixelOrder == PixelOrderBGR)
+ std::swap(r10, b10);
+ short a8 = (a10 + ((d10 - a10) >> 8)) >> 2;
+ short r8 = (r10 + ((d10 - r10) >> 8)) >> 2;
+ short g8 = (g10 + ((d10 - g10) >> 8)) >> 2;
+ short b8 = (b10 + ((d10 - b10) >> 8)) >> 2;
+ buffer[i] = qRgba(r8, g8, b8, a8);
+ }
+ }
return buffer;
}
@@ -693,7 +773,7 @@ static inline void qConvertA2RGB30PMToARGB64PM_sse2(QRgba64 *buffer, const uint
template<QtPixelOrder PixelOrder>
static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
#ifdef __SSE2__
qConvertA2RGB30PMToARGB64PM_sse2<PixelOrder>(buffer, src, count);
@@ -706,7 +786,7 @@ static const QRgba64 *QT_FASTCALL convertA2RGB30PMToARGB64PM(QRgba64 *buffer, co
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]);
@@ -715,7 +795,7 @@ static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]);
@@ -724,7 +804,7 @@ static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *s
template<QtPixelOrder PixelOrder>
static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i]));
@@ -732,7 +812,7 @@ static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint
}
static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qAlpha(src[i]);
@@ -740,7 +820,7 @@ static const uint *QT_FASTCALL convertAlpha8FromARGB32PM(uint *buffer, const uin
}
static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qGray(src[i]);
@@ -748,7 +828,7 @@ static const uint *QT_FASTCALL convertGrayscale8FromRGB32(uint *buffer, const ui
}
static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qGray(qUnpremultiply(src[i]));
@@ -1037,7 +1117,7 @@ static uint *QT_FASTCALL destFetch(uint *buffer, QRasterBuffer *rasterBuffer, in
{
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
const uint *ptr = qFetchPixels[layout->bpp](buffer, rasterBuffer->scanLine(y), x, length);
- return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, layout, 0));
+ return const_cast<uint *>(layout->convertToARGB32PM(buffer, ptr, length, 0, 0));
}
static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
@@ -1045,14 +1125,14 @@ static QRgba64 *QT_FASTCALL destFetch64(QRgba64 *buffer, QRasterBuffer *rasterBu
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
uint buffer32[buffer_size];
const uint *ptr = qFetchPixels[layout->bpp](buffer32, rasterBuffer->scanLine(y), x, length);
- return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, layout, 0));
+ return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, ptr, length, 0, 0));
}
static QRgba64 *QT_FASTCALL destFetch64uint32(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
{
const QPixelLayout *layout = &qPixelLayouts[rasterBuffer->format];
const uint *src = ((const uint *)rasterBuffer->scanLine(y)) + x;
- return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, layout, 0));
+ return const_cast<QRgba64 *>(layout->convertToARGB64PM(buffer, src, length, 0, 0));
}
static DestFetchProc destFetchProc[QImage::NImageFormats] =
@@ -1219,9 +1299,9 @@ static void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, int x, int y, con
int l = qMin(length, buffer_size);
const uint *ptr = 0;
if (!layout->premultiplied && !layout->alphaWidth)
- ptr = layout->convertFromRGB32(buf, buffer, l, layout, 0);
+ ptr = layout->convertFromRGB32(buf, buffer, l, 0, 0);
else
- ptr = layout->convertFromARGB32PM(buf, buffer, l, layout, 0);
+ ptr = layout->convertFromARGB32PM(buf, buffer, l, 0, 0);
store(dest, ptr, x, l);
length -= l;
buffer += l;
@@ -1247,9 +1327,9 @@ static void QT_FASTCALL destStore64(QRasterBuffer *rasterBuffer, int x, int y, c
const uint *ptr = 0;
convertFromRgb64(buf, buffer, l);
if (!layout->premultiplied && !layout->alphaWidth)
- ptr = layout->convertFromRGB32(buf, buf, l, layout, 0);
+ ptr = layout->convertFromRGB32(buf, buf, l, 0, 0);
else
- ptr = layout->convertFromARGB32PM(buf, buf, l, layout, 0);
+ ptr = layout->convertFromARGB32PM(buf, buf, l, 0, 0);
store(dest, ptr, x, l);
length -= l;
buffer += l;
@@ -1436,8 +1516,7 @@ static const uint *QT_FASTCALL fetchUntransformed(uint *buffer, const Operator *
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
const uint *ptr = qFetchPixels[layout->bpp](buffer, data->texture.scanLine(y), x, length);
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
- return layout->convertToARGB32PM(buffer, ptr, length, layout, clut);
+ return layout->convertToARGB32PM(buffer, ptr, length, data->texture.colorTable, 0);
}
static const uint *QT_FASTCALL fetchUntransformedARGB32PM(uint *, const Operator *,
@@ -1465,14 +1544,13 @@ static const QRgba64 *QT_FASTCALL fetchUntransformed64(QRgba64 *buffer, const Op
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
if (layout->bpp != QPixelLayout::BPP32) {
uint buffer32[buffer_size];
const uint *ptr = qFetchPixels[layout->bpp](buffer32, data->texture.scanLine(y), x, length);
- return layout->convertToARGB64PM(buffer, ptr, length, layout, clut);
+ return layout->convertToARGB64PM(buffer, ptr, length, data->texture.colorTable, 0);
} else {
const uint *src = (const uint *)data->texture.scanLine(y) + x;
- return layout->convertToARGB64PM(buffer, src, length, layout, clut);
+ return layout->convertToARGB64PM(buffer, src, length, data->texture.colorTable, 0);
}
}
@@ -1639,8 +1717,7 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
++b;
}
}
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
- return layout->convertToARGB32PM(buffer, buffer, length, layout, clut);
+ return layout->convertToARGB32PM(buffer, buffer, length, data->texture.colorTable, 0);
}
template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */
@@ -1655,7 +1732,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
+ const QVector<QRgb> *clut = data->texture.colorTable;
uint buffer32[buffer_size];
QRgba64 *b = buffer;
@@ -1672,7 +1749,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int i = 0, j = 0;
while (i < length) {
if (j == buffer_size) {
- layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0);
b += buffer_size;
j = 0;
}
@@ -1695,7 +1772,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
++i; ++j;
}
if (j > 0) {
- layout->convertToARGB64PM(b, buffer32, j, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, j, clut, 0);
b += j;
}
} else {
@@ -1710,7 +1787,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
int i = 0, j = 0;
while (i < length) {
if (j == buffer_size) {
- layout->convertToARGB64PM(b, buffer32, buffer_size, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, buffer_size, clut, 0);
b += buffer_size;
j = 0;
}
@@ -1741,7 +1818,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformed64(QRgba64 *buffer, const Oper
++i; ++j;
}
if (j > 0) {
- layout->convertToARGB64PM(b, buffer32, j, layout, clut);
+ layout->convertToARGB64PM(b, buffer32, j, clut, 0);
b += j;
}
}
@@ -2423,7 +2500,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
+ const QVector<QRgb> *clut = data->texture.colorTable;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2479,9 +2556,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int len2 = qMin(x, count - len1);
ptr1 = fetch(buf1, s1, x, len1);
- ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, layout, clut);
+ ptr1 = layout->convertToARGB32PM(buf1, ptr1, len1, clut, 0);
ptr2 = fetch(buf2, s2, x, len1);
- ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, layout, clut);
+ ptr2 = layout->convertToARGB32PM(buf2, ptr2, len1, clut, 0);
for (int i = 0; i < len1; ++i) {
uint t = ptr1[i];
uint b = ptr2[i];
@@ -2491,9 +2568,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
if (len2) {
ptr1 = fetch(buf1 + len1, s1, 0, len2);
- ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, layout, clut);
+ ptr1 = layout->convertToARGB32PM(buf1 + len1, ptr1, len2, clut, 0);
ptr2 = fetch(buf2 + len1, s2, 0, len2);
- ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, layout, clut);
+ ptr2 = layout->convertToARGB32PM(buf2 + len1, ptr2, len2, clut, 0);
for (int i = 0; i < len2; ++i) {
uint t = ptr1[i];
uint b = ptr2[i];
@@ -2512,9 +2589,9 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int leading = start - x;
ptr1 = fetch(buf1 + leading, s1, start, len);
- ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, layout, clut);
+ ptr1 = layout->convertToARGB32PM(buf1 + leading, ptr1, len, clut, 0);
ptr2 = fetch(buf2 + leading, s2, start, len);
- ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, layout, clut);
+ ptr2 = layout->convertToARGB32PM(buf2 + leading, ptr2, len, clut, 0);
for (int i = 0; i < len; ++i) {
uint t = ptr1[i];
@@ -2576,8 +2653,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
}
- layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
- layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
+ layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
+ layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
int disty = (fy & 0x0000ffff) >> 8;
@@ -2638,8 +2715,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fx += fdx;
fy += fdy;
}
- layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
- layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
+ 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 we are zooming more than 8 times, we use 8bit precision for the position.
@@ -2730,8 +2807,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
fw += fdw;
}
- layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
- layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
+ layout->convertToARGB32PM(buf1, buf1, len * 2, clut, 0);
+ layout->convertToARGB32PM(buf2, buf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
@@ -2752,7 +2829,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
const QSpanData *data, int y, int x, int length)
{
const QPixelLayout *layout = &qPixelLayouts[data->texture.format];
- const QRgb *clut = data->texture.colorTable ? data->texture.colorTable->constData() : 0;
+ const QVector<QRgb> *clut = data->texture.colorTable;
int image_width = data->texture.width;
int image_height = data->texture.height;
@@ -2863,9 +2940,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
if (disty)
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
@@ -3001,8 +3078,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
@@ -3073,8 +3150,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fw += fdw;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, layout, clut);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, layout, clut);
+ layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
@@ -4032,7 +4109,7 @@ template<typename T>
struct QBlendBase
{
typedef T BlendType;
- QBlendBase(QSpanData *d, Operator o)
+ QBlendBase(QSpanData *d, const Operator &o)
: data(d)
, op(o)
, dest(0)
@@ -4051,7 +4128,7 @@ struct QBlendBase
class BlendSrcGeneric : public QBlendBase<uint>
{
public:
- BlendSrcGeneric(QSpanData *d, Operator o)
+ BlendSrcGeneric(QSpanData *d, const Operator &o)
: QBlendBase<uint>(d, o)
{
}
@@ -4077,7 +4154,7 @@ public:
class BlendSrcGenericRGB64 : public QBlendBase<QRgba64>
{
public:
- BlendSrcGenericRGB64(QSpanData *d, Operator o)
+ BlendSrcGenericRGB64(QSpanData *d, const Operator &o)
: QBlendBase<QRgba64>(d, o)
{
}
@@ -5758,7 +5835,7 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int
*dst = qRgb(nr, ng, nb);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false;
static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma)
@@ -5795,7 +5872,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
const quint32 c = color;
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables();
if (!tables)
return;
@@ -5822,7 +5899,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
} else if (coverage == 255) {
dest[i] = c;
} else {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel
&& qAlpha(dest[i]) == 255) {
grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma);
@@ -5863,7 +5940,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer,
} else if (coverage == 255) {
dest[xp] = c;
} else {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel
&& qAlpha(dest[xp]) == 255) {
grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma);
@@ -6321,7 +6398,7 @@ void qt_memfill32(quint32 *dest, quint32 color, int count)
#endif
#ifdef QT_COMPILER_SUPPORTS_SSE4_1
-template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QVector<QRgb> *, QDitherInfo *);
#endif
extern void qInitBlendFunctions();
@@ -6397,14 +6474,19 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
if (qCpuHasFeature(SSE4_1)) {
#if !defined(__SSE4_1__)
- extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+ extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
#endif
- extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+ extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4;
@@ -6415,8 +6497,10 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)
if (qCpuHasFeature(AVX2)) {
- extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
- extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+ extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2;
qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2;
}
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index e11536ebd0..35a975c972 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -44,13 +44,13 @@
QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertARGB32ToARGB32PM(buffer, src, count);
}
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
}
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 21af6039f8..fa550541d3 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1171,11 +1171,15 @@ inline int comp_func_Plus_one_pixel(uint d, const uint s)
#undef MIX
#undef AMIX
-struct QPixelLayout;
+struct QDitherInfo {
+ int x;
+ int y;
+};
+
typedef const uint *(QT_FASTCALL *ConvertFunc)(uint *buffer, const uint *src, int count,
- const QPixelLayout *layout, const QRgb *clut);
+ const QVector<QRgb> *clut, QDitherInfo *dither);
typedef const QRgba64 *(QT_FASTCALL *ConvertFunc64)(QRgba64 *buffer, const uint *src, int count,
- const QPixelLayout *layout, const QRgb *clut);
+ const QVector<QRgb> *clut, QDitherInfo *dither);
struct QPixelLayout
{
diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp
index a39cdb3127..257bad9eca 100644
--- a/src/gui/painting/qdrawhelper_sse4.cpp
+++ b/src/gui/painting/qdrawhelper_sse4.cpp
@@ -45,19 +45,19 @@
QT_BEGIN_NAMESPACE
const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertARGB32ToARGB32PM(buffer, src, count);
}
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
}
const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qUnpremultiply_sse4(src[i]);
@@ -65,7 +65,7 @@ const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint
}
const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i]));
@@ -73,7 +73,7 @@ const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uin
}
const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i]));
@@ -82,7 +82,7 @@ const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *s
template<QtPixelOrder PixelOrder>
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *)
+ const QVector<QRgb> *, QDitherInfo *)
{
for (int i = 0; i < count; ++i)
buffer[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]);
@@ -91,10 +91,10 @@ const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const ui
template
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *);
+ const QVector<QRgb> *, QDitherInfo *);
template
const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uint *buffer, const uint *src, int count,
- const QPixelLayout *, const QRgb *);
+ const QVector<QRgb> *, QDitherInfo *);
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 81191d07b8..a50d1dfd73 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -312,7 +312,7 @@ void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s)
{
Qt::BrushStyle style = qbrush_style(s->brush);
- caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern);
+ caps.updateState(STATE_BRUSH_PATTERN, style != Qt::SolidPattern);
caps.updateState(STATE_BRUSH_ALPHA,
qbrush_color(s->brush).alpha() < 255);
}
@@ -374,9 +374,8 @@ void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &colo
else
pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
} else if (clipData->hasRegionClip) {
- QVector<QRect> rects = clipData->clipRegion.rects();
- for (int i = 0; i < rects.size(); ++i) {
- QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
+ for (const QRect &rect : clipData->clipRegion) {
+ QRect intersectRect = rect.intersected(targetRect.toRect());
if (!intersectRect.isEmpty()) {
unlock();
if (alpha)
@@ -609,10 +608,8 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
}
} else if (clipData->hasRegionClip) {
QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
- const QVector<QRect> intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect).rects();
- const int intersectedSize = intersectedRects.size();
- for (int i = 0; i < intersectedSize; ++i) {
- const QRect &targetRect = intersectedRects.at(i);
+ const QRegion targetRegion = clipData->clipRegion.intersected(unclippedTargetRect);
+ for (const QRect &targetRect : targetRegion) {
if (!targetRect.isValid() || targetRect.isEmpty())
continue;
int tmpSrcX = srcX + (targetRect.x() - x);
@@ -686,9 +683,8 @@ void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const Q
if (clipData->hasRectClip) {
d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity);
} else if (clipData->hasRegionClip) {
- QVector<QRect>rects = clipData->clipRegion.rects();
- for (int i = 0; i<rects.size(); ++i)
- d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity);
+ for (const QRect &rect : clipData->clipRegion)
+ d->clipAndDrawPixmap(rect, targetRect, pm, sr, canDrawOpacity);
}
} else {
QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height());
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 2c5e0672b1..6472481e7a 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -2834,7 +2834,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
QRect rect = r.boundingRect();
if (qt_show_painter_debug_output)
printf("QPainter::setClipRegion(), size=%d, [%d,%d,%d,%d]\n",
- r.rects().size(), rect.x(), rect.y(), rect.width(), rect.height());
+ r.rectCount(), rect.x(), rect.y(), rect.width(), rect.height());
#endif
if (!d->engine) {
qWarning("QPainter::setClipRegion: Painter not active");
@@ -6477,6 +6477,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(QPointF(x, y), ti2);
else
engine->drawTextItem(QPointF(x, y), ti2);
+ drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle,
+ ti2.flags, ti2.width.toReal(), ti2.charFormat);
if (!rtl)
x += ti2.width.toReal();
@@ -6508,6 +6510,8 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(QPointF(x, y), ti2);
else
engine->drawTextItem(QPointF(x,y), ti2);
+ drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle,
+ ti2.flags, ti2.width.toReal(), ti2.charFormat);
// reset the high byte for all glyphs
const int hi = which << 24;
@@ -6519,9 +6523,9 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(p, ti);
else
engine->drawTextItem(p, ti);
+ drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle,
+ ti.flags, ti.width.toReal(), ti.charFormat);
}
- drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle,
- ti.flags, ti.width.toReal(), ti.charFormat);
if (state->renderHints != oldRenderHints) {
state->renderHints = oldRenderHints;
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 5b91266b64..7dbc83b338 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1294,10 +1294,9 @@ void QPainterPath::addRegion(const QRegion &region)
ensureData();
detach();
- QVector<QRect> rects = region.rects();
- d_func()->elements.reserve(rects.size() * 5);
- for (int i=0; i<rects.size(); ++i)
- addRect(rects.at(i));
+ d_func()->elements.reserve(region.rectCount() * 5);
+ for (const QRect &rect : region)
+ addRect(rect);
}
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index d568dca6b9..34f1c51f6d 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1078,9 +1078,8 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
} else if (flags & DirtyClipRegion) {
d->clipEnabled = true;
QPainterPath path;
- QVector<QRect> rects = state.clipRegion().rects();
- for (int i = 0; i < rects.size(); ++i)
- path.addRect(rects.at(i));
+ for (const QRect &rect : state.clipRegion())
+ path.addRect(rect);
updateClipPath(path, state.clipOperation());
flags |= DirtyClipPath;
} else if (flags & DirtyClipEnabled) {
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 35cf1dae86..d967a168d2 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -251,9 +251,8 @@ static QRegion deviceRegion(const QRegion &region, QWindow *window, const QPoint
return region;
QVector<QRect> rects;
- const QVector<QRect> regionRects = region.rects();
- rects.reserve(regionRects.count());
- for (const QRect &rect : regionRects)
+ rects.reserve(region.rectCount());
+ for (const QRect &rect : region)
rects.append(deviceRect(rect.translated(offset), window));
QRegion deviceRegion;
@@ -413,7 +412,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
context->swapBuffers(window);
}
-
+#endif
/*!
Implemented in subclasses to return the content of the backingstore as a QImage.
@@ -426,7 +425,7 @@ QImage QPlatformBackingStore::toImage() const
{
return QImage();
}
-
+#ifndef QT_NO_OPENGL
/*!
May be reimplemented in subclasses to return the content of the
backingstore as an OpenGL texture. \a dirtyRegion is the part of the
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index 9b09620cce..52e6f40f44 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -121,7 +121,9 @@ public:
virtual void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context,
bool translucentBackground);
+#endif
virtual QImage toImage() const;
+#ifndef QT_NO_OPENGL
enum TextureFlag {
TextureSwizzle = 0x01,
TextureFlip = 0x02,
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index d38479c4b1..b39a23e7f2 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -81,8 +81,8 @@ QT_BEGIN_NAMESPACE
contains() a QPoint or QRect. The bounding rectangle can be found
with boundingRect().
- The function rects() gives a decomposition of the region into
- rectangles.
+ Iteration over the region (with begin(), end()) gives a decomposition of
+ the region into rectangles. The same sequence of rectangles is returned by rects().
Example of using complex regions:
\snippet code/src_gui_painting_qregion.cpp 0
@@ -395,23 +395,24 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt
QDataStream &operator<<(QDataStream &s, const QRegion &r)
{
- QVector<QRect> a = r.rects();
- if (a.isEmpty()) {
+ auto b = r.begin(), e = r.end();
+ if (b == e) {
s << (quint32)0;
} else {
+ const auto size = e - b;
if (s.version() == 1) {
- int i;
- for (i = a.size() - 1; i > 0; --i) {
+ for (auto i = size - 1; i > 0; --i) {
s << (quint32)(12 + i * 24);
s << (int)QRGN_OR;
}
- for (i = 0; i < a.size(); ++i) {
- s << (quint32)(4+8) << (int)QRGN_SETRECT << a[i];
- }
+ for (auto it = b; it != e; ++it)
+ s << (quint32)(4+8) << (int)QRGN_SETRECT << *it;
} else {
- s << (quint32)(4 + 4 + 16 * a.size()); // 16: storage size of QRect
+ s << quint32(4 + 4 + 16 * size); // 16: storage size of QRect
s << (qint32)QRGN_RECTS;
- s << a;
+ s << quint32(size);
+ for (auto it = b; it != e; ++it)
+ s << *it;
}
}
return s;
@@ -722,12 +723,9 @@ bool QRegion::intersects(const QRegion &region) const
if (rectCount() == 1 && region.rectCount() == 1)
return true;
- const QVector<QRect> myRects = rects();
- const QVector<QRect> otherRects = region.rects();
-
- for (QVector<QRect>::const_iterator i1 = myRects.constBegin(); i1 < myRects.constEnd(); ++i1)
- for (QVector<QRect>::const_iterator i2 = otherRects.constBegin(); i2 < otherRects.constEnd(); ++i2)
- if (rect_intersects(*i1, *i2))
+ for (const QRect &myRect : *this)
+ for (const QRect &otherRect : region)
+ if (rect_intersects(myRect, otherRect))
return true;
return false;
}
@@ -928,6 +926,100 @@ QRegion QRegion::intersect(const QRect &r) const
*/
/*!
+ \typedef QRegion::const_iterator
+ \since 5.8
+
+ An iterator over the QRects that make up the region.
+
+ QRegion does not offer mutable iterators.
+
+ \sa begin(), end()
+*/
+
+/*!
+ \typedef QRegion::const_reverse_iterator
+ \since 5.8
+
+ A reverse iterator over the QRects that make up the region.
+
+ QRegion does not offer mutable iterators.
+
+ \sa rbegin(), rend()
+*/
+
+/*!
+ \fn QRegion::begin() const
+ \since 5.8
+
+ Returns a const_iterator pointing to the beginning of the range of
+ rectangles that make up this range, in the order in which rects()
+ returns them.
+
+ \sa rbegin(), cbegin(), end()
+*/
+
+/*!
+ \fn QRegion::cbegin() const
+ \since 5.8
+
+ Same as begin().
+*/
+
+/*!
+ \fn QRegion::end() const
+ \since 5.8
+
+ Returns a const_iterator pointing to one past the end of the range of
+ rectangles that make up this range, in the order in which rects()
+ returns them.
+
+ \sa rend(), cend(), begin()
+*/
+
+/*!
+ \fn QRegion::cend() const
+ \since 5.8
+
+ Same as end().
+*/
+
+/*!
+ \fn QRegion::rbegin() const
+ \since 5.8
+
+ Returns a const_reverse_iterator pointing to the beginning of the range of
+ rectangles that make up this range, in the reverse order in which rects()
+ returns them.
+
+ \sa begin(), crbegin(), rend()
+*/
+
+/*!
+ \fn QRegion::crbegin() const
+ \since 5.8
+
+ Same as rbegin().
+*/
+
+/*!
+ \fn QRegion::rend() const
+ \since 5.8
+
+ Returns a const_reverse_iterator pointing to one past the end of the range of
+ rectangles that make up this range, in the reverse order in which rects()
+ returns them.
+
+ \sa end(), crend(), rbegin()
+*/
+
+/*!
+ \fn QRegion::crend() const
+ \since 5.8
+
+ Same as rend().
+*/
+
+/*!
\fn void QRegion::setRects(const QRect *rects, int number)
Sets the region using the array of rectangles specified by \a rects and
@@ -1065,13 +1157,11 @@ Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion &region)
return result;
}
- const QVector<QRect> rects = region.rects();
+ auto rect = region.begin();
+ const auto end = region.end();
QVarLengthArray<Segment> segments;
- segments.resize(4 * rects.size());
-
- const QRect *rect = rects.constData();
- const QRect *end = rect + rects.size();
+ segments.resize(4 * (end - rect));
int lastRowSegmentCount = 0;
Segment *lastRowSegments = 0;
@@ -1179,6 +1269,12 @@ struct QRegionPrivate {
}
}
+ const QRect *begin() const Q_DECL_NOTHROW
+ { return numRects == 1 ? &extents : rects.data(); } // avoid vectorize()
+
+ const QRect *end() const Q_DECL_NOTHROW
+ { return begin() + numRects; }
+
inline void append(const QRect *r);
void append(const QRegionPrivate *r);
void prepend(const QRect *r);
@@ -4200,7 +4296,7 @@ QRegion QRegion::xored(const QRegion &r) const
}
}
-QRect QRegion::boundingRect() const
+QRect QRegion::boundingRect() const Q_DECL_NOTHROW
{
if (isEmpty())
return QRect();
@@ -4256,6 +4352,16 @@ QVector<QRect> QRegion::rects() const
}
}
+QRegion::const_iterator QRegion::begin() const Q_DECL_NOTHROW
+{
+ return d->qt_rgn ? d->qt_rgn->begin() : nullptr;
+}
+
+QRegion::const_iterator QRegion::end() const Q_DECL_NOTHROW
+{
+ return d->qt_rgn ? d->qt_rgn->end() : nullptr;
+}
+
void QRegion::setRects(const QRect *rects, int num)
{
*this = QRegion();
@@ -4288,7 +4394,7 @@ void QRegion::setRects(const QRect *rects, int num)
}
}
-int QRegion::rectCount() const
+int QRegion::rectCount() const Q_DECL_NOTHROW
{
return (d->qt_rgn ? d->qt_rgn->numRects : 0);
}
@@ -4318,10 +4424,10 @@ bool QRegion::intersects(const QRect &rect) const
if (d->qt_rgn->numRects == 1)
return true;
- const QVector<QRect> myRects = rects();
- for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it)
- if (rect_intersects(r, *it))
+ for (const QRect &rect : *this) {
+ if (rect_intersects(r, rect))
return true;
+ }
return false;
}
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index d66f80fcde..3bf1a5268c 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -81,6 +81,18 @@ public:
bool isEmpty() const;
bool isNull() const;
+ typedef const QRect *const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ const_iterator begin() const Q_DECL_NOTHROW;
+ const_iterator cbegin() const Q_DECL_NOTHROW { return begin(); }
+ const_iterator end() const Q_DECL_NOTHROW;
+ const_iterator cend() const Q_DECL_NOTHROW { return end(); }
+ const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); }
+ const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return rbegin(); }
+ const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); }
+ const_reverse_iterator crend() const Q_DECL_NOTHROW { return rend(); }
+
bool contains(const QPoint &p) const;
bool contains(const QRect &r) const;
@@ -108,10 +120,10 @@ public:
bool intersects(const QRegion &r) const;
bool intersects(const QRect &r) const;
- QRect boundingRect() const;
+ QRect boundingRect() const Q_DECL_NOTHROW;
QVector<QRect> rects() const;
void setRects(const QRect *rect, int num);
- int rectCount() const;
+ int rectCount() const Q_DECL_NOTHROW;
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
// ### Qt 6: remove these, they're kept for MSVC compat
const QRegion operator|(const QRegion &r) const;
diff --git a/src/gui/painting/qrgba64_p.h b/src/gui/painting/qrgba64_p.h
index cf3dad5f90..b88a5d4c92 100644
--- a/src/gui/painting/qrgba64_p.h
+++ b/src/gui/painting/qrgba64_p.h
@@ -72,27 +72,49 @@ inline QRgba64 multiplyAlpha256(QRgba64 rgba64, uint alpha256)
inline QRgba64 multiplyAlpha65535(QRgba64 rgba64, uint alpha65535)
{
+ return QRgba64::fromRgba64(qt_div_65535(rgba64.red() * alpha65535),
+ qt_div_65535(rgba64.green() * alpha65535),
+ qt_div_65535(rgba64.blue() * alpha65535),
+ qt_div_65535(rgba64.alpha() * alpha65535));
+}
+
#ifdef __SSE2__
- const __m128i va = _mm_shufflelo_epi16(_mm_cvtsi32_si128(alpha65535), _MM_SHUFFLE(0, 0, 0, 0));
- __m128i vs = _mm_loadl_epi64((__m128i*)&rgba64);
+Q_ALWAYS_INLINE __m128i multiplyAlpha65535(__m128i rgba64, __m128i va)
+{
+ __m128i vs = rgba64;
vs = _mm_unpacklo_epi16(_mm_mullo_epi16(vs, va), _mm_mulhi_epu16(vs, va));
vs = _mm_add_epi32(vs, _mm_srli_epi32(vs, 16));
vs = _mm_add_epi32(vs, _mm_set1_epi32(0x8000));
vs = _mm_srai_epi32(vs, 16);
vs = _mm_packs_epi32(vs, _mm_setzero_si128());
- _mm_storel_epi64((__m128i*)&rgba64, vs);
- return rgba64;
-#else
- return QRgba64::fromRgba64(qt_div_65535(rgba64.red() * alpha65535),
- qt_div_65535(rgba64.green() * alpha65535),
- qt_div_65535(rgba64.blue() * alpha65535),
- qt_div_65535(rgba64.alpha() * alpha65535));
+ return vs;
+}
+Q_ALWAYS_INLINE __m128i multiplyAlpha65535(__m128i rgba64, uint alpha65535)
+{
+ const __m128i va = _mm_shufflelo_epi16(_mm_cvtsi32_si128(alpha65535), _MM_SHUFFLE(0, 0, 0, 0));
+ return multiplyAlpha65535(rgba64, va);
+}
#endif
+
+#if defined(__ARM_NEON__)
+Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint16x4_t alpha65535)
+{
+ uint32x4_t vs32 = vmull_u16(rgba64, alpha65535); // vs = vs * alpha
+ vs32 = vsraq_n_u32(vs32, vs32, 16); // vs = vs + (vs >> 16)
+ return vrshrn_n_u32(vs32, 16); // vs = (vs + 0x8000) >> 16
}
+Q_ALWAYS_INLINE uint16x4_t multiplyAlpha65535(uint16x4_t rgba64, uint alpha65535)
+{
+ uint32x4_t vs32 = vmull_n_u16(rgba64, alpha65535); // vs = vs * alpha
+ vs32 = vsraq_n_u32(vs32, vs32, 16); // vs = vs + (vs >> 16)
+ return vrshrn_n_u32(vs32, 16); // vs = (vs + 0x8000) >> 16
+}
+#endif
-inline QRgba64 multiplyAlpha255(QRgba64 rgba64, uint alpha255)
+template<typename T>
+inline T multiplyAlpha255(T rgba64, uint alpha255)
{
-#ifdef __SSE2__
+#if defined(__SSE2__) || defined(__ARM_NEON__)
return multiplyAlpha65535(rgba64, alpha255 * 257);
#else
return QRgba64::fromRgba64(qt_div_255(rgba64.red() * alpha255),
@@ -112,25 +134,69 @@ inline QRgba64 interpolate255(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
return QRgba64::fromRgba64(multiplyAlpha255(x, alpha1) + multiplyAlpha255(y, alpha2));
}
+#if defined __SSE2__
+Q_ALWAYS_INLINE __m128i interpolate255(__m128i x, uint alpha1, __m128i y, uint alpha2)
+{
+ return _mm_add_epi32(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
+}
+#endif
+
+#if defined __ARM_NEON__
+Q_ALWAYS_INLINE uint16x4_t interpolate255(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
+{
+ return vadd_u16(multiplyAlpha255(x, alpha1), multiplyAlpha255(y, alpha2));
+}
+#endif
+
inline QRgba64 interpolate65535(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
{
return QRgba64::fromRgba64(multiplyAlpha65535(x, alpha1) + multiplyAlpha65535(y, alpha2));
}
+#if defined __SSE2__
+Q_ALWAYS_INLINE __m128i interpolate65535(__m128i x, uint alpha1, __m128i y, uint alpha2)
+{
+ return _mm_add_epi32(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+// alpha2 below is const-ref because otherwise MSVC2013 complains that it can't 16-byte align the argument.
+Q_ALWAYS_INLINE __m128i interpolate65535(__m128i x, __m128i alpha1, __m128i y, const __m128i &alpha2)
+{
+ return _mm_add_epi32(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+#endif
+
+#if defined __ARM_NEON__
+Q_ALWAYS_INLINE uint16x4_t interpolate65535(uint16x4_t x, uint alpha1, uint16x4_t y, uint alpha2)
+{
+ return vadd_u16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+Q_ALWAYS_INLINE uint16x4_t interpolate65535(uint16x4_t x, uint16x4_t alpha1, uint16x4_t y, uint16x4_t alpha2)
+{
+ return vadd_u16(multiplyAlpha65535(x, alpha1), multiplyAlpha65535(y, alpha2));
+}
+#endif
+
inline QRgba64 addWithSaturation(QRgba64 a, QRgba64 b)
{
-#if defined(__SSE2__) && defined(Q_PROCESSOR_X86_64)
- __m128i va = _mm_cvtsi64_si128((quint64)a);
- __m128i vb = _mm_cvtsi64_si128((quint64)b);
- va = _mm_adds_epu16(va, vb);
- return QRgba64::fromRgba64(_mm_cvtsi128_si64(va));
-#else
return QRgba64::fromRgba64(qMin(a.red() + b.red(), 65535),
qMin(a.green() + b.green(), 65535),
qMin(a.blue() + b.blue(), 65535),
qMin(a.alpha() + b.alpha(), 65535));
+}
+
+#if defined(__SSE2__)
+Q_ALWAYS_INLINE __m128i addWithSaturation(__m128i a, __m128i b)
+{
+ return _mm_adds_epu16(a, b);
+}
#endif
+
+#if defined(__ARM_NEON__)
+Q_ALWAYS_INLINE uint16x4_t addWithSaturation(uint16x4_t a, uint16x4_t b)
+{
+ return vqmovn_u32(vaddl_u16(a, b));
}
+#endif
QT_END_NAMESPACE
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index d2c3eceeef..bfc8551a9b 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -247,6 +247,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
resizeCache(qNextPowerOfTwo(requiredWidth - 1), qNextPowerOfTwo(requiredHeight - 1));
}
+ beginFillTexture();
{
QHash<GlyphAndSubPixelPosition, Coord>::iterator iter = m_pendingGlyphs.begin();
while (iter != m_pendingGlyphs.end()) {
@@ -256,6 +257,7 @@ void QTextureGlyphCache::fillInPendingGlyphs()
++iter;
}
}
+ endFillTexture();
m_pendingGlyphs.clear();
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 14271ccc65..a8efb4abb1 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -117,7 +117,9 @@ public:
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphPadding() const { return 0; }
+ virtual void beginFillTexture() { }
virtual void fillTexture(const Coord &coord, glyph_t glyph, QFixed subPixelPosition) = 0;
+ virtual void endFillTexture() { }
inline void createCache(int width, int height) {
m_w = width;
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index ff2497817e..2278378613 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -602,9 +602,32 @@ QTextDocument *QAbstractTextDocumentLayout::document() const
*/
QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const
{
+ QTextCharFormat fmt = formatAt(pos).toCharFormat();
+ return fmt.anchorHref();
+}
+
+/*!
+ \since 5.8
+
+ Returns the source of the image at the given position \a pos, or an empty
+ string if no image exists at that point.
+*/
+QString QAbstractTextDocumentLayout::imageAt(const QPointF &pos) const
+{
+ QTextImageFormat fmt = formatAt(pos).toImageFormat();
+ return fmt.name();
+}
+
+/*!
+ \since 5.8
+
+ Returns the text format at the given position \a pos.
+*/
+QTextFormat QAbstractTextDocumentLayout::formatAt(const QPointF &pos) const
+{
int cursorPos = hitTest(pos, Qt::ExactHit);
if (cursorPos == -1)
- return QString();
+ return QTextFormat();
// compensate for preedit in the hit text block
QTextBlock block = document()->firstBlock();
@@ -623,8 +646,7 @@ QString QAbstractTextDocumentLayout::anchorAt(const QPointF& pos) const
QTextDocumentPrivate *pieceTable = qobject_cast<const QTextDocument *>(parent())->docHandle();
QTextDocumentPrivate::FragmentIterator it = pieceTable->find(cursorPos);
- QTextCharFormat fmt = pieceTable->formatCollection()->charFormat(it->format);
- return fmt.anchorHref();
+ return pieceTable->formatCollection()->format(it->format);
}
/*!
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h
index 01704fe37b..e2fad12ad3 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -82,7 +82,10 @@ public:
virtual void draw(QPainter *painter, const PaintContext &context) = 0;
virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0;
+
QString anchorAt(const QPointF& pos) const;
+ QString imageAt(const QPointF &pos) const;
+ QTextFormat formatAt(const QPointF &pos) const;
virtual int pageCount() const = 0;
virtual QSizeF documentSize() const = 0;
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index c237d80d34..940de87eee 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -900,7 +900,7 @@ static QBrush brushFromData(const BrushData& c, const QPalette &pal)
}
}
-static BorderStyle parseStyleValue(QCss::Value v)
+static BorderStyle parseStyleValue(const QCss::Value &v)
{
if (v.type == Value::KnownIdentifier) {
switch (v.variant.toInt()) {
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index d90134482d..d4bd975eca 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -45,6 +45,8 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcDistanceField, "qt.distanceField");
+
namespace
{
enum FillHDir
@@ -734,8 +736,45 @@ static bool imageHasNarrowOutlines(const QImage &im)
return minHThick == 1 || minVThick == 1;
}
+static int QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = 54;
+static int QT_DISTANCEFIELD_DEFAULT_TILESIZE = 64;
+static int QT_DISTANCEFIELD_DEFAULT_SCALE = 16;
+static int QT_DISTANCEFIELD_DEFAULT_RADIUS = 80;
+static int QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = 2000;
+
+static void initialDistanceFieldFactor()
+{
+ static bool initialized = false;
+ if (initialized)
+ return;
+ initialized = true;
+
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE")) {
+ QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE:" << QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE;
+ }
+
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_TILESIZE")) {
+ QT_DISTANCEFIELD_DEFAULT_TILESIZE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_TILESIZE");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_TILESIZE:" << QT_DISTANCEFIELD_DEFAULT_TILESIZE;
+ }
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_SCALE")) {
+ QT_DISTANCEFIELD_DEFAULT_SCALE = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_SCALE");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_SCALE:" << QT_DISTANCEFIELD_DEFAULT_SCALE;
+ }
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_RADIUS")) {
+ QT_DISTANCEFIELD_DEFAULT_RADIUS = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_RADIUS");
+ qDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_RADIUS:" << QT_DISTANCEFIELD_DEFAULT_RADIUS;
+ }
+ if (qEnvironmentVariableIsSet("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT")) {
+ QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT = qEnvironmentVariableIntValue("QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT");
+ qCDebug(lcDistanceField) << "set the QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT:" << QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT;
+ }
+}
+
bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
{
+ initialDistanceFieldFactor();
QFontEngine *fe = fontEngine->cloneWithSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE);
if (!fe)
return false;
@@ -755,6 +794,7 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine)
bool qt_fontHasNarrowOutlines(const QRawFont &f)
{
QRawFont font = f;
+ initialDistanceFieldFactor();
font.setPixelSize(QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE);
if (!font.isValid())
return false;
@@ -767,6 +807,51 @@ bool qt_fontHasNarrowOutlines(const QRawFont &f)
QRawFont::PixelAntialiasing));
}
+int QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE;
+}
+
+int QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_TILESIZE;
+}
+
+int QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_SCALE / 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_SCALE;
+}
+
+int QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont)
+{
+ initialDistanceFieldFactor();
+
+ if (Q_UNLIKELY(narrowOutlineFont))
+ return QT_DISTANCEFIELD_DEFAULT_RADIUS / 2;
+ else
+ return QT_DISTANCEFIELD_DEFAULT_RADIUS;
+}
+
+int QT_DISTANCEFIELD_HIGHGLYPHCOUNT()
+{
+ initialDistanceFieldFactor();
+ return QT_DISTANCEFIELD_DEFAULT_HIGHGLYPHCOUNT;
+}
QDistanceFieldData::QDistanceFieldData(const QDistanceFieldData &other)
: QSharedData(other)
diff --git a/src/gui/text/qdistancefield_p.h b/src/gui/text/qdistancefield_p.h
index 7cd385587b..3076a90b9d 100644
--- a/src/gui/text/qdistancefield_p.h
+++ b/src/gui/text/qdistancefield_p.h
@@ -54,31 +54,20 @@
#include <qrawfont.h>
#include <private/qfontengine_p.h>
#include <QtCore/qshareddata.h>
+#include <QtCore/qglobal.h>
+#include <QLoggingCategory>
QT_BEGIN_NAMESPACE
-#define QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE 54
-#define QT_DISTANCEFIELD_DEFAULT_TILESIZE 64
-#define QT_DISTANCEFIELD_DEFAULT_SCALE 16
-#define QT_DISTANCEFIELD_DEFAULT_RADIUS 80
-#define QT_DISTANCEFIELD_HIGHGLYPHCOUNT 2000
-
-#define QT_DISTANCEFIELD_BASEFONTSIZE(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE * 2 : \
- QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE)
-#define QT_DISTANCEFIELD_TILESIZE(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_TILESIZE * 2 : \
- QT_DISTANCEFIELD_DEFAULT_TILESIZE)
-#define QT_DISTANCEFIELD_SCALE(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_SCALE / 2 : \
- QT_DISTANCEFIELD_DEFAULT_SCALE)
-#define QT_DISTANCEFIELD_RADIUS(NarrowOutlineFont) \
- (NarrowOutlineFont ? QT_DISTANCEFIELD_DEFAULT_RADIUS / 2 : \
- QT_DISTANCEFIELD_DEFAULT_RADIUS)
-
bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(const QRawFont &f);
bool Q_GUI_EXPORT qt_fontHasNarrowOutlines(QFontEngine *fontEngine);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_BASEFONTSIZE(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_TILESIZE(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_SCALE(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_RADIUS(bool narrowOutlineFont);
+int Q_GUI_EXPORT QT_DISTANCEFIELD_HIGHGLYPHCOUNT();
+
class Q_GUI_EXPORT QDistanceFieldData : public QSharedData
{
public:
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index fe5d544dba..adc8f634dc 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1845,7 +1845,11 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const
{
glyph_t glyph = engine(0)->glyphIndex(ucs4);
- if (glyph == 0 && ucs4 != QChar::LineSeparator) {
+ if (glyph == 0
+ && ucs4 != QChar::LineSeparator
+ && ucs4 != QChar::LineFeed
+ && ucs4 != QChar::CarriageReturn
+ && ucs4 != QChar::ParagraphSeparator) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
@@ -1883,7 +1887,11 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
QStringIterator it(str, str + len);
while (it.hasNext()) {
const uint ucs4 = it.peekNext();
- if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) {
+ if (glyphs->glyphs[glyph_pos] == 0
+ && ucs4 != QChar::LineSeparator
+ && ucs4 != QChar::LineFeed
+ && ucs4 != QChar::CarriageReturn
+ && ucs4 != QChar::ParagraphSeparator) {
if (!m_fallbackFamiliesQueried)
const_cast<QFontEngineMulti *>(this)->ensureFallbackFamiliesQueried();
for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 723918ae69..a3dbf455cf 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -3135,7 +3135,7 @@ void QTextHtmlExporter::emitTable(const QTextTable *table)
html += QLatin1String("</table>");
}
-void QTextHtmlExporter::emitFrame(QTextFrame::Iterator frameIt)
+void QTextHtmlExporter::emitFrame(const QTextFrame::Iterator &frameIt)
{
if (!frameIt.atEnd()) {
QTextFrame::Iterator next = frameIt;
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index ffc5d7418b..3537adba9e 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1078,8 +1078,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c)
const QTextUndoCommand &last = undoStack.at(lastIdx);
if ( (last.block_part && c.block_part && !last.block_end) // part of the same block => can merge
- || (!c.block_part && !last.block_part)) { // two single undo items => can merge
-
+ || (!c.block_part && !last.block_part) // two single undo items => can merge
+ || (c.command == QTextUndoCommand::Inserted && last.command == c.command && (last.block_part && !c.block_part))) {
+ // two sequential inserts that are not part of the same block => can merge
if (undoStack[lastIdx].tryMerge(c))
return;
}
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index 34849df0bb..caa63e15d2 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -378,7 +378,7 @@ private:
enum StyleMode { EmitStyleTag, OmitStyleTag };
enum FrameType { TextFrame, TableFrame, RootFrame };
- void emitFrame(QTextFrame::Iterator frameIt);
+ void emitFrame(const QTextFrame::Iterator &frameIt);
void emitTextFrame(const QTextFrame *frame);
void emitBlock(const QTextBlock &block);
void emitTable(const QTextTable *table);
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index b6cbd9617f..0c8904b4c5 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -295,7 +295,7 @@ static inline bool isEmptyBlockBeforeTable(const QTextBlock &block, const QTextB
;
}
-static inline bool isEmptyBlockBeforeTable(QTextFrame::Iterator it)
+static inline bool isEmptyBlockBeforeTable(const QTextFrame::Iterator &it)
{
QTextFrame::Iterator next = it; ++next;
if (it.currentFrame())
@@ -419,7 +419,7 @@ static bool operator<(int pos, const QCheckPoint &checkPoint)
#endif
-static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, QRectF gradientRect = QRectF())
+static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const QPointF &origin, const QRectF &gradientRect = QRectF())
{
p->save();
if (brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern) {
@@ -1504,7 +1504,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
painter->restore();
}
-static QFixed flowPosition(const QTextFrame::iterator it)
+static QFixed flowPosition(const QTextFrame::iterator &it)
{
if (it.atEnd())
return 0;
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index a7c58ac2a6..731aaf1fcf 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -139,12 +139,9 @@ QTextDocumentWriter::QTextDocumentWriter(QIODevice *device, const QByteArray &fo
format by inspecting the extension of \a fileName.
*/
QTextDocumentWriter::QTextDocumentWriter(const QString &fileName, const QByteArray &format)
- : d(new QTextDocumentWriterPrivate(this))
+ : QTextDocumentWriter(new QFile(fileName), format)
{
- QFile *file = new QFile(fileName);
- d->device = file;
d->deleteDevice = true;
- d->format = format;
}
/*!
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 28fb9d2769..d11f8c34b1 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -843,7 +843,7 @@ enum JustificationClass {
Adds an inter character justification opportunity after the number or letter
character and a space justification opportunity after the space character.
*/
-static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, QGlyphLayout g, ushort *log_clusters, int spaceAs)
+static inline void qt_getDefaultJustificationOpportunities(const ushort *string, int length, const QGlyphLayout &g, ushort *log_clusters, int spaceAs)
{
int str_pos = 0;
while (str_pos < length) {
@@ -877,7 +877,7 @@ static inline void qt_getDefaultJustificationOpportunities(const ushort *string,
}
}
-static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, QGlyphLayout g, ushort *log_clusters)
+static inline void qt_getJustificationOpportunities(const ushort *string, int length, const QScriptItem &si, const QGlyphLayout &g, ushort *log_clusters)
{
Q_ASSERT(length > 0 && g.numGlyphs > 0);
@@ -1292,9 +1292,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
#ifdef Q_OS_DARWIN
if (actualFontEngine->type() == QFontEngine::Mac) {
- // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
- // scaling the advances for this particular version
- if (QSysInfo::MacintoshVersion != QSysInfo::MV_10_6 && actualFontEngine->fontDef.stretch != 100) {
+ if (actualFontEngine->fontDef.stretch != 100) {
QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100);
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] *= stretch;
@@ -3518,7 +3516,7 @@ QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex,
}
-QTransform qt_true_matrix(qreal w, qreal h, QTransform x)
+QTransform qt_true_matrix(qreal w, qreal h, const QTransform &x)
{
QRectF rect = x.mapRect(QRectF(0, 0, w, h));
return x * QTransform::fromTranslate(-rect.x(), -rect.y());
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 3b1ee8ec03..f5827bb683 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -975,7 +975,7 @@ void QTextLayout::setFlags(int flags)
}
static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPointF &pos, QTextLayout::FormatRange *selection,
- QPainterPath *region, QRectF boundingRect)
+ QPainterPath *region, const QRectF &boundingRect)
{
const QScriptLine &line = eng->lines[lineNumber];
@@ -1326,7 +1326,11 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
&& (p->transform().type() > QTransform::TxTranslate);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing);
+ QPainter::CompositionMode origCompositionMode = p->compositionMode();
+ if (p->paintEngine()->hasFeature(QPaintEngine::RasterOpModes))
+ p->setCompositionMode(QPainter::RasterOp_NotDestination);
p->fillRect(QRectF(x, y, qreal(width), (base + descent).toReal()), p->pen().brush());
+ p->setCompositionMode(origCompositionMode);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing, false);
if (d->layoutData->hasBidi) {
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index ad537b7126..73d2e545ba 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -295,7 +295,7 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc
writer.writeStartElement(textNS, QString::fromLatin1("span"));
QString fragmentText = frag.fragment().text();
- if (fragmentText.length() == 1 && fragmentText[0] == 0xFFFC) { // its an inline character.
+ if (fragmentText.length() == 1 && fragmentText[0] == QChar(0xFFFC)) { // its an inline character.
writeInlineCharacter(writer, frag.fragment());
writer.writeEndElement(); // span
continue;
@@ -510,7 +510,7 @@ void QTextOdfWriter::writeBlockFormat(QXmlStreamWriter &writer, QTextBlockFormat
case QTextOption::CenterTab: type = QString::fromLatin1("center"); break;
}
writer.writeAttribute(styleNS, QString::fromLatin1("type"), type);
- if (iterator->delimiter != 0)
+ if (!iterator->delimiter.isNull())
writer.writeAttribute(styleNS, QString::fromLatin1("char"), iterator->delimiter);
++iterator;
}
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 90c6e7a7b8..fb9dfc9f69 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -216,7 +216,7 @@ public:
*/
QValidator::QValidator(QObject * parent)
- : QObject(*new QValidatorPrivate, parent)
+ : QValidator(*new QValidatorPrivate, parent)
{
}
@@ -337,10 +337,8 @@ void QValidator::fixup(QString &) const
*/
QIntValidator::QIntValidator(QObject * parent)
- : QValidator(parent)
+ : QIntValidator(INT_MIN, INT_MAX, parent)
{
- b = INT_MIN;
- t = INT_MAX;
}
@@ -589,11 +587,8 @@ public:
*/
QDoubleValidator::QDoubleValidator(QObject * parent)
- : QValidator(*new QDoubleValidatorPrivate , parent)
+ : QDoubleValidator(-HUGE_VAL, HUGE_VAL, 1000, parent)
{
- b = -HUGE_VAL;
- t = HUGE_VAL;
- dec = 1000;
}
@@ -845,7 +840,7 @@ QDoubleValidator::Notation QDoubleValidator::notation() const
*/
QRegExpValidator::QRegExpValidator(QObject *parent)
- : QValidator(parent), r(QString::fromLatin1(".*"))
+ : QRegExpValidator(QRegExp(QString::fromLatin1(".*")), parent)
{
}
@@ -982,7 +977,7 @@ QRegularExpressionValidator::QRegularExpressionValidator(QObject *parent)
*/
QRegularExpressionValidator::QRegularExpressionValidator(const QRegularExpression &re, QObject *parent)
- : QValidator(*new QRegularExpressionValidatorPrivate, parent)
+ : QRegularExpressionValidator(parent)
{
Q_D(QRegularExpressionValidator);
d->setRegularExpression(re);
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index 38e9c25269..746ddc6916 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -37,7 +37,8 @@ HEADERS += \
access/qnetworkdiskcache.h \
access/qhttpthreaddelegate_p.h \
access/qhttpmultipart.h \
- access/qhttpmultipart_p.h
+ access/qhttpmultipart_p.h \
+ access/qnetworkfile_p.h
SOURCES += \
access/qftp.cpp \
@@ -68,8 +69,10 @@ SOURCES += \
access/qabstractnetworkcache.cpp \
access/qnetworkdiskcache.cpp \
access/qhttpthreaddelegate.cpp \
- access/qhttpmultipart.cpp
+ access/qhttpmultipart.cpp \
+ access/qnetworkfile.cpp
mac: LIBS_PRIVATE += -framework Security
include($$PWD/../../3rdparty/zlib_dependency.pri)
+include($$PWD/http2/http2.pri)
diff --git a/src/network/access/http2/bitstreams.cpp b/src/network/access/http2/bitstreams.cpp
new file mode 100644
index 0000000000..d22c7cd4ec
--- /dev/null
+++ b/src/network/access/http2/bitstreams.cpp
@@ -0,0 +1,336 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bitstreams_p.h"
+#include "huffman_p.h"
+
+#include <QtCore/qbytearray.h>
+
+#include <limits>
+
+QT_BEGIN_NAMESPACE
+
+static_assert(std::numeric_limits<uchar>::digits == 8, "octets expected");
+
+namespace HPack
+{
+
+BitOStream::BitOStream(std::vector<uchar> &b)
+ : buffer(b),
+ // All data 'packed' before:
+ bitsSet(8 * quint64(b.size()))
+{
+}
+
+void BitOStream::writeBits(uchar bits, quint8 bitLength)
+{
+ Q_ASSERT(bitLength <= 8);
+
+ quint8 count = bitsSet % 8; // bits used in buffer.back(), but 0 means 8
+ bits <<= 8 - bitLength; // at top of byte, lower bits clear
+ if (count) { // we have a part-used byte; fill it some more:
+ buffer.back() |= bits >> count;
+ count = 8 - count;
+ } // count bits have been consumed (and 0 now means 0)
+ if (bitLength > count)
+ buffer.push_back(bits << count);
+
+ bitsSet += bitLength;
+}
+
+void BitOStream::write(quint32 src)
+{
+ const quint8 prefixLen = 8 - bitsSet % 8;
+ const quint32 fullPrefix = (1 << prefixLen) - 1;
+
+ // https://http2.github.io/http2-spec/compression.html#low-level.representation,
+ // 5.1
+ if (src < fullPrefix) {
+ writeBits(uchar(src), prefixLen);
+ } else {
+ writeBits(uchar(fullPrefix), prefixLen);
+ // We're on the byte boundary now,
+ // so we can just 'push_back'.
+ Q_ASSERT(!(bitsSet % 8));
+ src -= fullPrefix;
+ while (src >= 128) {
+ buffer.push_back(uchar(src % 128 + 128));
+ src /= 128;
+ bitsSet += 8;
+ }
+ buffer.push_back(src);
+ bitsSet += 8;
+ }
+}
+
+void BitOStream::write(const QByteArray &src, bool compressed)
+{
+ quint32 byteLen = src.size();
+ if (compressed && byteLen) {
+ const auto bitLen = huffman_encoded_bit_length(src);
+ Q_ASSERT(bitLen && std::numeric_limits<quint32>::max() >= (bitLen + 7) / 8);
+ byteLen = (bitLen + 7) / 8;
+ writeBits(uchar(1), 1); // bit set - compressed
+ } else {
+ writeBits(uchar(0), 1); // no compression.
+ }
+
+ write(byteLen);
+
+ if (compressed) {
+ huffman_encode_string(src, *this);
+ } else {
+ bitsSet += quint64(src.size()) * 8;
+ buffer.insert(buffer.end(), src.begin(), src.end());
+ }
+}
+
+quint64 BitOStream::bitLength() const
+{
+ return bitsSet;
+}
+
+quint64 BitOStream::byteLength() const
+{
+ return buffer.size();
+}
+
+const uchar *BitOStream::begin() const
+{
+ return &buffer[0];
+}
+
+const uchar *BitOStream::end() const
+{
+ return &buffer[0] + buffer.size();
+}
+
+void BitOStream::clear()
+{
+ buffer.clear();
+ bitsSet = 0;
+}
+
+BitIStream::BitIStream()
+ : first(),
+ last(),
+ offset(),
+ streamError(Error::NoError)
+{
+}
+
+BitIStream::BitIStream(const uchar *begin, const uchar *end)
+ : first(begin),
+ last(end),
+ offset(),
+ streamError(Error::NoError)
+{
+}
+
+quint64 BitIStream::bitLength() const
+{
+ return quint64(last - first) * 8;
+}
+
+bool BitIStream::hasMoreBits() const
+{
+ return offset < bitLength();
+}
+
+bool BitIStream::skipBits(quint64 nBits)
+{
+ if (nBits > bitLength() || bitLength() - nBits < offset)
+ return false;
+
+ offset += nBits;
+ return true;
+}
+
+bool BitIStream::rewindOffset(quint64 nBits)
+{
+ if (nBits > offset)
+ return false;
+
+ offset -= nBits;
+ return true;
+}
+
+bool BitIStream::read(quint32 *dstPtr)
+{
+ Q_ASSERT(dstPtr);
+ quint32 &dst = *dstPtr;
+
+ // 5.1 Integer Representation
+ //
+ // Integers are used to represent name indexes, header field indexes, or string lengths.
+ // An integer representation can start anywhere within an octet.
+ // To allow for optimized processing, an integer representation always finishes at the end of an octet.
+ // An integer is represented in two parts: a prefix that fills the current octet and an optional
+ // list of octets that are used if the integer value does not fit within the prefix.
+ // The number of bits of the prefix (called N) is a parameter of the integer representation.
+ // If the integer value is small enough, i.e., strictly less than 2N-1, it is compressed within the N-bit prefix.
+ // ...
+ // The prefix size, N, is always between 1 and 8 bits. An integer
+ // starting at an octet boundary will have an 8-bit prefix.
+
+ // Technically, such integers can be of any size, but as we do not have arbitrary-long integers,
+ // everything that does not fit into 'dst' we consider as an error (after all, try to allocate a string
+ // of such size and ... hehehe - send it as a part of a header!
+
+ // This function updates the offset _only_ if the read was successful.
+ if (offset >= bitLength()) {
+ setError(Error::NotEnoughData);
+ return false;
+ }
+
+ setError(Error::NoError);
+
+ const quint32 prefixLen = 8 - offset % 8;
+ const quint32 fullPrefix = (1 << prefixLen) - 1;
+
+ const uchar prefix = uchar(first[offset / 8] & fullPrefix);
+ if (prefix < fullPrefix) {
+ // The number fitted into the prefix bits.
+ dst = prefix;
+ offset += prefixLen;
+ return true;
+ }
+
+ quint32 newOffset = offset + prefixLen;
+ // We have a list of bytes representing an integer ...
+ quint64 val = prefix;
+ quint32 octetPower = 0;
+
+ while (true) {
+ if (newOffset >= bitLength()) {
+ setError(Error::NotEnoughData);
+ return false;
+ }
+
+ const uchar octet = first[newOffset / 8];
+
+ if (octetPower == 28 && octet > 15) {
+ qCritical("integer is too big");
+ setError(Error::InvalidInteger);
+ return false;
+ }
+
+ val += quint32(octet & 0x7f) << octetPower;
+ newOffset += 8;
+
+ if (!(octet & 0x80)) {
+ // The most significant bit of each octet is used
+ // as a continuation flag: its value is set to 1
+ // except for the last octet in the list.
+ break;
+ }
+
+ octetPower += 7;
+ }
+
+ dst = val;
+ offset = newOffset;
+ Q_ASSERT(!(offset % 8));
+
+ return true;
+}
+
+bool BitIStream::read(QByteArray *dstPtr)
+{
+ Q_ASSERT(dstPtr);
+ QByteArray &dst = *dstPtr;
+ //5.2 String Literal Representation
+ //
+ // Header field names and header field values can be represented as string literals.
+ // A string literal is compressed as a sequence of octets, either by directly encoding
+ // the string literal's octets or by using a Huffman code.
+
+ // We update the offset _only_ if the read was successful.
+
+ const quint64 oldOffset = offset;
+ uchar compressed = 0;
+ if (peekBits(offset, 1, &compressed) != 1 || !skipBits(1)) {
+ setError(Error::NotEnoughData);
+ return false;
+ }
+
+ setError(Error::NoError);
+
+ quint32 len = 0;
+ if (read(&len)) {
+ Q_ASSERT(!(offset % 8));
+ if (len <= (bitLength() - offset) / 8) { // We have enough data to read a string ...
+ if (!compressed) {
+ // Now good news, integer always ends on a byte boundary.
+ // We can read 'len' bytes without any bit magic.
+ const char *src = reinterpret_cast<const char *>(first + offset / 8);
+ dst = QByteArray(src, len);
+ offset += quint64(len) * 8;
+ return true;
+ }
+
+ BitIStream slice(first + offset / 8, first + offset / 8 + len);
+ if (huffman_decode_string(slice, &dst)) {
+ offset += quint64(len) * 8;
+ return true;
+ }
+
+ setError(Error::CompressionError);
+ } else {
+ setError(Error::NotEnoughData);
+ }
+ } // else the exact reason was set by read(quint32).
+
+ offset = oldOffset;
+ return false;
+}
+
+BitIStream::Error BitIStream::error() const
+{
+ return streamError;
+}
+
+void BitIStream::setError(Error newState)
+{
+ streamError = newState;
+}
+
+} // namespace HPack
+
+QT_END_NAMESPACE
diff --git a/src/network/access/http2/bitstreams_p.h b/src/network/access/http2/bitstreams_p.h
new file mode 100644
index 0000000000..9eba319dc2
--- /dev/null
+++ b/src/network/access/http2/bitstreams_p.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BITSTREAMS_P_H
+#define BITSTREAMS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qdebug.h>
+
+#include <type_traits>
+#include <algorithm>
+#include <vector>
+
+QT_BEGIN_NAMESPACE
+
+class QByteArray;
+
+namespace HPack
+{
+
+// BitOStream works with an external buffer,
+// for example, HEADERS frame.
+class Q_AUTOTEST_EXPORT BitOStream
+{
+public:
+ BitOStream(std::vector<uchar> &buffer);
+
+ // Write 'bitLength' bits from the least significant
+ // bits in 'bits' to bitstream:
+ void writeBits(uchar bits, quint8 bitLength);
+ // HPACK data format, we support:
+ // * 32-bit integers
+ // * strings
+ void write(quint32 src);
+ void write(const QByteArray &src, bool compressed);
+
+ quint64 bitLength() const;
+ quint64 byteLength() const;
+ const uchar *begin() const;
+ const uchar *end() const;
+
+ void clear();
+
+private:
+ Q_DISABLE_COPY(BitOStream);
+
+ std::vector<uchar> &buffer;
+ quint64 bitsSet;
+};
+
+class Q_AUTOTEST_EXPORT BitIStream
+{
+public:
+ // Error is set by 'read' functions.
+ // 'peek' does not set the error,
+ // since it just peeks some bits
+ // without the notion of wrong/right.
+ // 'read' functions only change 'streamOffset'
+ // on success.
+ enum class Error
+ {
+ NoError,
+ NotEnoughData,
+ CompressionError,
+ InvalidInteger
+ };
+
+ BitIStream();
+ BitIStream(const uchar *f, const uchar *l);
+
+ quint64 bitLength() const;
+ bool hasMoreBits() const;
+
+ // peekBits tries to read 'length' bits from the bitstream into
+ // 'dst' ('length' must be <= sizeof(dst) * 8), packing them
+ // starting from the most significant bit of the most significant
+ // byte. It's a template so that we can use it with different
+ // integer types. Returns the number of bits actually read.
+ // Does not change stream's offset.
+
+ template<class T>
+ quint64 peekBits(quint64 from, quint64 length, T *dstPtr) const
+ {
+ static_assert(std::is_unsigned<T>::value, "peekBits: unsigned integer type expected");
+
+ Q_ASSERT(dstPtr);
+ Q_ASSERT(length <= sizeof(T) * 8);
+
+ if (from >= bitLength() || !length)
+ return 0;
+
+ T &dst = *dstPtr;
+ dst = T();
+ length = std::min(length, bitLength() - from);
+
+ const uchar *srcByte = first + from / 8;
+ auto bitsToRead = length + from % 8;
+
+ while (bitsToRead > 8) {
+ dst = (dst << 8) | *srcByte;
+ bitsToRead -= 8;
+ ++srcByte;
+ }
+
+ dst <<= bitsToRead;
+ dst |= *srcByte >> (8 - bitsToRead);
+ dst <<= sizeof(T) * 8 - length;
+
+ return length;
+ }
+
+ quint64 streamOffset() const
+ {
+ return offset;
+ }
+
+ bool skipBits(quint64 nBits);
+ bool rewindOffset(quint64 nBits);
+
+ bool read(quint32 *dstPtr);
+ bool read(QByteArray *dstPtr);
+
+ Error error() const;
+
+private:
+ void setError(Error newState);
+
+ const uchar *first;
+ const uchar *last;
+ quint64 offset;
+ Error streamError;
+};
+
+} // namespace HPack
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/network/access/http2/hpack.cpp b/src/network/access/http2/hpack.cpp
new file mode 100644
index 0000000000..95e6f9051b
--- /dev/null
+++ b/src/network/access/http2/hpack.cpp
@@ -0,0 +1,551 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bitstreams_p.h"
+#include "hpack_p.h"
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qdebug.h>
+
+#include <limits>
+
+QT_BEGIN_NAMESPACE
+
+namespace HPack
+{
+
+HeaderSize header_size(const HttpHeader &header)
+{
+ HeaderSize size(true, 0);
+ for (const HeaderField &field : header) {
+ HeaderSize delta = entry_size(field);
+ if (!delta.first)
+ return HeaderSize();
+ if (std::numeric_limits<quint32>::max() - size.second < delta.second)
+ return HeaderSize();
+ size.second += delta.second;
+ }
+
+ return size;
+}
+
+struct BitPattern
+{
+ BitPattern()
+ : value(),
+ bitLength()
+ {
+ }
+
+ BitPattern(uchar v, uchar len)
+ : value(v),
+ bitLength(len)
+ {
+ }
+
+ uchar value;
+ uchar bitLength;
+};
+
+bool operator == (const BitPattern &lhs, const BitPattern &rhs)
+{
+ return lhs.bitLength == rhs.bitLength && lhs.value == rhs.value;
+}
+
+namespace
+{
+
+using StreamError = BitIStream::Error;
+
+// There are several bit patterns to distinguish header fields:
+// 1 - indexed
+// 01 - literal with incremented indexing
+// 0000 - literal without indexing
+// 0001 - literal, never indexing
+// 001 - dynamic table size update.
+
+// It's always 1 or 0 actually, but the number of bits to extract
+// from the input stream - differs.
+const BitPattern Indexed(1, 1);
+const BitPattern LiteralIncrementalIndexing(1, 2);
+const BitPattern LiteralNoIndexing(0, 4);
+const BitPattern LiteralNeverIndexing(1, 4);
+const BitPattern SizeUpdate(1, 3);
+
+bool is_literal_field(const BitPattern &pattern)
+{
+ return pattern == LiteralIncrementalIndexing
+ || pattern == LiteralNoIndexing
+ || pattern == LiteralNeverIndexing;
+}
+
+void write_bit_pattern(const BitPattern &pattern, BitOStream &outputStream)
+{
+ outputStream.writeBits(pattern.value, pattern.bitLength);
+}
+
+bool read_bit_pattern(const BitPattern &pattern, BitIStream &inputStream)
+{
+ uchar chunk = 0;
+
+ const quint32 bitsRead = inputStream.peekBits(inputStream.streamOffset(),
+ pattern.bitLength, &chunk);
+ if (bitsRead != pattern.bitLength)
+ return false;
+
+ // Since peekBits packs in the most significant bits, shift it!
+ chunk >>= (8 - bitsRead);
+ if (chunk != pattern.value)
+ return false;
+
+ inputStream.skipBits(pattern.bitLength);
+
+ return true;
+}
+
+bool is_request_pseudo_header(const QByteArray &name)
+{
+ return name == ":method" || name == ":scheme" ||
+ name == ":authority" || name == ":path";
+}
+
+} // unnamed namespace
+
+Encoder::Encoder(quint32 size, bool compress)
+ : lookupTable(size, true /*encoder needs search index*/),
+ compressStrings(compress)
+{
+}
+
+quint32 Encoder::dynamicTableSize() const
+{
+ return lookupTable.dynamicDataSize();
+}
+
+bool Encoder::encodeRequest(BitOStream &outputStream, const HttpHeader &header)
+{
+ if (!header.size()) {
+ qDebug("empty header");
+ return false;
+ }
+
+ if (!encodeRequestPseudoHeaders(outputStream, header))
+ return false;
+
+ for (const auto &field : header) {
+ if (is_request_pseudo_header(field.name))
+ continue;
+
+ if (!encodeHeaderField(outputStream, field))
+ return false;
+ }
+
+ return true;
+}
+
+bool Encoder::encodeResponse(BitOStream &outputStream, const HttpHeader &header)
+{
+ if (!header.size()) {
+ qDebug("empty header");
+ return false;
+ }
+
+ if (!encodeResponsePseudoHeaders(outputStream, header))
+ return false;
+
+ for (const auto &field : header) {
+ if (field.name == ":status")
+ continue;
+
+ if (!encodeHeaderField(outputStream, field))
+ return false;
+ }
+
+ return true;
+}
+
+bool Encoder::encodeSizeUpdate(BitOStream &outputStream, quint32 newSize)
+{
+ if (!lookupTable.updateDynamicTableSize(newSize)) {
+ qDebug("failed to update own table size");
+ return false;
+ }
+
+ write_bit_pattern(SizeUpdate, outputStream);
+ outputStream.write(newSize);
+
+ return true;
+}
+
+void Encoder::setMaxDynamicTableSize(quint32 size)
+{
+ // Up to a caller (HTTP2 protocol handler)
+ // to validate this size first.
+ lookupTable.setMaxDynamicTableSize(size);
+}
+
+bool Encoder::encodeRequestPseudoHeaders(BitOStream &outputStream,
+ const HttpHeader &header)
+{
+ // The following pseudo-header fields are defined for HTTP/2 requests:
+ // - The :method pseudo-header field includes the HTTP method
+ // - The :scheme pseudo-header field includes the scheme portion of the target URI
+ // - The :authority pseudo-header field includes the authority portion of the target URI
+ // - The :path pseudo-header field includes the path and query parts of the target URI
+
+ // All HTTP/2 requests MUST include exactly one valid value for the :method,
+ // :scheme, and :path pseudo-header fields, unless it is a CONNECT request
+ // (Section 8.3). An HTTP request that omits mandatory pseudo-header fields
+ // is malformed (Section 8.1.2.6).
+
+ using size_type = decltype(header.size());
+
+ bool methodFound = false;
+ const char *headerName[] = {":authority", ":scheme", ":path"};
+ const size_type nHeaders = sizeof headerName / sizeof headerName[0];
+ bool headerFound[nHeaders] = {};
+
+ for (const auto &field : header) {
+ if (field.name == ":status") {
+ qCritical("invalid pseudo-header (:status) in a request");
+ return false;
+ }
+
+ if (field.name == ":method") {
+ if (methodFound) {
+ qCritical("only one :method pseudo-header is allowed");
+ return false;
+ }
+
+ if (!encodeMethod(outputStream, field))
+ return false;
+ methodFound = true;
+ } else if (field.name == "cookie") {
+ // "crumbs" ...
+ } else {
+ for (size_type j = 0; j < nHeaders; ++j) {
+ if (field.name == headerName[j]) {
+ if (headerFound[j]) {
+ qCritical() << "only one" << headerName[j] << "pseudo-header is allowed";
+ return false;
+ }
+ if (!encodeHeaderField(outputStream, field))
+ return false;
+ headerFound[j] = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!methodFound) {
+ qCritical("mandatory :method pseudo-header not found");
+ return false;
+ }
+
+ // 1: don't demand headerFound[0], as :authority isn't mandatory.
+ for (size_type i = 1; i < nHeaders; ++i) {
+ if (!headerFound[i]) {
+ qCritical() << "mandatory" << headerName[i]
+ << "pseudo-header not found";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool Encoder::encodeHeaderField(BitOStream &outputStream, const HeaderField &field)
+{
+ // TODO: at the moment we never use LiteralNo/Never Indexing ...
+
+ // Here we try:
+ // 1. indexed
+ // 2. literal indexed with indexed name/literal value
+ // 3. literal indexed with literal name/literal value
+ if (const auto index = lookupTable.indexOf(field.name, field.value))
+ return encodeIndexedField(outputStream, index);
+
+ if (const auto index = lookupTable.indexOf(field.name)) {
+ return encodeLiteralField(outputStream, LiteralIncrementalIndexing,
+ index, field.value, compressStrings);
+ }
+
+ return encodeLiteralField(outputStream, LiteralIncrementalIndexing,
+ field.name, field.value, compressStrings);
+}
+
+bool Encoder::encodeMethod(BitOStream &outputStream, const HeaderField &field)
+{
+ Q_ASSERT(field.name == ":method");
+ quint32 index = lookupTable.indexOf(field.name, field.value);
+ if (index)
+ return encodeIndexedField(outputStream, index);
+
+ index = lookupTable.indexOf(field.name);
+ Q_ASSERT(index); // ":method" is always in the static table ...
+ return encodeLiteralField(outputStream, LiteralIncrementalIndexing,
+ index, field.value, compressStrings);
+}
+
+bool Encoder::encodeResponsePseudoHeaders(BitOStream &outputStream, const HttpHeader &header)
+{
+ bool statusFound = false;
+ for (const auto &field : header) {
+ if (is_request_pseudo_header(field.name)) {
+ qCritical() << "invalid pseudo-header" << field.name << "in http response";
+ return false;
+ }
+
+ if (field.name == ":status") {
+ if (statusFound) {
+ qDebug("only one :status pseudo-header is allowed");
+ return false;
+ }
+ if (!encodeHeaderField(outputStream, field))
+ return false;
+ statusFound = true;
+ } else if (field.name == "cookie") {
+ // "crumbs"..
+ }
+ }
+
+ if (!statusFound)
+ qCritical("mandatory :status pseudo-header not found");
+
+ return statusFound;
+}
+
+bool Encoder::encodeIndexedField(BitOStream &outputStream, quint32 index) const
+{
+ Q_ASSERT(lookupTable.indexIsValid(index));
+
+ write_bit_pattern(Indexed, outputStream);
+ outputStream.write(index);
+
+ return true;
+}
+
+bool Encoder::encodeLiteralField(BitOStream &outputStream, const BitPattern &fieldType,
+ const QByteArray &name, const QByteArray &value,
+ bool withCompression)
+{
+ Q_ASSERT(is_literal_field(fieldType));
+ // According to HPACK, the bit pattern is
+ // 01 | 000000 (integer 0 that fits into 6-bit prefix),
+ // since integers always end on byte boundary,
+ // this also implies that we always start at bit offset == 0.
+ if (outputStream.bitLength() % 8) {
+ qCritical("invalid bit offset");
+ return false;
+ }
+
+ if (fieldType == LiteralIncrementalIndexing) {
+ if (!lookupTable.prependField(name, value))
+ qDebug("failed to prepend a new field");
+ }
+
+ write_bit_pattern(fieldType, outputStream);
+
+ outputStream.write(0);
+ outputStream.write(name, withCompression);
+ outputStream.write(value, withCompression);
+
+ return true;
+}
+
+bool Encoder::encodeLiteralField(BitOStream &outputStream, const BitPattern &fieldType,
+ quint32 nameIndex, const QByteArray &value,
+ bool withCompression)
+{
+ Q_ASSERT(is_literal_field(fieldType));
+
+ QByteArray name;
+ const bool found = lookupTable.fieldName(nameIndex, &name);
+ Q_UNUSED(found) Q_ASSERT(found);
+
+ if (fieldType == LiteralIncrementalIndexing) {
+ if (!lookupTable.prependField(name, value))
+ qDebug("failed to prepend a new field");
+ }
+
+ write_bit_pattern(fieldType, outputStream);
+ outputStream.write(nameIndex);
+ outputStream.write(value, withCompression);
+
+ return true;
+}
+
+Decoder::Decoder(quint32 size)
+ : lookupTable{size, false /* we do not need search index ... */}
+{
+}
+
+bool Decoder::decodeHeaderFields(BitIStream &inputStream)
+{
+ header.clear();
+ while (true) {
+ if (read_bit_pattern(Indexed, inputStream)) {
+ if (!decodeIndexedField(inputStream))
+ return false;
+ } else if (read_bit_pattern(LiteralIncrementalIndexing, inputStream)) {
+ if (!decodeLiteralField(LiteralIncrementalIndexing, inputStream))
+ return false;
+ } else if (read_bit_pattern(LiteralNoIndexing, inputStream)) {
+ if (!decodeLiteralField(LiteralNoIndexing, inputStream))
+ return false;
+ } else if (read_bit_pattern(LiteralNeverIndexing, inputStream)) {
+ if (!decodeLiteralField(LiteralNeverIndexing, inputStream))
+ return false;
+ } else if (read_bit_pattern(SizeUpdate, inputStream)) {
+ if (!decodeSizeUpdate(inputStream))
+ return false;
+ } else {
+ return inputStream.bitLength() == inputStream.streamOffset();
+ }
+ }
+
+ return false;
+}
+
+quint32 Decoder::dynamicTableSize() const
+{
+ return lookupTable.dynamicDataSize();
+}
+
+void Decoder::setMaxDynamicTableSize(quint32 size)
+{
+ // Up to a caller (HTTP2 protocol handler)
+ // to validate this size first.
+ lookupTable.setMaxDynamicTableSize(size);
+}
+
+bool Decoder::decodeIndexedField(BitIStream &inputStream)
+{
+ quint32 index = 0;
+ if (inputStream.read(&index)) {
+ if (!index) {
+ // "The index value of 0 is not used.
+ // It MUST be treated as a decoding
+ // error if found in an indexed header
+ // field representation."
+ return false;
+ }
+
+ QByteArray name, value;
+ if (lookupTable.field(index, &name, &value))
+ return processDecodedField(Indexed, name, value);
+ } else {
+ handleStreamError(inputStream);
+ }
+
+ return false;
+}
+
+bool Decoder::decodeSizeUpdate(BitIStream &inputStream)
+{
+ // For now, just read and skip bits.
+ quint32 maxSize = 0;
+ if (inputStream.read(&maxSize)) {
+ if (!lookupTable.updateDynamicTableSize(maxSize))
+ return false;
+
+ return true;
+ }
+
+ handleStreamError(inputStream);
+ return false;
+}
+
+bool Decoder::decodeLiteralField(const BitPattern &fieldType, BitIStream &inputStream)
+{
+ // https://http2.github.io/http2-spec/compression.html
+ // 6.2.1, 6.2.2, 6.2.3
+ // Format for all 'literal' is similar,
+ // the difference - is how we update/not our lookup table.
+ quint32 index = 0;
+ if (inputStream.read(&index)) {
+ QByteArray name;
+ if (!index) {
+ // Read a string.
+ if (!inputStream.read(&name)) {
+ handleStreamError(inputStream);
+ return false;
+ }
+ } else {
+ if (!lookupTable.fieldName(index, &name))
+ return false;
+ }
+
+ QByteArray value;
+ if (inputStream.read(&value))
+ return processDecodedField(fieldType, name, value);
+ }
+
+ handleStreamError(inputStream);
+
+ return false;
+}
+
+bool Decoder::processDecodedField(const BitPattern &fieldType,
+ const QByteArray &name,
+ const QByteArray &value)
+{
+ if (fieldType == LiteralIncrementalIndexing) {
+ if (!lookupTable.prependField(name, value))
+ return false;
+ }
+
+ header.push_back(HeaderField(name, value));
+ return true;
+}
+
+void Decoder::handleStreamError(BitIStream &inputStream)
+{
+ const auto errorCode(inputStream.error());
+ if (errorCode == StreamError::NoError)
+ return;
+
+ // For now error handling not needed here,
+ // HTTP2 layer will end with session error/COMPRESSION_ERROR.
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/access/http2/hpack_p.h b/src/network/access/http2/hpack_p.h
new file mode 100644
index 0000000000..6a1d30d87b
--- /dev/null
+++ b/src/network/access/http2/hpack_p.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HPACK_P_H
+#define HPACK_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "hpacktable_p.h"
+
+#include <QtCore/qglobal.h>
+
+#include <vector>
+
+QT_BEGIN_NAMESPACE
+
+class QByteArray;
+
+namespace HPack
+{
+
+using HttpHeader = std::vector<HeaderField>;
+HeaderSize header_size(const HttpHeader &header);
+
+class Q_AUTOTEST_EXPORT Encoder
+{
+public:
+ Encoder(quint32 maxTableSize, bool compressStrings);
+
+ quint32 dynamicTableSize() const;
+
+ bool encodeRequest(class BitOStream &outputStream,
+ const HttpHeader &header);
+ bool encodeResponse(BitOStream &outputStream,
+ const HttpHeader &header);
+
+ bool encodeSizeUpdate(BitOStream &outputStream,
+ quint32 newSize);
+
+ void setMaxDynamicTableSize(quint32 size);
+
+private:
+ bool encodeRequestPseudoHeaders(BitOStream &outputStream,
+ const HttpHeader &header);
+ bool encodeHeaderField(BitOStream &outputStream,
+ const HeaderField &field);
+ bool encodeMethod(BitOStream &outputStream,
+ const HeaderField &field);
+
+ bool encodeResponsePseudoHeaders(BitOStream &outputStream,
+ const HttpHeader &header);
+
+ bool encodeIndexedField(BitOStream &outputStream, quint32 index) const;
+
+
+ bool encodeLiteralField(BitOStream &outputStream,
+ const struct BitPattern &fieldType,
+ quint32 nameIndex,
+ const QByteArray &value,
+ bool withCompression);
+
+ bool encodeLiteralField(BitOStream &outputStream,
+ const BitPattern &fieldType,
+ const QByteArray &name,
+ const QByteArray &value,
+ bool withCompression);
+
+ FieldLookupTable lookupTable;
+ bool compressStrings;
+};
+
+class Q_AUTOTEST_EXPORT Decoder
+{
+public:
+ Decoder(quint32 maxTableSize);
+
+ bool decodeHeaderFields(class BitIStream &inputStream);
+
+ const HttpHeader &decodedHeader() const
+ {
+ return header;
+ }
+
+ quint32 dynamicTableSize() const;
+
+ void setMaxDynamicTableSize(quint32 size);
+
+private:
+
+ bool decodeIndexedField(BitIStream &inputStream);
+ bool decodeSizeUpdate(BitIStream &inputStream);
+ bool decodeLiteralField(const BitPattern &fieldType,
+ BitIStream &inputStream);
+
+ bool processDecodedField(const BitPattern &fieldType,
+ const QByteArray &name,
+ const QByteArray &value);
+
+ void handleStreamError(BitIStream &inputStream);
+
+ HttpHeader header;
+ FieldLookupTable lookupTable;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/network/access/http2/hpacktable.cpp b/src/network/access/http2/hpacktable.cpp
new file mode 100644
index 0000000000..db9574e2bc
--- /dev/null
+++ b/src/network/access/http2/hpacktable.cpp
@@ -0,0 +1,533 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "hpacktable_p.h"
+
+#include <QtCore/qdebug.h>
+
+#include <algorithm>
+#include <cstring>
+#include <limits>
+
+
+QT_BEGIN_NAMESPACE
+
+namespace HPack
+{
+
+HeaderSize entry_size(const QByteArray &name, const QByteArray &value)
+{
+ // 32 comes from HPACK:
+ // "4.1 Calculating Table Size
+ // Note: The additional 32 octets account for an estimated overhead associated
+ // with an entry. For example, an entry structure using two 64-bit pointers
+ // to reference the name and the value of the entry and two 64-bit integers
+ // for counting the number of references to the name and value would have
+ // 32 octets of overhead."
+
+ const unsigned sum = unsigned(name.size()) + value.size();
+ if (std::numeric_limits<unsigned>::max() - 32 < sum)
+ return HeaderSize();
+ if (sum + 32 > std::numeric_limits<quint32>::max())
+ return HeaderSize();
+ return HeaderSize(true, quint32(sum + 32));
+}
+
+namespace
+{
+
+int compare(const QByteArray &lhs, const QByteArray &rhs)
+{
+ if (const int minLen = std::min(lhs.size(), rhs.size())) {
+ // We use memcmp, since strings in headers are allowed
+ // to contain '\0'.
+ const int cmp = std::memcmp(lhs.constData(), rhs.constData(), minLen);
+ if (cmp)
+ return cmp;
+ }
+
+ return lhs.size() - rhs.size();
+}
+
+} // unnamed namespace
+
+FieldLookupTable::SearchEntry::SearchEntry()
+ : field(),
+ chunk(),
+ offset(),
+ table()
+{
+}
+
+FieldLookupTable::SearchEntry::SearchEntry(const HeaderField *f,
+ const Chunk *c,
+ quint32 o,
+ const FieldLookupTable *t)
+ : field(f),
+ chunk(c),
+ offset(o),
+ table(t)
+{
+ Q_ASSERT(field);
+}
+
+bool FieldLookupTable::SearchEntry::operator < (const SearchEntry &rhs)const
+{
+ Q_ASSERT(field);
+ Q_ASSERT(rhs.field);
+
+ int cmp = compare(field->name, rhs.field->name);
+ if (cmp)
+ return cmp < 0;
+
+ cmp = compare(field->value, rhs.field->value);
+ if (cmp)
+ return cmp < 0;
+
+ if (!chunk) // 'this' is not in the searchIndex.
+ return rhs.chunk;
+
+ if (!rhs.chunk) // not in the searchIndex.
+ return false;
+
+ Q_ASSERT(table);
+ Q_ASSERT(rhs.table == table);
+
+ const quint32 leftChunkIndex = table->indexOfChunk(chunk);
+ const quint32 rightChunkIndex = rhs.table->indexOfChunk(rhs.chunk);
+
+ // Later added - smaller is chunk index (since we push_front).
+ if (leftChunkIndex != rightChunkIndex)
+ return leftChunkIndex > rightChunkIndex;
+
+ // Later added - smaller is offset.
+ return offset > rhs.offset;
+}
+
+// This data is from HPACK's specs and it's quite
+// conveniently sorted == works with binary search as it is.
+// Later this can probably change and instead of simple
+// vector we'll just reuse FieldLookupTable.
+// TODO: it makes sense to generate this table while ...
+// configuring/building Qt (some script downloading/parsing/generating
+// would be quite handy).
+const std::vector<HeaderField> &staticTable()
+{
+ static std::vector<HeaderField> table = {
+ {":authority", ""},
+ {":method", "GET"},
+ {":method", "POST"},
+ {":path", "/"},
+ {":path", "/index.html"},
+ {":scheme", "http"},
+ {":scheme", "https"},
+ {":status", "200"},
+ {":status", "204"},
+ {":status", "206"},
+ {":status", "304"},
+ {":status", "400"},
+ {":status", "404"},
+ {":status", "500"},
+ {"accept-charset", ""},
+ {"accept-encoding", "gzip, deflate"},
+ {"accept-language", ""},
+ {"accept-ranges", ""},
+ {"accept", ""},
+ {"access-control-allow-origin", ""},
+ {"age", ""},
+ {"allow", ""},
+ {"authorization", ""},
+ {"cache-control", ""},
+ {"content-disposition", ""},
+ {"content-encoding", ""},
+ {"content-language", ""},
+ {"content-length", ""},
+ {"content-location", ""},
+ {"content-range", ""},
+ {"content-type", ""},
+ {"cookie", ""},
+ {"date", ""},
+ {"etag", ""},
+ {"expect", ""},
+ {"expires", ""},
+ {"from", ""},
+ {"host", ""},
+ {"if-match", ""},
+ {"if-modified-since", ""},
+ {"if-none-match", ""},
+ {"if-range", ""},
+ {"if-unmodified-since", ""},
+ {"last-modified", ""},
+ {"link", ""},
+ {"location", ""},
+ {"max-forwards", ""},
+ {"proxy-authenticate", ""},
+ {"proxy-authorization", ""},
+ {"range", ""},
+ {"referer", ""},
+ {"refresh", ""},
+ {"retry-after", ""},
+ {"server", ""},
+ {"set-cookie", ""},
+ {"strict-transport-security", ""},
+ {"transfer-encoding", ""},
+ {"user-agent", ""},
+ {"vary", ""},
+ {"via", ""},
+ {"www-authenticate", ""}
+ };
+
+ return table;
+}
+
+FieldLookupTable::FieldLookupTable(quint32 maxSize, bool use)
+ : maxTableSize(maxSize),
+ tableCapacity(maxSize),
+ useIndex(use),
+ nDynamic(),
+ begin(),
+ end(),
+ dataSize()
+{
+}
+
+
+bool FieldLookupTable::prependField(const QByteArray &name, const QByteArray &value)
+{
+ const auto entrySize = entry_size(name, value);
+ if (!entrySize.first)
+ return false;
+
+ if (entrySize.second > tableCapacity) {
+ clearDynamicTable();
+ return true;
+ }
+
+ while (nDynamic && tableCapacity - dataSize < entrySize.second)
+ evictEntry();
+
+ if (!begin) {
+ // Either no more space or empty table ...
+ chunks.push_front(ChunkPtr(new Chunk(ChunkSize)));
+ end += ChunkSize;
+ begin = ChunkSize;
+ }
+
+ --begin;
+
+ dataSize += entrySize.second;
+ ++nDynamic;
+
+ auto &newField = front();
+ newField.name = name;
+ newField.value = value;
+
+ if (useIndex) {
+ const auto result = searchIndex.insert(frontKey());
+ Q_UNUSED(result) Q_ASSERT(result.second);
+ }
+
+ return true;
+}
+
+void FieldLookupTable::evictEntry()
+{
+ if (!nDynamic)
+ return;
+
+ Q_ASSERT(end != begin);
+
+ if (useIndex) {
+ const auto res = searchIndex.erase(backKey());
+ Q_UNUSED(res) Q_ASSERT(res == 1);
+ }
+
+ const HeaderField &field = back();
+ const auto entrySize = entry_size(field);
+ Q_ASSERT(entrySize.first);
+ Q_ASSERT(dataSize >= entrySize.second);
+ dataSize -= entrySize.second;
+
+ --nDynamic;
+ --end;
+
+ if (end == begin) {
+ Q_ASSERT(chunks.size() == 1);
+ end = ChunkSize;
+ begin = end;
+ } else if (!(end % ChunkSize)) {
+ chunks.pop_back();
+ }
+}
+
+quint32 FieldLookupTable::numberOfEntries() const
+{
+ return quint32(staticTable().size()) + nDynamic;
+}
+
+quint32 FieldLookupTable::numberOfStaticEntries() const
+{
+ return quint32(staticTable().size());
+}
+
+quint32 FieldLookupTable::numberOfDynamicEntries() const
+{
+ return nDynamic;
+}
+
+quint32 FieldLookupTable::dynamicDataSize() const
+{
+ return dataSize;
+}
+
+void FieldLookupTable::clearDynamicTable()
+{
+ searchIndex.clear();
+ chunks.clear();
+ begin = 0;
+ end = 0;
+ nDynamic = 0;
+ dataSize = 0;
+}
+
+bool FieldLookupTable::indexIsValid(quint32 index) const
+{
+ return index && index <= staticTable().size() + nDynamic;
+}
+
+quint32 FieldLookupTable::indexOf(const QByteArray &name, const QByteArray &value)const
+{
+ // Start from the static part first:
+ const auto &table = staticTable();
+ const HeaderField field(name, value);
+ const auto staticPos = std::lower_bound(table.begin(), table.end(), field,
+ [](const HeaderField &lhs, const HeaderField &rhs) {
+ int cmp = compare(lhs.name, rhs.name);
+ if (cmp)
+ return cmp < 0;
+ return compare(lhs.value, rhs.value) < 0;
+ });
+ if (staticPos != table.end()) {
+ if (staticPos->name == name && staticPos->value == value)
+ return staticPos - table.begin() + 1;
+ }
+
+ // Now we have to lookup in our dynamic part ...
+ if (!useIndex) {
+ qCritical("lookup in dynamic table requires search index enabled");
+ return 0;
+ }
+
+ const SearchEntry key(&field, nullptr, 0, this);
+ const auto pos = searchIndex.lower_bound(key);
+ if (pos != searchIndex.end()) {
+ const HeaderField &found = *pos->field;
+ if (found.name == name && found.value == value)
+ return keyToIndex(*pos);
+ }
+
+ return 0;
+}
+
+quint32 FieldLookupTable::indexOf(const QByteArray &name) const
+{
+ // Start from the static part first:
+ const auto &table = staticTable();
+ const HeaderField field(name, QByteArray());
+ const auto staticPos = std::lower_bound(table.begin(), table.end(), field,
+ [](const HeaderField &lhs, const HeaderField &rhs) {
+ return compare(lhs.name, rhs.name) < 0;
+ });
+ if (staticPos != table.end()) {
+ if (staticPos->name == name)
+ return staticPos - table.begin() + 1;
+ }
+
+ // Now we have to lookup in our dynamic part ...
+ if (!useIndex) {
+ qCritical("lookup in dynamic table requires search index enabled");
+ return 0;
+ }
+
+ const SearchEntry key(&field, nullptr, 0, this);
+ const auto pos = searchIndex.lower_bound(key);
+ if (pos != searchIndex.end()) {
+ const HeaderField &found = *pos->field;
+ if (found.name == name)
+ return keyToIndex(*pos);
+ }
+
+ return 0;
+}
+
+bool FieldLookupTable::field(quint32 index, QByteArray *name, QByteArray *value) const
+{
+ Q_ASSERT(name);
+ Q_ASSERT(value);
+
+ if (!indexIsValid(index))
+ return false;
+
+ const auto &table = staticTable();
+ if (index - 1 < table.size()) {
+ *name = table[index - 1].name;
+ *value = table[index - 1].value;
+ return true;
+ }
+
+ index = index - 1 - quint32(table.size()) + begin;
+ const auto chunkIndex = index / ChunkSize;
+ Q_ASSERT(chunkIndex < chunks.size());
+ const auto offset = index % ChunkSize;
+ const HeaderField &found = (*chunks[chunkIndex])[offset];
+ *name = found.name;
+ *value = found.value;
+
+ return true;
+}
+
+bool FieldLookupTable::fieldName(quint32 index, QByteArray *dst) const
+{
+ Q_ASSERT(dst);
+ return field(index, dst, &dummyDst);
+}
+
+bool FieldLookupTable::fieldValue(quint32 index, QByteArray *dst) const
+{
+ Q_ASSERT(dst);
+ return field(index, &dummyDst, dst);
+}
+
+const HeaderField &FieldLookupTable::front() const
+{
+ Q_ASSERT(nDynamic && begin != end && chunks.size());
+ return (*chunks[0])[begin];
+}
+
+HeaderField &FieldLookupTable::front()
+{
+ Q_ASSERT(nDynamic && begin != end && chunks.size());
+ return (*chunks[0])[begin];
+}
+
+const HeaderField &FieldLookupTable::back() const
+{
+ Q_ASSERT(nDynamic && end && end != begin);
+
+ const quint32 absIndex = end - 1;
+ const quint32 chunkIndex = absIndex / ChunkSize;
+ Q_ASSERT(chunkIndex < chunks.size());
+ const quint32 offset = absIndex % ChunkSize;
+ return (*chunks[chunkIndex])[offset];
+}
+
+quint32 FieldLookupTable::indexOfChunk(const Chunk *chunk) const
+{
+ Q_ASSERT(chunk);
+
+ for (size_type i = 0; i < chunks.size(); ++i) {
+ if (chunks[i].get() == chunk)
+ return quint32(i);
+ }
+
+ Q_UNREACHABLE();
+ return 0;
+}
+
+quint32 FieldLookupTable::keyToIndex(const SearchEntry &key) const
+{
+ Q_ASSERT(key.chunk);
+
+ const auto chunkIndex = indexOfChunk(key.chunk);
+ const auto offset = key.offset;
+ Q_ASSERT(offset < ChunkSize);
+ Q_ASSERT(chunkIndex || offset >= begin);
+
+ return quint32(offset + chunkIndex * ChunkSize - begin + 1 + staticTable().size());
+}
+
+FieldLookupTable::SearchEntry FieldLookupTable::frontKey() const
+{
+ Q_ASSERT(chunks.size() && end != begin);
+ return SearchEntry(&front(), chunks.front().get(), begin, this);
+}
+
+FieldLookupTable::SearchEntry FieldLookupTable::backKey() const
+{
+ Q_ASSERT(chunks.size() && end != begin);
+
+ const HeaderField &field = back();
+ const quint32 absIndex = end - 1;
+ const auto offset = absIndex % ChunkSize;
+ const auto chunk = chunks[absIndex / ChunkSize].get();
+
+ return SearchEntry(&field, chunk, offset, this);
+}
+
+bool FieldLookupTable::updateDynamicTableSize(quint32 size)
+{
+ if (!size) {
+ clearDynamicTable();
+ return true;
+ }
+
+ if (size > maxTableSize)
+ return false;
+
+ tableCapacity = size;
+ while (nDynamic && dataSize > tableCapacity)
+ evictEntry();
+
+ return true;
+}
+
+void FieldLookupTable::setMaxDynamicTableSize(quint32 size)
+{
+ // This is for an external user, for example, HTTP2 protocol
+ // layer that can receive SETTINGS frame from its peer.
+ // No validity checks here, up to this external user.
+ // We update max size and capacity (this can also result in
+ // items evicted or even dynamic table completely cleared).
+ maxTableSize = size;
+ updateDynamicTableSize(size);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/access/http2/hpacktable_p.h b/src/network/access/http2/hpacktable_p.h
new file mode 100644
index 0000000000..aaea89b986
--- /dev/null
+++ b/src/network/access/http2/hpacktable_p.h
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HPACKTABLE_P_H
+#define HPACKTABLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qglobal.h>
+#include <QtCore/qpair.h>
+
+#include <vector>
+#include <memory>
+#include <deque>
+#include <set>
+
+QT_BEGIN_NAMESPACE
+
+namespace HPack
+{
+
+struct Q_AUTOTEST_EXPORT HeaderField
+{
+ HeaderField()
+ {
+ }
+
+ HeaderField(const QByteArray &n, const QByteArray &v)
+ : name(n),
+ value(v)
+ {
+ }
+
+ bool operator == (const HeaderField &rhs) const
+ {
+ return name == rhs.name && value == rhs.value;
+ }
+
+ QByteArray name;
+ QByteArray value;
+};
+
+using HeaderSize = QPair<bool, quint32>;
+
+HeaderSize entry_size(const QByteArray &name, const QByteArray &value);
+
+inline HeaderSize entry_size(const HeaderField &entry)
+{
+ return entry_size(entry.name, entry.value);
+}
+
+/*
+ Lookup table consists of two parts (HPACK, 2.3):
+ the immutable static table (pre-defined by HPACK's specs)
+ and dynamic table which is updated while
+ compressing/decompressing headers.
+
+ Table must provide/implement:
+ 1. Fast random access - we read fields' indices from
+ HPACK's bit stream.
+ 2. FIFO for dynamic part - to push new items to the front
+ and evict them from the back (HPACK, 2.3.2).
+ 3. Fast lookup - encoder receives pairs of strings
+ (name|value) and it has to find an index for a pair
+ as the whole or for a name at least (if it's already
+ in either static or dynamic table).
+
+ Static table is an immutable vector.
+
+ Dynamic part is implemented in a way similar to std::deque -
+ it's a vector of pointers to chunks. Each chunk is a vector of
+ (name|value) pairs. Once allocated with a fixed size, chunk
+ never re-allocates its data, so entries' addresses do not change.
+ We add new chunks prepending them to the front of a vector,
+ in each chunk we fill (name|value) pairs starting from the back
+ of the chunk (this simplifies item eviction/FIFO).
+ Given a 'linear' index we can find a chunk number and
+ offset in this chunk - random access.
+
+ Lookup in a static part is straightforward:
+ it's an (immutable) vector, data is sorted,
+ contains no duplicates, we use binary search comparing string values.
+
+ To provide a lookup in dynamic table faster than a linear search,
+ we have an std::set of 'SearchEntries', where each entry contains:
+ - a pointer to a (name|value) pair (to compare
+ name|value strings).
+ - a pointer to a chunk containing this pair and
+ - an offset within this chunk - to calculate a
+ 'linear' index.
+
+ Entries in a table can be duplicated (HPACK, 2.3.2),
+ if we evict an entry, we must update our index removing
+ the exactly right key, thus keys in this set are sorted
+ by name|value pairs first, and then by chunk index/offset
+ (so that NewSearchEntryKey < OldSearchEntry even if strings
+ are equal).
+*/
+
+class Q_AUTOTEST_EXPORT FieldLookupTable
+{
+public:
+ enum
+ {
+ ChunkSize = 16,
+ DefaultSize = 4096 // Recommended by HTTP2.
+ };
+
+ FieldLookupTable(quint32 maxTableSize, bool useIndex);
+
+ bool prependField(const QByteArray &name, const QByteArray &value);
+ void evictEntry();
+
+ quint32 numberOfEntries() const;
+ quint32 numberOfStaticEntries() const;
+ quint32 numberOfDynamicEntries() const;
+ quint32 dynamicDataSize() const;
+ void clearDynamicTable();
+
+ bool indexIsValid(quint32 index) const;
+ quint32 indexOf(const QByteArray &name, const QByteArray &value) const;
+ quint32 indexOf(const QByteArray &name) const;
+ bool field(quint32 index, QByteArray *name, QByteArray *value) const;
+ bool fieldName(quint32 index, QByteArray *dst) const;
+ bool fieldValue(quint32 index, QByteArray *dst) const;
+
+ bool updateDynamicTableSize(quint32 size);
+ void setMaxDynamicTableSize(quint32 size);
+
+private:
+ // Table's maximum size is controlled
+ // by SETTINGS_HEADER_TABLE_SIZE (HTTP/2, 6.5.2).
+ quint32 maxTableSize;
+ // The tableCapacity is how many bytes the table
+ // can currently hold. It cannot exceed maxTableSize.
+ // It can be modified by a special message in
+ // the HPACK bit stream (HPACK, 6.3).
+ quint32 tableCapacity;
+
+ using Chunk = std::vector<HeaderField>;
+ using ChunkPtr = std::unique_ptr<Chunk>;
+ std::deque<ChunkPtr> chunks;
+ using size_type = std::deque<ChunkPtr>::size_type;
+
+ struct SearchEntry;
+ friend struct SearchEntry;
+
+ struct SearchEntry
+ {
+ SearchEntry();
+ SearchEntry(const HeaderField *f, const Chunk *c,
+ quint32 o, const FieldLookupTable *t);
+
+ const HeaderField *field;
+ const Chunk *chunk;
+ const quint32 offset;
+ const FieldLookupTable *table;
+
+ bool operator < (const SearchEntry &rhs) const;
+ };
+
+ bool useIndex;
+ std::set<SearchEntry> searchIndex;
+
+ SearchEntry frontKey() const;
+ SearchEntry backKey() const;
+
+ bool fieldAt(quint32 index, HeaderField *field) const;
+
+ const HeaderField &front() const;
+ HeaderField &front();
+ const HeaderField &back() const;
+
+ quint32 nDynamic;
+ quint32 begin;
+ quint32 end;
+ quint32 dataSize;
+
+ quint32 indexOfChunk(const Chunk *chunk) const;
+ quint32 keyToIndex(const SearchEntry &key) const;
+
+ mutable QByteArray dummyDst;
+
+ Q_DISABLE_COPY(FieldLookupTable);
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/network/access/http2/http2.pri b/src/network/access/http2/http2.pri
new file mode 100644
index 0000000000..2157e35e2f
--- /dev/null
+++ b/src/network/access/http2/http2.pri
@@ -0,0 +1,11 @@
+HEADERS += \
+ access/http2/bitstreams_p.h \
+ access/http2/huffman_p.h \
+ access/http2/hpack_p.h \
+ access/http2/hpacktable_p.h
+
+SOURCES += \
+ access/http2/bitstreams.cpp \
+ access/http2/huffman.cpp \
+ access/http2/hpack.cpp \
+ access/http2/hpacktable.cpp
diff --git a/src/network/access/http2/huffman.cpp b/src/network/access/http2/huffman.cpp
new file mode 100644
index 0000000000..0c1aa54dd6
--- /dev/null
+++ b/src/network/access/http2/huffman.cpp
@@ -0,0 +1,573 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bitstreams_p.h"
+#include "huffman_p.h"
+
+#include <QtCore/qbytearray.h>
+
+#include <algorithm>
+#include <limits>
+
+QT_BEGIN_NAMESPACE
+
+namespace HPack
+{
+
+/*
+ The static Huffman code used here was extracted from:
+ https://http2.github.io/http2-spec/compression.html#huffman.code
+
+ This code was generated from statistics obtained on a large
+ sample of HTTP headers. It is a canonical Huffman code
+ with some tweaking to ensure that no symbol has a unique
+ code length. All codes were left-aligned - for implementation
+ convenience.
+
+ Using binary trees to implement decoding would be prohibitively
+ expensive (both memory and time-wise). Instead we use a table-based
+ approach and any given code itself works as an index into such table(s).
+ We have 256 possible byte values and code lengths in
+ a range [5, 26]. This would require a huge table (and most of entries
+ would be 'wasted', since we only have to encode 256 elements).
+ Instead we use multi-level tables. The first level table
+ is using 9-bit length index; some entries in this table are 'terminal',
+ some reference the next level table(s).
+
+ For example, bytes with values 48 and 49 (ASCII codes for '0' and '1')
+ both have code length 5, Huffman codes are: 00000 and 00001. They
+ both are placed in the 'root' table,
+ the 'root' table has index length == 9:
+ [00000 | 4 remaining bits]
+ ...
+ [00001 | 4 remaining bits]
+
+ All entires with indices between these two will 'point' to value 48
+ with bitLength == 5 so that bit stream (for example) 000001010 will be
+ decoded as: 48 + "put 1010 back into bitstream".
+
+ A good description can be found here:
+ http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art007
+ or just google "Efficient Huffman Decoding".
+ Also see comments below about 'filling holes'.
+*/
+
+namespace
+{
+
+const CodeEntry staticHuffmanCodeTable[]
+{
+ { 0, 0xffc00000ul, 13}, // 11111111|11000
+ { 1, 0xffffb000ul, 23}, // 11111111|11111111|1011000
+ { 2, 0xfffffe20ul, 28}, // 11111111|11111111|11111110|0010
+ { 3, 0xfffffe30ul, 28}, // 11111111|11111111|11111110|0011
+ { 4, 0xfffffe40ul, 28}, // 11111111|11111111|11111110|0100
+ { 5, 0xfffffe50ul, 28}, // 11111111|11111111|11111110|0101
+ { 6, 0xfffffe60ul, 28}, // 11111111|11111111|11111110|0110
+ { 7, 0xfffffe70ul, 28}, // 11111111|11111111|11111110|0111
+ { 8, 0xfffffe80ul, 28}, // 11111111|11111111|11111110|1000
+ { 9, 0xffffea00ul, 24}, // 11111111|11111111|11101010
+ { 10, 0xfffffff0ul, 30}, // 11111111|11111111|11111111|111100
+ { 11, 0xfffffe90ul, 28}, // 11111111|11111111|11111110|1001
+ { 12, 0xfffffea0ul, 28}, // 11111111|11111111|11111110|1010
+ { 13, 0xfffffff4ul, 30}, // 11111111|11111111|11111111|111101
+ { 14, 0xfffffeb0ul, 28}, // 11111111|11111111|11111110|1011
+ { 15, 0xfffffec0ul, 28}, // 11111111|11111111|11111110|1100
+ { 16, 0xfffffed0ul, 28}, // 11111111|11111111|11111110|1101
+ { 17, 0xfffffee0ul, 28}, // 11111111|11111111|11111110|1110
+ { 18, 0xfffffef0ul, 28}, // 11111111|11111111|11111110|1111
+ { 19, 0xffffff00ul, 28}, // 11111111|11111111|11111111|0000
+ { 20, 0xffffff10ul, 28}, // 11111111|11111111|11111111|0001
+ { 21, 0xffffff20ul, 28}, // 11111111|11111111|11111111|0010
+ { 22, 0xfffffff8ul, 30}, // 11111111|11111111|11111111|111110
+ { 23, 0xffffff30ul, 28}, // 11111111|11111111|11111111|0011
+ { 24, 0xffffff40ul, 28}, // 11111111|11111111|11111111|0100
+ { 25, 0xffffff50ul, 28}, // 11111111|11111111|11111111|0101
+ { 26, 0xffffff60ul, 28}, // 11111111|11111111|11111111|0110
+ { 27, 0xffffff70ul, 28}, // 11111111|11111111|11111111|0111
+ { 28, 0xffffff80ul, 28}, // 11111111|11111111|11111111|1000
+ { 29, 0xffffff90ul, 28}, // 11111111|11111111|11111111|1001
+ { 30, 0xffffffa0ul, 28}, // 11111111|11111111|11111111|1010
+ { 31, 0xffffffb0ul, 28}, // 11111111|11111111|11111111|1011
+ { 32, 0x50000000ul, 6}, // ' ' 010100
+ { 33, 0xfe000000ul, 10}, // '!' 11111110|00
+ { 34, 0xfe400000ul, 10}, // '"' 11111110|01
+ { 35, 0xffa00000ul, 12}, // '#' 11111111|1010
+ { 36, 0xffc80000ul, 13}, // '$' 11111111|11001
+ { 37, 0x54000000ul, 6}, // '%' 010101
+ { 38, 0xf8000000ul, 8}, // '&' 11111000
+ { 39, 0xff400000ul, 11}, // ''' 11111111|010
+ { 40, 0xfe800000ul, 10}, // '(' 11111110|10
+ { 41, 0xfec00000ul, 10}, // ')' 11111110|11
+ { 42, 0xf9000000ul, 8}, // '*' 11111001
+ { 43, 0xff600000ul, 11}, // '+' 11111111|011
+ { 44, 0xfa000000ul, 8}, // ',' 11111010
+ { 45, 0x58000000ul, 6}, // '-' 010110
+ { 46, 0x5c000000ul, 6}, // '.' 010111
+ { 47, 0x60000000ul, 6}, // '/' 011000
+ { 48, 0x00000000ul, 5}, // '0' 00000
+ { 49, 0x08000000ul, 5}, // '1' 00001
+ { 50, 0x10000000ul, 5}, // '2' 00010
+ { 51, 0x64000000ul, 6}, // '3' 011001
+ { 52, 0x68000000ul, 6}, // '4' 011010
+ { 53, 0x6c000000ul, 6}, // '5' 011011
+ { 54, 0x70000000ul, 6}, // '6' 011100
+ { 55, 0x74000000ul, 6}, // '7' 011101
+ { 56, 0x78000000ul, 6}, // '8' 011110
+ { 57, 0x7c000000ul, 6}, // '9' 011111
+ { 58, 0xb8000000ul, 7}, // ':' 1011100
+ { 59, 0xfb000000ul, 8}, // ';' 11111011
+ { 60, 0xfff80000ul, 15}, // '<' 11111111|1111100
+ { 61, 0x80000000ul, 6}, // '=' 100000
+ { 62, 0xffb00000ul, 12}, // '>' 11111111|1011
+ { 63, 0xff000000ul, 10}, // '?' 11111111|00
+ { 64, 0xffd00000ul, 13}, // '@' 11111111|11010
+ { 65, 0x84000000ul, 6}, // 'A' 100001
+ { 66, 0xba000000ul, 7}, // 'B' 1011101
+ { 67, 0xbc000000ul, 7}, // 'C' 1011110
+ { 68, 0xbe000000ul, 7}, // 'D' 1011111
+ { 69, 0xc0000000ul, 7}, // 'E' 1100000
+ { 70, 0xc2000000ul, 7}, // 'F' 1100001
+ { 71, 0xc4000000ul, 7}, // 'G' 1100010
+ { 72, 0xc6000000ul, 7}, // 'H' 1100011
+ { 73, 0xc8000000ul, 7}, // 'I' 1100100
+ { 74, 0xca000000ul, 7}, // 'J' 1100101
+ { 75, 0xcc000000ul, 7}, // 'K' 1100110
+ { 76, 0xce000000ul, 7}, // 'L' 1100111
+ { 77, 0xd0000000ul, 7}, // 'M' 1101000
+ { 78, 0xd2000000ul, 7}, // 'N' 1101001
+ { 79, 0xd4000000ul, 7}, // 'O' 1101010
+ { 80, 0xd6000000ul, 7}, // 'P' 1101011
+ { 81, 0xd8000000ul, 7}, // 'Q' 1101100
+ { 82, 0xda000000ul, 7}, // 'R' 1101101
+ { 83, 0xdc000000ul, 7}, // 'S' 1101110
+ { 84, 0xde000000ul, 7}, // 'T' 1101111
+ { 85, 0xe0000000ul, 7}, // 'U' 1110000
+ { 86, 0xe2000000ul, 7}, // 'V' 1110001
+ { 87, 0xe4000000ul, 7}, // 'W' 1110010
+ { 88, 0xfc000000ul, 8}, // 'X' 11111100
+ { 89, 0xe6000000ul, 7}, // 'Y' 1110011
+ { 90, 0xfd000000ul, 8}, // 'Z' 11111101
+ { 91, 0xffd80000ul, 13}, // '[' 11111111|11011
+ { 92, 0xfffe0000ul, 19}, // '\' 11111111|11111110|000
+ { 93, 0xffe00000ul, 13}, // ']' 11111111|11100
+ { 94, 0xfff00000ul, 14}, // '^' 11111111|111100
+ { 95, 0x88000000ul, 6}, // '_' 100010
+ { 96, 0xfffa0000ul, 15}, // '`' 11111111|1111101
+ { 97, 0x18000000ul, 5}, // 'a' 00011
+ { 98, 0x8c000000ul, 6}, // 'b' 100011
+ { 99, 0x20000000ul, 5}, // 'c' 00100
+ {100, 0x90000000ul, 6}, // 'd' 100100
+ {101, 0x28000000ul, 5}, // 'e' 00101
+ {102, 0x94000000ul, 6}, // 'f' 100101
+ {103, 0x98000000ul, 6}, // 'g' 100110
+ {104, 0x9c000000ul, 6}, // 'h' 100111
+ {105, 0x30000000ul, 5}, // 'i' 00110
+ {106, 0xe8000000ul, 7}, // 'j' 1110100
+ {107, 0xea000000ul, 7}, // 'k' 1110101
+ {108, 0xa0000000ul, 6}, // 'l' 101000
+ {109, 0xa4000000ul, 6}, // 'm' 101001
+ {110, 0xa8000000ul, 6}, // 'n' 101010
+ {111, 0x38000000ul, 5}, // 'o' 00111
+ {112, 0xac000000ul, 6}, // 'p' 101011
+ {113, 0xec000000ul, 7}, // 'q' 1110110
+ {114, 0xb0000000ul, 6}, // 'r' 101100
+ {115, 0x40000000ul, 5}, // 's' 01000
+ {116, 0x48000000ul, 5}, // 't' 01001
+ {117, 0xb4000000ul, 6}, // 'u' 101101
+ {118, 0xee000000ul, 7}, // 'v' 1110111
+ {119, 0xf0000000ul, 7}, // 'w' 1111000
+ {120, 0xf2000000ul, 7}, // 'x' 1111001
+ {121, 0xf4000000ul, 7}, // 'y' 1111010
+ {122, 0xf6000000ul, 7}, // 'z' 1111011
+ {123, 0xfffc0000ul, 15}, // '{' 11111111|1111110
+ {124, 0xff800000ul, 11}, // '|' 11111111|100
+ {125, 0xfff40000ul, 14}, // '}' 11111111|111101
+ {126, 0xffe80000ul, 13}, // '~' 11111111|11101
+ {127, 0xffffffc0ul, 28}, // 11111111|11111111|11111111|1100
+ {128, 0xfffe6000ul, 20}, // 11111111|11111110|0110
+ {129, 0xffff4800ul, 22}, // 11111111|11111111|010010
+ {130, 0xfffe7000ul, 20}, // 11111111|11111110|0111
+ {131, 0xfffe8000ul, 20}, // 11111111|11111110|1000
+ {132, 0xffff4c00ul, 22}, // 11111111|11111111|010011
+ {133, 0xffff5000ul, 22}, // 11111111|11111111|010100
+ {134, 0xffff5400ul, 22}, // 11111111|11111111|010101
+ {135, 0xffffb200ul, 23}, // 11111111|11111111|1011001
+ {136, 0xffff5800ul, 22}, // 11111111|11111111|010110
+ {137, 0xffffb400ul, 23}, // 11111111|11111111|1011010
+ {138, 0xffffb600ul, 23}, // 11111111|11111111|1011011
+ {139, 0xffffb800ul, 23}, // 11111111|11111111|1011100
+ {140, 0xffffba00ul, 23}, // 11111111|11111111|1011101
+ {141, 0xffffbc00ul, 23}, // 11111111|11111111|1011110
+ {142, 0xffffeb00ul, 24}, // 11111111|11111111|11101011
+ {143, 0xffffbe00ul, 23}, // 11111111|11111111|1011111
+ {144, 0xffffec00ul, 24}, // 11111111|11111111|11101100
+ {145, 0xffffed00ul, 24}, // 11111111|11111111|11101101
+ {146, 0xffff5c00ul, 22}, // 11111111|11111111|010111
+ {147, 0xffffc000ul, 23}, // 11111111|11111111|1100000
+ {148, 0xffffee00ul, 24}, // 11111111|11111111|11101110
+ {149, 0xffffc200ul, 23}, // 11111111|11111111|1100001
+ {150, 0xffffc400ul, 23}, // 11111111|11111111|1100010
+ {151, 0xffffc600ul, 23}, // 11111111|11111111|1100011
+ {152, 0xffffc800ul, 23}, // 11111111|11111111|1100100
+ {153, 0xfffee000ul, 21}, // 11111111|11111110|11100
+ {154, 0xffff6000ul, 22}, // 11111111|11111111|011000
+ {155, 0xffffca00ul, 23}, // 11111111|11111111|1100101
+ {156, 0xffff6400ul, 22}, // 11111111|11111111|011001
+ {157, 0xffffcc00ul, 23}, // 11111111|11111111|1100110
+ {158, 0xffffce00ul, 23}, // 11111111|11111111|1100111
+ {159, 0xffffef00ul, 24}, // 11111111|11111111|11101111
+ {160, 0xffff6800ul, 22}, // 11111111|11111111|011010
+ {161, 0xfffee800ul, 21}, // 11111111|11111110|11101
+ {162, 0xfffe9000ul, 20}, // 11111111|11111110|1001
+ {163, 0xffff6c00ul, 22}, // 11111111|11111111|011011
+ {164, 0xffff7000ul, 22}, // 11111111|11111111|011100
+ {165, 0xffffd000ul, 23}, // 11111111|11111111|1101000
+ {166, 0xffffd200ul, 23}, // 11111111|11111111|1101001
+ {167, 0xfffef000ul, 21}, // 11111111|11111110|11110
+ {168, 0xffffd400ul, 23}, // 11111111|11111111|1101010
+ {169, 0xffff7400ul, 22}, // 11111111|11111111|011101
+ {170, 0xffff7800ul, 22}, // 11111111|11111111|011110
+ {171, 0xfffff000ul, 24}, // 11111111|11111111|11110000
+ {172, 0xfffef800ul, 21}, // 11111111|11111110|11111
+ {173, 0xffff7c00ul, 22}, // 11111111|11111111|011111
+ {174, 0xffffd600ul, 23}, // 11111111|11111111|1101011
+ {175, 0xffffd800ul, 23}, // 11111111|11111111|1101100
+ {176, 0xffff0000ul, 21}, // 11111111|11111111|00000
+ {177, 0xffff0800ul, 21}, // 11111111|11111111|00001
+ {178, 0xffff8000ul, 22}, // 11111111|11111111|100000
+ {179, 0xffff1000ul, 21}, // 11111111|11111111|00010
+ {180, 0xffffda00ul, 23}, // 11111111|11111111|1101101
+ {181, 0xffff8400ul, 22}, // 11111111|11111111|100001
+ {182, 0xffffdc00ul, 23}, // 11111111|11111111|1101110
+ {183, 0xffffde00ul, 23}, // 11111111|11111111|1101111
+ {184, 0xfffea000ul, 20}, // 11111111|11111110|1010
+ {185, 0xffff8800ul, 22}, // 11111111|11111111|100010
+ {186, 0xffff8c00ul, 22}, // 11111111|11111111|100011
+ {187, 0xffff9000ul, 22}, // 11111111|11111111|100100
+ {188, 0xffffe000ul, 23}, // 11111111|11111111|1110000
+ {189, 0xffff9400ul, 22}, // 11111111|11111111|100101
+ {190, 0xffff9800ul, 22}, // 11111111|11111111|100110
+ {191, 0xffffe200ul, 23}, // 11111111|11111111|1110001
+ {192, 0xfffff800ul, 26}, // 11111111|11111111|11111000|00
+ {193, 0xfffff840ul, 26}, // 11111111|11111111|11111000|01
+ {194, 0xfffeb000ul, 20}, // 11111111|11111110|1011
+ {195, 0xfffe2000ul, 19}, // 11111111|11111110|001
+ {196, 0xffff9c00ul, 22}, // 11111111|11111111|100111
+ {197, 0xffffe400ul, 23}, // 11111111|11111111|1110010
+ {198, 0xffffa000ul, 22}, // 11111111|11111111|101000
+ {199, 0xfffff600ul, 25}, // 11111111|11111111|11110110|0
+ {200, 0xfffff880ul, 26}, // 11111111|11111111|11111000|10
+ {201, 0xfffff8c0ul, 26}, // 11111111|11111111|11111000|11
+ {202, 0xfffff900ul, 26}, // 11111111|11111111|11111001|00
+ {203, 0xfffffbc0ul, 27}, // 11111111|11111111|11111011|110
+ {204, 0xfffffbe0ul, 27}, // 11111111|11111111|11111011|111
+ {205, 0xfffff940ul, 26}, // 11111111|11111111|11111001|01
+ {206, 0xfffff100ul, 24}, // 11111111|11111111|11110001
+ {207, 0xfffff680ul, 25}, // 11111111|11111111|11110110|1
+ {208, 0xfffe4000ul, 19}, // 11111111|11111110|010
+ {209, 0xffff1800ul, 21}, // 11111111|11111111|00011
+ {210, 0xfffff980ul, 26}, // 11111111|11111111|11111001|10
+ {211, 0xfffffc00ul, 27}, // 11111111|11111111|11111100|000
+ {212, 0xfffffc20ul, 27}, // 11111111|11111111|11111100|001
+ {213, 0xfffff9c0ul, 26}, // 11111111|11111111|11111001|11
+ {214, 0xfffffc40ul, 27}, // 11111111|11111111|11111100|010
+ {215, 0xfffff200ul, 24}, // 11111111|11111111|11110010
+ {216, 0xffff2000ul, 21}, // 11111111|11111111|00100
+ {217, 0xffff2800ul, 21}, // 11111111|11111111|00101
+ {218, 0xfffffa00ul, 26}, // 11111111|11111111|11111010|00
+ {219, 0xfffffa40ul, 26}, // 11111111|11111111|11111010|01
+ {220, 0xffffffd0ul, 28}, // 11111111|11111111|11111111|1101
+ {221, 0xfffffc60ul, 27}, // 11111111|11111111|11111100|011
+ {222, 0xfffffc80ul, 27}, // 11111111|11111111|11111100|100
+ {223, 0xfffffca0ul, 27}, // 11111111|11111111|11111100|101
+ {224, 0xfffec000ul, 20}, // 11111111|11111110|1100
+ {225, 0xfffff300ul, 24}, // 11111111|11111111|11110011
+ {226, 0xfffed000ul, 20}, // 11111111|11111110|1101
+ {227, 0xffff3000ul, 21}, // 11111111|11111111|00110
+ {228, 0xffffa400ul, 22}, // 11111111|11111111|101001
+ {229, 0xffff3800ul, 21}, // 11111111|11111111|00111
+ {230, 0xffff4000ul, 21}, // 11111111|11111111|01000
+ {231, 0xffffe600ul, 23}, // 11111111|11111111|1110011
+ {232, 0xffffa800ul, 22}, // 11111111|11111111|101010
+ {233, 0xffffac00ul, 22}, // 11111111|11111111|101011
+ {234, 0xfffff700ul, 25}, // 11111111|11111111|11110111|0
+ {235, 0xfffff780ul, 25}, // 11111111|11111111|11110111|1
+ {236, 0xfffff400ul, 24}, // 11111111|11111111|11110100
+ {237, 0xfffff500ul, 24}, // 11111111|11111111|11110101
+ {238, 0xfffffa80ul, 26}, // 11111111|11111111|11111010|10
+ {239, 0xffffe800ul, 23}, // 11111111|11111111|1110100
+ {240, 0xfffffac0ul, 26}, // 11111111|11111111|11111010|11
+ {241, 0xfffffcc0ul, 27}, // 11111111|11111111|11111100|110
+ {242, 0xfffffb00ul, 26}, // 11111111|11111111|11111011|00
+ {243, 0xfffffb40ul, 26}, // 11111111|11111111|11111011|01
+ {244, 0xfffffce0ul, 27}, // 11111111|11111111|11111100|111
+ {245, 0xfffffd00ul, 27}, // 11111111|11111111|11111101|000
+ {246, 0xfffffd20ul, 27}, // 11111111|11111111|11111101|001
+ {247, 0xfffffd40ul, 27}, // 11111111|11111111|11111101|010
+ {248, 0xfffffd60ul, 27}, // 11111111|11111111|11111101|011
+ {249, 0xffffffe0ul, 28}, // 11111111|11111111|11111111|1110
+ {250, 0xfffffd80ul, 27}, // 11111111|11111111|11111101|100
+ {251, 0xfffffda0ul, 27}, // 11111111|11111111|11111101|101
+ {252, 0xfffffdc0ul, 27}, // 11111111|11111111|11111101|110
+ {253, 0xfffffde0ul, 27}, // 11111111|11111111|11111101|111
+ {254, 0xfffffe00ul, 27}, // 11111111|11111111|11111110|000
+ {255, 0xfffffb80ul, 26}, // 11111111|11111111|11111011|10
+ {256, 0xfffffffcul, 30} // EOS 11111111|11111111|11111111|111111
+};
+
+void write_huffman_code(BitOStream &outputStream, const CodeEntry &code)
+{
+ // Append octet by octet.
+ auto bitLength = code.bitLength;
+ const auto hc = code.huffmanCode >> (32 - bitLength);
+
+ if (bitLength > 24) {
+ outputStream.writeBits(uchar(hc >> 24), bitLength - 24);
+ bitLength = 24;
+ }
+
+ if (bitLength > 16) {
+ outputStream.writeBits(uchar(hc >> 16), bitLength - 16);
+ bitLength = 16;
+ }
+
+ if (bitLength > 8) {
+ outputStream.writeBits(uchar(hc >> 8), bitLength - 8);
+ bitLength = 8;
+ }
+
+ outputStream.writeBits(uchar(hc), bitLength);
+}
+
+}
+
+// That's from HPACK's specs - we deal with octets.
+static_assert(std::numeric_limits<uchar>::digits == 8, "octets expected");
+
+quint64 huffman_encoded_bit_length(const QByteArray &inputData)
+{
+ quint64 bitLength = 0;
+ for (int i = 0, e = inputData.size(); i < e; ++i)
+ bitLength += staticHuffmanCodeTable[int(inputData[i])].bitLength;
+
+ return bitLength;
+}
+
+void huffman_encode_string(const QByteArray &inputData, BitOStream &outputStream)
+{
+ for (int i = 0, e = inputData.size(); i < e; ++i)
+ write_huffman_code(outputStream, staticHuffmanCodeTable[int(inputData[i])]);
+
+ // Pad bits ...
+ if (outputStream.bitLength() % 8)
+ outputStream.writeBits(0xff, 8 - outputStream.bitLength() % 8);
+}
+
+bool padding_is_valid(quint32 chunk, quint32 nBits)
+{
+ Q_ASSERT(nBits);
+
+ // HPACK, 5.2: "A padding strictly longer than 7 bits MUST be
+ // treated as a decoding error."
+ if (nBits > 7)
+ return false;
+ // HPACK, 5.2:
+ // "A padding not corresponding to the most significant bits
+ // of the code for the EOS symbol MUST be treated as a decoding error."
+ return (chunk >> (32 - nBits)) == quint32((1 << nBits) - 1);
+}
+
+HuffmanDecoder::HuffmanDecoder()
+ : minCodeLength()
+{
+ const auto nCodes = sizeof staticHuffmanCodeTable / sizeof staticHuffmanCodeTable[0];
+
+ std::vector<CodeEntry> symbols(staticHuffmanCodeTable, staticHuffmanCodeTable + nCodes);
+ // Now we sort: by bit length first (in the descending order) and by the symbol
+ // value (descending). Descending order: to make sure we do not create prefix tables with
+ // short 'indexLength' first and having longer codes that do not fit into such tables later.
+ std::sort(symbols.begin(), symbols.end(), [](const CodeEntry &code1, const CodeEntry &code2) {
+ if (code1.bitLength == code2.bitLength)
+ return code1.byteValue > code2.byteValue;
+ return code1.bitLength > code2.bitLength;
+ });
+
+ minCodeLength = symbols.back().bitLength; // The shortest one, currently it's 5.
+
+ // TODO: add a verification - Huffman codes
+ // within a given bit length range also
+ // should be in descending order.
+
+ // Initialize 'prefixTables' and 'tableData'.
+ addTable(0, quint32(BitConstants::rootPrefix)); // 'root' table.
+
+ for (const auto &s : symbols) {
+ quint32 tableIndex = 0;
+ while (true) {
+ Q_ASSERT(tableIndex < prefixTables.size());
+ // Note, by value - since prefixTables will be updated in between.
+ const auto table = prefixTables[tableIndex];
+ // We skip prefixed bits (if any) and use indexed bits only:
+ const auto entryIndex = s.huffmanCode << table.prefixLength >> (32 - table.indexLength);
+ // Again, by value.
+ PrefixTableEntry entry = tableEntry(table, entryIndex);
+ // How many bits were coded by previous tables and this table:
+ const auto codedLength = table.prefixLength + table.indexLength;
+ if (codedLength < s.bitLength) {
+ // We have to add a new prefix table ... (if it's not done yet).
+ if (!entry.bitLength) {
+ entry.nextTable = addTable(codedLength, std::min<quint32>(quint32(BitConstants::childPrefix),
+ s.bitLength - codedLength));
+ entry.bitLength = s.bitLength;
+ entry.byteValue = s.byteValue;
+ setTableEntry(table, entryIndex, entry);
+ }
+ tableIndex = entry.nextTable;
+ } else {
+ // We found the slot for our code (terminal entry):
+ entry.byteValue = s.byteValue;
+ entry.bitLength = s.bitLength;
+ // Refer to our own table as 'nextTable':
+ entry.nextTable = tableIndex;
+ setTableEntry(table, entryIndex, entry);
+ break;
+ }
+ }
+ }
+
+ // Now, we have a table(s) and have to fill 'holes' to
+ // 'fix' terminal entries.
+ for (const auto &table : prefixTables) {
+ const quint32 codedLength = table.prefixLength + table.indexLength;
+ for (quint32 j = 0; j < table.size();) {
+ const PrefixTableEntry &entry = tableEntry(table, j);
+ if (entry.bitLength && entry.bitLength < codedLength) {
+ const quint32 range = 1 << (codedLength - entry.bitLength);
+ for (quint32 k = 1; k < range; ++k)
+ setTableEntry(table, j + k, entry);
+ j += range;
+ } else {
+ ++j;
+ }
+ }
+ }
+}
+
+bool HuffmanDecoder::decodeStream(BitIStream &inputStream, QByteArray &outputBuffer)
+{
+ while (true) {
+ quint32 chunk = 0;
+ const quint32 readBits = inputStream.peekBits(inputStream.streamOffset(), 32, &chunk);
+ if (!readBits)
+ return !inputStream.hasMoreBits();
+
+ if (readBits < minCodeLength) {
+ inputStream.skipBits(readBits);
+ return padding_is_valid(chunk, readBits);
+ }
+
+ quint32 tableIndex = 0;
+ const PrefixTable *table = &prefixTables[tableIndex];
+ quint32 entryIndex = chunk >> (32 - table->indexLength);
+ PrefixTableEntry entry = tableEntry(*table, entryIndex);
+
+ while (true) {
+ if (entry.nextTable == tableIndex)
+ break;
+
+ tableIndex = entry.nextTable;
+ table = &prefixTables[tableIndex];
+ entryIndex = chunk << table->prefixLength >> (32 - table->indexLength);
+ entry = tableEntry(*table, entryIndex);
+ }
+
+ if (entry.bitLength > readBits) {
+ inputStream.skipBits(readBits);
+ return padding_is_valid(chunk, readBits);
+ }
+
+ if (!entry.bitLength || entry.byteValue == 256) {
+ //EOS (256) == compression error (HPACK).
+ inputStream.skipBits(readBits);
+ return false;
+ }
+
+ outputBuffer.append(entry.byteValue);
+ inputStream.skipBits(entry.bitLength);
+ }
+
+ return false;
+}
+
+quint32 HuffmanDecoder::addTable(quint32 prefix, quint32 index)
+{
+ PrefixTable newTable{prefix, index};
+ newTable.offset = quint32(tableData.size());
+ prefixTables.push_back(newTable);
+ // Add entries for this table:
+ tableData.resize(tableData.size() + newTable.size());
+
+ return quint32(prefixTables.size() - 1);
+}
+
+PrefixTableEntry HuffmanDecoder::tableEntry(const PrefixTable &table, quint32 index)
+{
+ Q_ASSERT(index < table.size());
+ return tableData[table.offset + index];
+}
+
+void HuffmanDecoder::setTableEntry(const PrefixTable &table, quint32 index,
+ const PrefixTableEntry &entry)
+{
+ Q_ASSERT(index < table.size());
+ tableData[table.offset + index] = entry;
+}
+
+bool huffman_decode_string(BitIStream &inputStream, QByteArray *outputBuffer)
+{
+ Q_ASSERT(outputBuffer);
+
+ static HuffmanDecoder decoder;
+ return decoder.decodeStream(inputStream, *outputBuffer);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/access/http2/huffman_p.h b/src/network/access/http2/huffman_p.h
new file mode 100644
index 0000000000..7195661664
--- /dev/null
+++ b/src/network/access/http2/huffman_p.h
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HUFFMAN_P_H
+#define HUFFMAN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QByteArray;
+
+namespace HPack
+{
+
+struct CodeEntry
+{
+ CodeEntry() : byteValue(),
+ huffmanCode(),
+ bitLength()
+ {
+ }
+
+ CodeEntry(quint32 val, quint32 code, quint32 len)
+ : byteValue(val),
+ huffmanCode(code),
+ bitLength(len)
+ {
+ }
+
+ quint32 byteValue;
+ quint32 huffmanCode;
+ quint32 bitLength;
+};
+
+class BitOStream;
+
+quint64 huffman_encoded_bit_length(const QByteArray &inputData);
+void huffman_encode_string(const QByteArray &inputData, BitOStream &outputStream);
+
+// PrefixTable:
+// Huffman codes with a small bit length
+// fit into a table (these are 'terminal' symbols),
+// codes with longer codes require additional
+// tables, so several symbols will have the same index
+// in a table - pointing into the next table.
+// Every table has an 'indexLength' - that's
+// how many bits can fit in table's indices +
+// 'prefixLength' - how many bits were addressed
+// by its 'parent' table(s).
+// All PrefixTables are kept in 'prefixTables' array.
+// PrefixTable itself does not have any entries,
+// it just holds table's prefix/index + 'offset' -
+// there table's data starts in an array of all
+// possible entries ('tableData').
+
+struct PrefixTable
+{
+ PrefixTable()
+ : prefixLength(),
+ indexLength(),
+ offset()
+ {
+ }
+
+ PrefixTable(quint32 prefix, quint32 index)
+ : prefixLength(prefix),
+ indexLength(index),
+ offset()
+ {
+ }
+
+ quint32 size()const
+ {
+ // Number of entries table contains:
+ return 1 << indexLength;
+ }
+
+ quint32 prefixLength;
+ quint32 indexLength;
+ quint32 offset;
+};
+
+// Table entry is either a terminal entry (thus probably the code found)
+// or points into another table ('nextTable' - index into
+// 'prefixTables' array). If it's a terminal, 'nextTable' index
+// refers to the same table.
+
+struct PrefixTableEntry
+{
+ PrefixTableEntry()
+ : bitLength(),
+ nextTable(),
+ byteValue()
+ {
+ }
+
+ quint32 bitLength;
+ quint32 nextTable;
+ quint32 byteValue;
+};
+
+class BitIStream;
+
+class HuffmanDecoder
+{
+public:
+ enum class BitConstants
+ {
+ rootPrefix = 9,
+ childPrefix = 6
+ };
+
+ HuffmanDecoder();
+
+ bool decodeStream(BitIStream &inputStream, QByteArray &outputBuffer);
+
+private:
+ quint32 addTable(quint32 prefixLength, quint32 indexLength);
+ PrefixTableEntry tableEntry(const PrefixTable &table, quint32 index);
+ void setTableEntry(const PrefixTable &table, quint32 index, const PrefixTableEntry &entry);
+
+ std::vector<PrefixTable> prefixTables;
+ std::vector<PrefixTableEntry> tableData;
+ quint32 minCodeLength;
+};
+
+bool huffman_decode_string(BitIStream &inputStream, QByteArray *outputBuffer);
+
+} // namespace HPack
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 3601c36bc2..24ada3a81f 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -484,8 +484,7 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket)
}
// is this a valid reply?
- if (fragment.length() >= 5 && !fragment.startsWith("HTTP/"))
- {
+ if (fragment.length() == 5 && !fragment.startsWith("HTTP/")) {
fragment.clear();
return -1;
}
@@ -739,6 +738,8 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QByteDataBuff
#ifndef QT_NO_COMPRESS
int QHttpNetworkReplyPrivate::initializeInflateStream()
{
+ Q_ASSERT(inflateStrm);
+
inflateStrm->zalloc = Z_NULL;
inflateStrm->zfree = Z_NULL;
inflateStrm->opaque = Z_NULL;
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 587ab27a0f..9fee172283 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1516,27 +1516,35 @@ void QNetworkAccessManagerPrivate::clearCache(QNetworkAccessManager *manager)
manager->d_func()->objectCache.clear();
manager->d_func()->authenticationManager->clearCache();
- if (manager->d_func()->httpThread) {
- manager->d_func()->httpThread->quit();
- manager->d_func()->httpThread->wait(5000);
- if (manager->d_func()->httpThread->isFinished())
- delete manager->d_func()->httpThread;
- else
- QObject::connect(manager->d_func()->httpThread, SIGNAL(finished()), manager->d_func()->httpThread, SLOT(deleteLater()));
- manager->d_func()->httpThread = 0;
- }
+ manager->d_func()->destroyThread();
}
QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate()
{
- if (httpThread) {
- httpThread->quit();
- httpThread->wait(5000);
- if (httpThread->isFinished())
- delete httpThread;
+ destroyThread();
+}
+
+QThread * QNetworkAccessManagerPrivate::createThread()
+{
+ if (!thread) {
+ thread = new QThread;
+ thread->setObjectName(QStringLiteral("QNetworkAccessManager thread"));
+ thread->start();
+ }
+ Q_ASSERT(thread);
+ return thread;
+}
+
+void QNetworkAccessManagerPrivate::destroyThread()
+{
+ if (thread) {
+ thread->quit();
+ thread->wait(5000);
+ if (thread->isFinished())
+ delete thread;
else
- QObject::connect(httpThread, SIGNAL(finished()), httpThread, SLOT(deleteLater()));
- httpThread = 0;
+ QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
+ thread = 0;
}
}
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index cba5cc09d6..6df0b63ba7 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -173,6 +173,7 @@ private:
friend class QNetworkReplyImplPrivate;
friend class QNetworkReplyHttpImpl;
friend class QNetworkReplyHttpImplPrivate;
+ friend class QNetworkReplyFileImpl;
Q_DECLARE_PRIVATE(QNetworkAccessManager)
Q_PRIVATE_SLOT(d_func(), void _q_replyFinished())
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index 44cf253368..5f8148d6e4 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -74,7 +74,7 @@ class QNetworkAccessManagerPrivate: public QObjectPrivate
public:
QNetworkAccessManagerPrivate()
: networkCache(0), cookieJar(0),
- httpThread(0),
+ thread(0),
#ifndef QT_NO_NETWORKPROXY
proxyFactory(0),
#endif
@@ -107,6 +107,9 @@ public:
}
~QNetworkAccessManagerPrivate();
+ QThread * createThread();
+ void destroyThread();
+
void _q_replyFinished();
void _q_replyEncrypted();
void _q_replySslErrors(const QList<QSslError> &errors);
@@ -163,7 +166,7 @@ public:
QNetworkCookieJar *cookieJar;
- QThread *httpThread;
+ QThread *thread;
#ifndef QT_NO_NETWORKPROXY
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp
index 077826ccf6..ce3b773c64 100644
--- a/src/network/access/qnetworkdiskcache.cpp
+++ b/src/network/access/qnetworkdiskcache.cpp
@@ -422,7 +422,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url)
// ### verify that QFile uses the fd size and not the file name
qint64 size = file->size() - file->pos();
const uchar *p = 0;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_INTEGRITY)
+#if !defined(Q_OS_INTEGRITY)
p = file->map(file->pos(), size);
#endif
if (p) {
diff --git a/src/corelib/tools/qstring_mac.mm b/src/network/access/qnetworkfile.cpp
index 7b3d6b53c0..374dd26e2e 100644
--- a/src/corelib/tools/qstring_mac.mm
+++ b/src/network/access/qnetworkfile.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,47 +37,56 @@
**
****************************************************************************/
-#include "qstring.h"
+#include "qnetworkfile_p.h"
-#import <Foundation/Foundation.h>
+#include <QtCore/QDebug>
+#include <QNetworkReply>
+#include <QtCore/QDateTime>
+#include <QtCore/QFileInfo>
+#include <QtCore/QMetaObject>
+#include <QtCore/QCoreApplication>
QT_BEGIN_NAMESPACE
-QString QString::fromCFString(CFStringRef string)
+QNetworkFile::QNetworkFile()
+ : QFile()
{
- if (!string)
- return QString();
- CFIndex length = CFStringGetLength(string);
-
- // Fast path: CFStringGetCharactersPtr does not copy but may
- // return null for any and no reason.
- const UniChar *chars = CFStringGetCharactersPtr(string);
- if (chars)
- return QString(reinterpret_cast<const QChar *>(chars), length);
-
- QString ret(length, Qt::Uninitialized);
- CFStringGetCharacters(string, CFRangeMake(0, length), reinterpret_cast<UniChar *>(ret.data()));
- return ret;
}
-CFStringRef QString::toCFString() const
+QNetworkFile::QNetworkFile(const QString &name)
+ : QFile(name)
{
- return CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(unicode()), length());
}
-QString QString::fromNSString(const NSString *string)
+void QNetworkFile::open()
{
- if (!string)
- return QString();
- QString qstring;
- qstring.resize([string length]);
- [string getCharacters: reinterpret_cast<unichar*>(qstring.data()) range: NSMakeRange(0, [string length])];
- return qstring;
+ bool opened = false;
+ QFileInfo fi(fileName());
+ if (fi.isDir()) {
+ QString msg = QCoreApplication::translate("QNetworkAccessFileBackend",
+ "Cannot open %1: Path is a directory").arg(fileName());
+ error(QNetworkReply::ContentOperationNotPermittedError, msg);
+ } else {
+ headerRead(QNetworkRequest::LastModifiedHeader, QVariant::fromValue(fi.lastModified()));
+ headerRead(QNetworkRequest::ContentLengthHeader, QVariant::fromValue(fi.size()));
+ opened = QFile::open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+ if (!opened) {
+ QString msg = QCoreApplication::translate("QNetworkAccessFileBackend",
+ "Error opening %1: %2").arg(fileName(), errorString());
+ if (exists())
+ error(QNetworkReply::ContentAccessDenied, msg);
+ else
+ error(QNetworkReply::ContentNotFoundError, msg);
+ }
+ }
+ finished(opened);
}
-NSString *QString::toNSString() const
+void QNetworkFile::close()
{
- return [NSString stringWithCharacters: reinterpret_cast<const UniChar*>(unicode()) length: length()];
+ // This override is needed because 'using' keyword cannot be used for slots. And the base
+ // function is not an invokable/slot function.
+ QFile::close();
}
QT_END_NAMESPACE
diff --git a/src/corelib/io/qurl_mac.mm b/src/network/access/qnetworkfile_p.h
index 04d05f1b23..7794c0f18a 100644
--- a/src/corelib/io/qurl_mac.mm
+++ b/src/network/access/qnetworkfile_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,38 +37,43 @@
**
****************************************************************************/
-#include "qurl.h"
+#ifndef QNETWORKFILE_H
+#define QNETWORKFILE_H
-#ifdef Q_OS_MAC
-#include <Foundation/Foundation.h>
-#endif
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the Network Access API. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
-QT_BEGIN_NAMESPACE
+#include <QFile>
+#include <qnetworkreply.h>
-QUrl QUrl::fromCFURL(CFURLRef url)
-{
- return QUrl(QString::fromCFString(CFURLGetString(url)));
-}
+QT_BEGIN_NAMESPACE
-CFURLRef QUrl::toCFURL() const
+class QNetworkFile : public QFile
{
- CFURLRef url = 0;
- CFStringRef str = toString(FullyEncoded).toCFString();
- if (str) {
- url = CFURLCreateWithString(0, str, 0);
- CFRelease(str);
- }
- return url;
-}
+ Q_OBJECT
+public:
+ QNetworkFile();
+ QNetworkFile(const QString &name);
+ using QFile::open;
-QUrl QUrl::fromNSURL(const NSURL *url)
-{
- return QUrl(QString::fromNSString([url absoluteString]));
-}
+public Q_SLOTS:
+ void open();
+ void close() Q_DECL_OVERRIDE;
-NSURL *QUrl::toNSURL() const
-{
- return [NSURL URLWithString:toString(FullyEncoded).toNSString()];
-}
+Q_SIGNALS:
+ void finished(bool ok);
+ void headerRead(QNetworkRequest::KnownHeaders header, const QVariant &value);
+ void error(QNetworkReply::NetworkError error, const QString &message);
+};
QT_END_NAMESPACE
+
+#endif // QNETWORKFILE_H
diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp
index 36bc4b41df..ef319ebf0d 100644
--- a/src/network/access/qnetworkreplyfileimpl.cpp
+++ b/src/network/access/qnetworkreplyfileimpl.cpp
@@ -40,31 +40,45 @@
#include "qnetworkreplyfileimpl_p.h"
#include "QtCore/qdatetime.h"
+#include "qnetworkaccessmanager_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QFileInfo>
+#include <QtCore/QThread>
+#include "qnetworkfile_p.h"
+#include "qnetworkrequest.h"
QT_BEGIN_NAMESPACE
QNetworkReplyFileImplPrivate::QNetworkReplyFileImplPrivate()
- : QNetworkReplyPrivate(), realFileSize(0)
+ : QNetworkReplyPrivate(), managerPrivate(0), realFile(0)
{
+ qRegisterMetaType<QNetworkRequest::KnownHeaders>();
+ qRegisterMetaType<QNetworkReply::NetworkError>();
}
QNetworkReplyFileImpl::~QNetworkReplyFileImpl()
{
+ QNetworkReplyFileImplPrivate *d = (QNetworkReplyFileImplPrivate*) d_func();
+ if (d->realFile) {
+ if (d->realFile->thread() == QThread::currentThread())
+ delete d->realFile;
+ else
+ QMetaObject::invokeMethod(d->realFile, "deleteLater", Qt::QueuedConnection);
+ }
}
-QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op)
- : QNetworkReply(*new QNetworkReplyFileImplPrivate(), parent)
+QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op)
+ : QNetworkReply(*new QNetworkReplyFileImplPrivate(), manager)
{
setRequest(req);
setUrl(req.url());
setOperation(op);
- setFinished(true);
QNetworkReply::open(QIODevice::ReadOnly);
QNetworkReplyFileImplPrivate *d = (QNetworkReplyFileImplPrivate*) d_func();
+ d->managerPrivate = manager->d_func();
+
QUrl url = req.url();
if (url.host() == QLatin1String("localhost"))
url.setHost(QString());
@@ -77,7 +91,7 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ
setError(QNetworkReply::ProtocolInvalidOperationError, msg);
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ProtocolInvalidOperationError));
- QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+ fileOpenFinished(false);
return;
}
#endif
@@ -85,7 +99,6 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ
url.setPath(QLatin1String("/"));
setUrl(url);
-
QString fileName = url.toLocalFile();
if (fileName.isEmpty()) {
const QString scheme = url.scheme();
@@ -101,68 +114,85 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QObject *parent, const QNetworkRequ
}
}
- QFileInfo fi(fileName);
- if (fi.isDir()) {
- QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString());
- setError(QNetworkReply::ContentOperationNotPermittedError, msg);
- QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError));
- QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
- return;
- }
-
- d->realFile.setFileName(fileName);
- bool opened = d->realFile.open(QIODevice::ReadOnly | QIODevice::Unbuffered);
-
- // could we open the file?
- if (!opened) {
- QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2")
- .arg(d->realFile.fileName(), d->realFile.errorString());
-
- if (d->realFile.exists()) {
- setError(QNetworkReply::ContentAccessDenied, msg);
- QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied));
- } else {
- setError(QNetworkReply::ContentNotFoundError, msg);
+ if (req.attribute(QNetworkRequest::BackgroundRequestAttribute).toBool()) { // Asynchronous open
+ auto realFile = new QNetworkFile(fileName);
+ connect(realFile, &QNetworkFile::headerRead, this, &QNetworkReplyFileImpl::setHeader,
+ Qt::QueuedConnection);
+ connect(realFile, &QNetworkFile::error, this, &QNetworkReplyFileImpl::setError,
+ Qt::QueuedConnection);
+ connect(realFile, SIGNAL(finished(bool)), SLOT(fileOpenFinished(bool)),
+ Qt::QueuedConnection);
+
+ realFile->moveToThread(d->managerPrivate->createThread());
+ QMetaObject::invokeMethod(realFile, "open", Qt::QueuedConnection);
+
+ d->realFile = realFile;
+ } else { // Synch open
+ setFinished(true);
+
+ QFileInfo fi(fileName);
+ if (fi.isDir()) {
+ QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Cannot open %1: Path is a directory").arg(url.toString());
+ setError(QNetworkReply::ContentOperationNotPermittedError, msg);
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
- Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError));
+ Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError));
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+ return;
+ }
+ d->realFile = new QFile(fileName, this);
+ bool opened = d->realFile->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+
+ // could we open the file?
+ if (!opened) {
+ QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Error opening %1: %2")
+ .arg(d->realFile->fileName(), d->realFile->errorString());
+
+ if (fi.exists()) {
+ setError(QNetworkReply::ContentAccessDenied, msg);
+ QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
+ Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentAccessDenied));
+ } else {
+ setError(QNetworkReply::ContentNotFoundError, msg);
+ QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
+ Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError));
+ }
+ QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+ return;
}
+ setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified());
+ setHeader(QNetworkRequest::ContentLengthHeader, fi.size());
+
+ QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection,
+ Q_ARG(qint64, fi.size()), Q_ARG(qint64, fi.size()));
+ QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
- return;
}
-
- setHeader(QNetworkRequest::LastModifiedHeader, fi.lastModified());
- d->realFileSize = fi.size();
- setHeader(QNetworkRequest::ContentLengthHeader, d->realFileSize);
-
- QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
- QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection,
- Q_ARG(qint64, d->realFileSize), Q_ARG(qint64, d->realFileSize));
- QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);
- QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
}
void QNetworkReplyFileImpl::close()
{
Q_D(QNetworkReplyFileImpl);
QNetworkReply::close();
- d->realFile.close();
+ if (d->realFile) {
+ if (d->realFile->thread() == thread())
+ d->realFile->close();
+ else
+ QMetaObject::invokeMethod(d->realFile, "close", Qt::QueuedConnection);
+ }
}
void QNetworkReplyFileImpl::abort()
{
- Q_D(QNetworkReplyFileImpl);
- QNetworkReply::close();
- d->realFile.close();
+ close();
}
qint64 QNetworkReplyFileImpl::bytesAvailable() const
{
Q_D(const QNetworkReplyFileImpl);
- if (!d->realFile.isOpen())
+ if (!d->isFinished || !d->realFile || !d->realFile->isOpen())
return QNetworkReply::bytesAvailable();
- return QNetworkReply::bytesAvailable() + d->realFile.bytesAvailable();
+ return QNetworkReply::bytesAvailable() + d->realFile->bytesAvailable();
}
bool QNetworkReplyFileImpl::isSequential () const
@@ -172,8 +202,9 @@ bool QNetworkReplyFileImpl::isSequential () const
qint64 QNetworkReplyFileImpl::size() const
{
- Q_D(const QNetworkReplyFileImpl);
- return d->realFileSize;
+ bool ok;
+ int size = header(QNetworkRequest::ContentLengthHeader).toInt(&ok);
+ return ok ? size : 0;
}
/*!
@@ -182,11 +213,11 @@ qint64 QNetworkReplyFileImpl::size() const
qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen)
{
Q_D(QNetworkReplyFileImpl);
- if (!d->realFile.isOpen())
+ if (!d->isFinished || !d->realFile || !d->realFile->isOpen())
return -1;
- qint64 ret = d->realFile.read(data, maxlen);
- if (bytesAvailable() == 0 && d->realFile.isOpen())
- d->realFile.close();
+ qint64 ret = d->realFile->read(data, maxlen);
+ if (bytesAvailable() == 0)
+ d->realFile->close();
if (ret == 0 && bytesAvailable() == 0)
return -1;
else {
@@ -196,6 +227,17 @@ qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen)
}
}
+void QNetworkReplyFileImpl::fileOpenFinished(bool isOpen)
+{
+ setFinished(true);
+ if (isOpen) {
+ const auto fileSize = size();
+ Q_EMIT metaDataChanged();
+ Q_EMIT downloadProgress(fileSize, fileSize);
+ Q_EMIT readyRead();
+ }
+ Q_EMIT finished();
+}
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h
index bac00881a8..1f1be40bc8 100644
--- a/src/network/access/qnetworkreplyfileimpl_p.h
+++ b/src/network/access/qnetworkreplyfileimpl_p.h
@@ -59,13 +59,12 @@
QT_BEGIN_NAMESPACE
-
class QNetworkReplyFileImplPrivate;
class QNetworkReplyFileImpl: public QNetworkReply
{
Q_OBJECT
public:
- QNetworkReplyFileImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op);
+ QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op);
~QNetworkReplyFileImpl();
virtual void abort() Q_DECL_OVERRIDE;
@@ -77,6 +76,9 @@ public:
virtual qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+private Q_SLOTS:
+ void fileOpenFinished(bool isOpen);
+
Q_DECLARE_PRIVATE(QNetworkReplyFileImpl)
};
@@ -85,12 +87,14 @@ class QNetworkReplyFileImplPrivate: public QNetworkReplyPrivate
public:
QNetworkReplyFileImplPrivate();
- QFile realFile;
- qint64 realFileSize;
+ QNetworkAccessManagerPrivate *managerPrivate;
+ QPointer<QFile> realFile;
Q_DECLARE_PUBLIC(QNetworkReplyFileImpl)
};
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QNetworkRequest::KnownHeaders)
+
#endif // QNETWORKREPLYFILEIMPL_H
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 6bf3c56db2..30f4bb26ce 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -601,17 +601,10 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
thread->setObjectName(QStringLiteral("Qt HTTP synchronous thread"));
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
- } else if (!managerPrivate->httpThread) {
+ } else {
// We use the manager-global thread.
// At some point we could switch to having multiple threads if it makes sense.
- managerPrivate->httpThread = new QThread();
- managerPrivate->httpThread->setObjectName(QStringLiteral("Qt HTTP thread"));
- managerPrivate->httpThread->start();
-
- thread = managerPrivate->httpThread;
- } else {
- // Asynchronous request, thread already exists
- thread = managerPrivate->httpThread;
+ thread = managerPrivate->createThread();
}
QUrl url = newHttpRequest.url();
@@ -1123,8 +1116,8 @@ void QNetworkReplyHttpImplPrivate::onRedirected(const QUrl &redirectUrl, int htt
cookedHeaders.clear();
- if (managerPrivate->httpThread)
- managerPrivate->httpThread->disconnect();
+ if (managerPrivate->thread)
+ managerPrivate->thread->disconnect();
// Recurse
QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection,
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
index 413b03cc22..445a2a1c29 100644
--- a/src/network/access/qspdyprotocolhandler.cpp
+++ b/src/network/access/qspdyprotocolhandler.cpp
@@ -458,7 +458,7 @@ bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray
break;
}
default: {
- qWarning() << "got unexpected zlib return value:" << zlibRet;
+ qWarning("got unexpected zlib return value: %d", zlibRet);
return false;
}
}
@@ -849,7 +849,7 @@ void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders) //
break;
}
default:
- qWarning() << "cannot handle frame of type" << type;
+ qWarning("cannot handle frame of type %d", int(type));
}
}
@@ -1073,7 +1073,7 @@ void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const
break;
}
default:
- qWarning() << "found unknown settings value" << value;
+ qWarning("found unknown settings value %u", uint(value));
}
}
}
@@ -1112,7 +1112,7 @@ void QSpdyProtocolHandler::handleGOAWAY(char /*flags*/, quint32 /*length*/,
break;
}
default:
- qWarning() << "unexpected status code" << statusCode;
+ qWarning("unexpected status code %d", int(statusCode));
errorCode = QNetworkReply::ProtocolUnknownError;
}
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index 811d8b6f0d..b50ca0d1c4 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -53,10 +53,10 @@ win32: {
mac {
LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation
- !ios: LIBS_PRIVATE += -framework CoreServices
+ !uikit: LIBS_PRIVATE += -framework CoreServices
}
-mac:!ios:SOURCES += kernel/qnetworkproxy_mac.cpp
+osx:SOURCES += kernel/qnetworkproxy_mac.cpp
else:win32:SOURCES += kernel/qnetworkproxy_win.cpp
else:contains(QT_CONFIG, libproxy) {
SOURCES += kernel/qnetworkproxy_libproxy.cpp
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index a73f01a2fc..959db6e9d9 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -1455,15 +1455,9 @@ static bool q_NTLM_SSPI_library_load()
if (pSecurityFunctionTable == NULL) {
securityDLLHandle = LoadLibrary(L"secur32.dll");
if (securityDLLHandle != NULL) {
-#if defined(Q_OS_WINCE)
- INIT_SECURITY_INTERFACE pInitSecurityInterface =
- (INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle,
- L"InitSecurityInterfaceW");
-#else
INIT_SECURITY_INTERFACE pInitSecurityInterface =
(INIT_SECURITY_INTERFACE)GetProcAddress(securityDLLHandle,
"InitSecurityInterfaceW");
-#endif
if (pInitSecurityInterface != NULL)
pSecurityFunctionTable = pInitSecurityInterface();
}
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index 13ecfac3f5..95f90af49e 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
// sockaddr_in6 size changed between old and new SDK
// Only the new version is the correct one, so always
// use this structure.
-#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
# if !defined(u_char)
# define u_char unsigned char
# endif
@@ -151,20 +151,37 @@ void QHostAddressPrivate::setAddress(quint32 a_)
/// parses v4-mapped addresses or the AnyIPv6 address and stores in \a a;
/// returns true if the address was one of those
-static bool convertToIpv4(quint32& a, const Q_IPV6ADDR &a6)
+static bool convertToIpv4(quint32& a, const Q_IPV6ADDR &a6, const QHostAddress::ConversionMode mode)
{
+ if (mode == QHostAddress::StrictConversion)
+ return false;
+
const uchar *ptr = a6.c;
if (qFromUnaligned<quint64>(ptr) != 0)
return false;
- if (qFromBigEndian<quint32>(ptr + 8) == 0) {
- // is it AnyIPv6?
- a = 0;
- return qFromBigEndian<quint32>(ptr + 12) == 0;
+
+ const quint32 mid = qFromBigEndian<quint32>(ptr + 8);
+ if ((mid == 0xffff) && (mode & QHostAddress::ConvertV4MappedToIPv4)) {
+ a = qFromBigEndian<quint32>(ptr + 12);
+ return true;
}
- if (qFromBigEndian<quint32>(ptr + 8) != 0xFFFF)
+ if (mid != 0)
return false;
- a = qFromBigEndian<quint32>(ptr + 12);
- return true;
+
+ const quint32 low = qFromBigEndian<quint32>(ptr + 12);
+ if ((low == 0) && (mode & QHostAddress::ConvertUnspecifiedAddress)) {
+ a = 0;
+ return true;
+ }
+ if ((low == 1) && (mode & QHostAddress::ConvertLocalHost)) {
+ a = INADDR_LOOPBACK;
+ return true;
+ }
+ if ((low != 1) && (mode & QHostAddress::ConvertV4CompatToIPv4)) {
+ a = low;
+ return true;
+ }
+ return false;
}
void QHostAddressPrivate::setAddress(const quint8 *a_)
@@ -173,7 +190,8 @@ void QHostAddressPrivate::setAddress(const quint8 *a_)
isParsed = true;
memcpy(a6.c, a_, sizeof(a6));
a = 0;
- convertToIpv4(a, a6);
+ convertToIpv4(a, a6, (QHostAddress::ConvertV4MappedToIPv4
+ | QHostAddress::ConvertUnspecifiedAddress));
}
void QHostAddressPrivate::setAddress(const Q_IPV6ADDR &a_)
@@ -385,6 +403,20 @@ void QNetmaskAddress::setPrefixLength(QAbstractSocket::NetworkLayerProtocol prot
\value Any The dual stack any-address. A socket bound with this address will listen on both IPv4 and IPv6 interfaces.
*/
+/*! \enum QHostAddress::ConversionModeFlag
+
+ \since 5.8
+
+ \value StrictConversion Don't convert IPv6 addresses to IPv4 when comparing two QHostAddress objects of different protocols, so they will always be considered different.
+ \value ConvertV4MappedToIPv4 Convert IPv4-mapped IPv6 addresses (RFC 4291 sect. 2.5.5.2) when comparing. Therefore QHostAddress("::ffff:192.168.1.1") will compare equal to QHostAddress("192.168.1.1").
+ \value ConvertV4CompatToIPv4 Convert IPv4-compatible IPv6 addresses (RFC 4291 sect. 2.5.5.1) when comparing. Therefore QHostAddress("::192.168.1.1") will compare equal to QHostAddress("192.168.1.1").
+ \value ConvertLocalHost Convert the IPv6 loopback addresses to its IPv4 equivalent when comparing. Therefore e.g. QHostAddress("::1") will compare equal to QHostAddress("127.0.0.1").
+ \value ConvertUnspecifiedAddress All unspecified addresses will compare equal, namely AnyIPv4, AnyIPv6 and Any.
+ \value TolerantConversion Sets all three preceding flags.
+
+ \sa isEqual()
+ */
+
/*! Constructs a null host address object, i.e. an address which is not valid for any host or interface.
\sa clear()
@@ -690,7 +722,9 @@ quint32 QHostAddress::toIPv4Address(bool *ok) const
quint32 dummy;
if (ok)
*ok = d->protocol == QAbstractSocket::IPv4Protocol || d->protocol == QAbstractSocket::AnyIPProtocol
- || (d->protocol == QAbstractSocket::IPv6Protocol && convertToIpv4(dummy, d->a6));
+ || (d->protocol == QAbstractSocket::IPv6Protocol
+ && convertToIpv4(dummy, d->a6, ConversionMode(QHostAddress::ConvertV4MappedToIPv4
+ | QHostAddress::ConvertUnspecifiedAddress)));
return d->a;
}
@@ -812,19 +846,73 @@ void QHostAddress::setScopeId(const QString &id)
/*!
Returns \c true if this host address is the same as the \a other address
- given; otherwise returns \c false.
+ given; otherwise returns \c false. This operator just calls isEqual(other, StrictConversion).
+
+ \sa isEqual()
*/
bool QHostAddress::operator==(const QHostAddress &other) const
{
+ return isEqual(other, StrictConversion);
+}
+
+/*!
+ \since 5.8
+
+ Returns \c true if this host address is the same as the \a other address
+ given; otherwise returns \c false.
+
+ The parameter \a mode controls which conversions are preformed between addresses
+ of differing protocols. If no \a mode is given, \c TolerantConversion is performed
+ by default.
+
+ \sa ConversionMode, operator==()
+ */
+bool QHostAddress::isEqual(const QHostAddress &other, ConversionMode mode) const
+{
QT_ENSURE_PARSED(this);
QT_ENSURE_PARSED(&other);
- if (d->protocol == QAbstractSocket::IPv4Protocol)
- return other.d->protocol == QAbstractSocket::IPv4Protocol && d->a == other.d->a;
+ if (d->protocol == QAbstractSocket::IPv4Protocol) {
+ switch (other.d->protocol) {
+ case QAbstractSocket::IPv4Protocol:
+ return d->a == other.d->a;
+ case QAbstractSocket::IPv6Protocol:
+ quint32 a4;
+ return convertToIpv4(a4, other.d->a6, mode) && (a4 == d->a);
+ case QAbstractSocket::AnyIPProtocol:
+ return (mode & QHostAddress::ConvertUnspecifiedAddress) && d->a == 0;
+ case QAbstractSocket::UnknownNetworkLayerProtocol:
+ return false;
+ }
+ }
+
if (d->protocol == QAbstractSocket::IPv6Protocol) {
- return other.d->protocol == QAbstractSocket::IPv6Protocol
- && memcmp(&d->a6, &other.d->a6, sizeof(Q_IPV6ADDR)) == 0;
+ switch (other.d->protocol) {
+ case QAbstractSocket::IPv4Protocol:
+ quint32 a4;
+ return convertToIpv4(a4, d->a6, mode) && (a4 == other.d->a);
+ case QAbstractSocket::IPv6Protocol:
+ return memcmp(&d->a6, &other.d->a6, sizeof(Q_IPV6ADDR)) == 0;
+ case QAbstractSocket::AnyIPProtocol:
+ return (mode & QHostAddress::ConvertUnspecifiedAddress)
+ && (other.d->a6_64.c[0] == 0) && (other.d->a6_64.c[1] == 0);
+ case QAbstractSocket::UnknownNetworkLayerProtocol:
+ return false;
+ }
+ }
+
+ if ((d->protocol == QAbstractSocket::AnyIPProtocol)
+ && (mode & QHostAddress::ConvertUnspecifiedAddress)) {
+ switch (other.d->protocol) {
+ case QAbstractSocket::IPv4Protocol:
+ return other.d->a == 0;
+ case QAbstractSocket::IPv6Protocol:
+ return (other.d->a6_64.c[0] == 0) && (other.d->a6_64.c[1] == 0);
+ default:
+ break;
+ }
}
+
return d->protocol == other.d->protocol;
}
diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h
index 8236a71986..8cf6876511 100644
--- a/src/network/kernel/qhostaddress.h
+++ b/src/network/kernel/qhostaddress.h
@@ -79,6 +79,16 @@ public:
AnyIPv6,
AnyIPv4
};
+ enum ConversionModeFlag {
+ ConvertV4MappedToIPv4 = 1,
+ ConvertV4CompatToIPv4 = 2,
+ ConvertUnspecifiedAddress = 4,
+ ConvertLocalHost = 8,
+ TolerantConversion = 0xff,
+
+ StrictConversion = 0
+ };
+ Q_DECLARE_FLAGS(ConversionMode, ConversionModeFlag)
QHostAddress();
explicit QHostAddress(quint32 ip4Addr);
@@ -118,6 +128,7 @@ public:
QString scopeId() const;
void setScopeId(const QString &id);
+ bool isEqual(const QHostAddress &address, ConversionMode mode = TolerantConversion) const;
bool operator ==(const QHostAddress &address) const;
bool operator ==(SpecialAddress address) const;
inline bool operator !=(const QHostAddress &address) const
@@ -139,6 +150,7 @@ public:
protected:
QScopedPointer<QHostAddressPrivate> d;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QHostAddress::ConversionMode)
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QHostAddress)
inline bool operator ==(QHostAddress::SpecialAddress address1, const QHostAddress &address2)
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index b98f36a612..9e5d556f2b 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -81,11 +81,7 @@ static bool resolveLibraryInternal()
{
// Attempt to resolve getaddrinfo(); without it we'll have to fall
// back to gethostbyname(), which has no IPv6 support.
-#if defined(Q_OS_WINCE)
- local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo");
- local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo");
- local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo");
-#elif defined (Q_OS_WINRT)
+#if defined (Q_OS_WINRT)
local_getaddrinfo = (getaddrinfoProto) &getaddrinfo;
local_freeaddrinfo = (freeaddrinfoProto) &freeaddrinfo;
local_getnameinfo = (getnameinfoProto) getnameinfo;
@@ -116,11 +112,6 @@ static void translateWSAError(int error, QHostInfo *results)
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
{
-#if defined(Q_OS_WINCE)
- static QBasicMutex qPrivCEMutex;
- QMutexLocker locker(&qPrivCEMutex);
-#endif
-
QSysInfo::machineHostName(); // this initializes ws2_32.dll
// Load res_init on demand.
diff --git a/src/network/kernel/qnetworkfunctions_wince.h b/src/network/kernel/qnetworkfunctions_wince.h
deleted file mode 100644
index 0e464a47f3..0000000000
--- a/src/network/kernel/qnetworkfunctions_wince.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtNetwork module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNETWORKFUNCTIONS_WINCE_H
-#define QNETWORKFUNCTIONS_WINCE_H
-
-#if 0
-#pragma qt_sync_stop_processing
-#endif
-
-#ifdef Q_OS_WINCE
-
-#include <qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-DECLARE_HANDLE(SC_HANDLE);
-typedef enum _SC_ENUM_TYPE {
- SC_ENUM_PROCESS_INFO = 0
-} SC_ENUM_TYPE;
-#define SC_MANAGER_CONNECT 0x0001
-#define SC_MANAGER_CREATE_SERVICE 0x0002
-#define SC_MANAGER_ENUMERATE_SERVICE 0x0004
-#define SERVICE_ACTIVE 0x00000001
-#define SERVICE_INACTIVE 0x00000002
-#define SERVICE_STATE_ALL (SERVICE_ACTIVE | \
- SERVICE_INACTIVE)
-typedef struct _SERVICE_STATUS_PROCESS {
- DWORD dwServiceType;
- DWORD dwCurrentState;
- DWORD dwControlsAccepted;
- DWORD dwWin32ExitCode;
- DWORD dwServiceSpecificExitCode;
- DWORD dwCheckPoint;
- DWORD dwWaitHint;
- DWORD dwProcessId;
- DWORD dwServiceFlags;
-} SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS;
-typedef struct _ENUM_SERVICE_STATUS_PROCESSA {
- LPSTR lpServiceName;
- LPSTR lpDisplayName;
- SERVICE_STATUS_PROCESS ServiceStatusProcess;
-} ENUM_SERVICE_STATUS_PROCESSA, *LPENUM_SERVICE_STATUS_PROCESSA;
-typedef struct _ENUM_SERVICE_STATUS_PROCESSW {
- LPWSTR lpServiceName;
- LPWSTR lpDisplayName;
- SERVICE_STATUS_PROCESS ServiceStatusProcess;
-} ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW;
-#ifdef UNICODE
-typedef ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESS;
-typedef LPENUM_SERVICE_STATUS_PROCESSW LPENUM_SERVICE_STATUS_PROCESS;
-#else
-typedef ENUM_SERVICE_STATUS_PROCESSA ENUM_SERVICE_STATUS_PROCESS;
-typedef LPENUM_SERVICE_STATUS_PROCESSA LPENUM_SERVICE_STATUS_PROCESS;
-#endif // UNICODE
-
-QT_END_NAMESPACE
-
-#endif // Q_OS_WINCE
-#endif // QNETWORKFUNCTIONS_WINCE_H
diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp
index 0a82eac417..3002b2497b 100644
--- a/src/network/kernel/qnetworkinterface_win.cpp
+++ b/src/network/kernel/qnetworkinterface_win.cpp
@@ -81,19 +81,11 @@ static void resolveLibs()
HINSTANCE iphlpapiHnd = GetModuleHandle(L"iphlpapi");
Q_ASSERT(iphlpapiHnd);
-#if defined(Q_OS_WINCE)
- // since Windows Embedded Compact 7
- ptrConvertInterfaceIndexToLuid = (PtrConvertInterfaceIndexToLuid)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceIndexToLuid");
- ptrConvertInterfaceLuidToName = (PtrConvertInterfaceLuidToName)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceLuidToNameW");
- ptrConvertInterfaceLuidToIndex = (PtrConvertInterfaceLuidToIndex)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceLuidToIndex");
- ptrConvertInterfaceNameToLuid = (PtrConvertInterfaceNameToLuid)GetProcAddress(iphlpapiHnd, L"ConvertInterfaceNameToLuidW");
-#else
// since Windows Vista
ptrConvertInterfaceIndexToLuid = (PtrConvertInterfaceIndexToLuid)GetProcAddress(iphlpapiHnd, "ConvertInterfaceIndexToLuid");
ptrConvertInterfaceLuidToName = (PtrConvertInterfaceLuidToName)GetProcAddress(iphlpapiHnd, "ConvertInterfaceLuidToNameW");
ptrConvertInterfaceLuidToIndex = (PtrConvertInterfaceLuidToIndex)GetProcAddress(iphlpapiHnd, "ConvertInterfaceLuidToIndex");
ptrConvertInterfaceNameToLuid = (PtrConvertInterfaceNameToLuid)GetProcAddress(iphlpapiHnd, "ConvertInterfaceNameToLuidW");
-#endif
done = true;
}
}
diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp
index 06a6fbac45..37126298c6 100644
--- a/src/network/kernel/qnetworkproxy_mac.cpp
+++ b/src/network/kernel/qnetworkproxy_mac.cpp
@@ -234,60 +234,55 @@ QList<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query)
QCFType<CFStringRef> cfPacLocation = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, pacLocationSetting, NULL, NULL,
kCFStringEncodingUTF8);
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- QCFType<CFDataRef> pacData;
- QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
- if (!pacUrl) {
- qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
- return result;
- }
- SInt32 errorCode;
- if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
- QString pacLocation = QCFString::toQString(cfPacLocation);
- qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
- return result;
- }
- if (!pacData) {
- qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
- return result;
- }
- QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
- if (!pacScript) {
- // This should never happen, but the documentation says it may return NULL if there was a problem creating the object.
- QString pacLocation = QCFString::toQString(cfPacLocation);
- qWarning("Unable to read the PAC script at \"%s\"", qPrintable(pacLocation));
- return result;
- }
-
- QByteArray encodedURL = query.url().toEncoded(); // converted to UTF-8
- if (encodedURL.isEmpty()) {
- return result; // Invalid URL, abort
- }
-
- QCFType<CFURLRef> targetURL = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*)encodedURL.data(), encodedURL.size(), kCFStringEncodingUTF8, NULL);
- if (!targetURL) {
- return result; // URL creation problem, abort
- }
-
- QCFType<CFErrorRef> pacError;
- QCFType<CFArrayRef> proxies = CFNetworkCopyProxiesForAutoConfigurationScript(pacScript, targetURL, &pacError);
- if (!proxies) {
- QString pacLocation = QCFString::toQString(cfPacLocation);
- QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacError);
- qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
- return result;
- }
-
- CFIndex size = CFArrayGetCount(proxies);
- for (CFIndex i = 0; i < size; ++i) {
- CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(proxies, i);
- result << proxyFromDictionary(proxy);
- }
+ QCFType<CFDataRef> pacData;
+ QCFType<CFURLRef> pacUrl = CFURLCreateWithString(kCFAllocatorDefault, cfPacLocation, NULL);
+ if (!pacUrl) {
+ qWarning("Invalid PAC URL \"%s\"", qPrintable(QCFString::toQString(cfPacLocation)));
return result;
- } else {
+ }
+ SInt32 errorCode;
+ if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, pacUrl, &pacData, NULL, NULL, &errorCode)) {
QString pacLocation = QCFString::toQString(cfPacLocation);
- qWarning("Mac system proxy: PAC script at \"%s\" not handled", qPrintable(pacLocation));
+ qWarning("Unable to get the PAC script at \"%s\" (%s)", qPrintable(pacLocation), cfurlErrorDescription(errorCode));
+ return result;
+ }
+ if (!pacData) {
+ qWarning("\"%s\" returned an empty PAC script", qPrintable(QCFString::toQString(cfPacLocation)));
+ return result;
+ }
+ QCFType<CFStringRef> pacScript = CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, pacData, kCFStringEncodingISOLatin1);
+ if (!pacScript) {
+ // This should never happen, but the documentation says it may return NULL if there was a problem creating the object.
+ QString pacLocation = QCFString::toQString(cfPacLocation);
+ qWarning("Unable to read the PAC script at \"%s\"", qPrintable(pacLocation));
+ return result;
+ }
+
+ QByteArray encodedURL = query.url().toEncoded(); // converted to UTF-8
+ if (encodedURL.isEmpty()) {
+ return result; // Invalid URL, abort
+ }
+
+ QCFType<CFURLRef> targetURL = CFURLCreateWithBytes(kCFAllocatorDefault, (UInt8*)encodedURL.data(), encodedURL.size(), kCFStringEncodingUTF8, NULL);
+ if (!targetURL) {
+ return result; // URL creation problem, abort
+ }
+
+ QCFType<CFErrorRef> pacError;
+ QCFType<CFArrayRef> proxies = CFNetworkCopyProxiesForAutoConfigurationScript(pacScript, targetURL, &pacError);
+ if (!proxies) {
+ QString pacLocation = QCFString::toQString(cfPacLocation);
+ QCFType<CFStringRef> pacErrorDescription = CFErrorCopyDescription(pacError);
+ qWarning("Execution of PAC script at \"%s\" failed: %s", qPrintable(pacLocation), qPrintable(QCFString::toQString(pacErrorDescription)));
+ return result;
+ }
+
+ CFIndex size = CFArrayGetCount(proxies);
+ for (CFIndex i = 0; i < size; ++i) {
+ CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(proxies, i);
+ result << proxyFromDictionary(proxy);
}
+ return result;
}
}
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 513eeaac12..2727bd9257 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -53,7 +53,6 @@
#include <qt_windows.h>
#include <wininet.h>
#include <lmcons.h>
-#include "qnetworkfunctions_wince.h"
/*
* Information on the WinHTTP DLL:
@@ -123,7 +122,6 @@ static PtrWinHttpGetIEProxyConfigForCurrentUser ptrWinHttpGetIEProxyConfigForCur
static PtrWinHttpCloseHandle ptrWinHttpCloseHandle = 0;
-#ifndef Q_OS_WINCE
static bool currentProcessIsService()
{
typedef BOOL (WINAPI *PtrGetUserName)(LPTSTR lpBuffer, LPDWORD lpnSize);
@@ -153,7 +151,6 @@ static bool currentProcessIsService()
}
return false;
}
-#endif // ! Q_OS_WINCE
static QStringList splitSpaceSemicolon(const QString &source)
{
@@ -361,7 +358,7 @@ static QList<QNetworkProxy> parseServerList(const QNetworkProxyQuery &query, con
return removeDuplicateProxies(result);
}
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
namespace {
class QRegistryWatcher {
public:
@@ -412,7 +409,7 @@ private:
QVector<HKEY> m_registryHandles;
};
} // namespace
-#endif // !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#endif // !defined(Q_OS_WINRT)
class QWindowsSystemProxy
{
@@ -431,7 +428,7 @@ public:
QStringList proxyServerList;
QStringList proxyBypass;
QList<QNetworkProxy> defaultResult;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
QRegistryWatcher proxySettingsWatcher;
#endif
bool initialized;
@@ -467,7 +464,7 @@ void QWindowsSystemProxy::reset()
void QWindowsSystemProxy::init()
{
bool proxySettingsChanged = false;
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
proxySettingsChanged = proxySettingsWatcher.hasChanged();
#endif
@@ -477,12 +474,7 @@ void QWindowsSystemProxy::init()
reset();
-#ifdef Q_OS_WINCE
- // Windows CE does not have any of the following API
- return;
-#else
-
-#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_WINRT)
proxySettingsWatcher.clear(); // needs reset to trigger a new detection
proxySettingsWatcher.addLocation(HKEY_CURRENT_USER, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"));
proxySettingsWatcher.addLocation(HKEY_LOCAL_MACHINE, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"));
@@ -570,7 +562,6 @@ void QWindowsSystemProxy::init()
}
functional = isAutoConfig || !proxyServerList.isEmpty();
-#endif
}
QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 098739adc3..cbae297278 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -563,6 +563,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate()
cachedSocketDescriptor(-1),
readBufferMaxSize(0),
isBuffered(false),
+ hasPendingData(false),
connectTimer(0),
disconnectTimer(0),
hostLookupId(-1),
@@ -593,6 +594,7 @@ void QAbstractSocketPrivate::resetSocketLayer()
qDebug("QAbstractSocketPrivate::resetSocketLayer()");
#endif
+ hasPendingData = false;
if (socketEngine) {
socketEngine->close();
socketEngine->disconnect();
@@ -683,14 +685,20 @@ bool QAbstractSocketPrivate::canReadNotification()
qDebug("QAbstractSocketPrivate::canReadNotification()");
#endif
- if (!isBuffered)
- socketEngine->setReadNotificationEnabled(false);
+ if (!isBuffered) {
+ if (hasPendingData) {
+ socketEngine->setReadNotificationEnabled(false);
+ return true;
+ }
+ hasPendingData = true;
+ }
// If buffered, read data from the socket into the read buffer
qint64 newBytes = 0;
if (isBuffered) {
// Return if there is no space in the buffer
if (readBufferMaxSize && buffer.size() >= readBufferMaxSize) {
+ socketEngine->setReadNotificationEnabled(false);
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::canReadNotification() buffer is full");
#endif
@@ -708,11 +716,6 @@ bool QAbstractSocketPrivate::canReadNotification()
return false;
}
newBytes = buffer.size() - newBytes;
-
- // If read buffer is full, disable the read socket notifier.
- if (readBufferMaxSize && buffer.size() == readBufferMaxSize) {
- socketEngine->setReadNotificationEnabled(false);
- }
}
// Only emit readyRead() if there is data available.
@@ -728,10 +731,6 @@ bool QAbstractSocketPrivate::canReadNotification()
return true;
}
- // turn the socket engine off if we've reached the buffer size limit
- if (socketEngine && isBuffered)
- socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable());
-
return true;
}
@@ -788,12 +787,8 @@ bool QAbstractSocketPrivate::canWriteNotification()
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::canWriteNotification() flushing");
#endif
- bool dataWasWritten = writeToSocket();
-
- if (socketEngine && writeBuffer.isEmpty() && socketEngine->bytesToWrite() == 0)
- socketEngine->setWriteNotificationEnabled(false);
- return dataWasWritten;
+ return writeToSocket();
}
/*! \internal
@@ -833,8 +828,12 @@ bool QAbstractSocketPrivate::writeToSocket()
#endif
// this covers the case when the buffer was empty, but we had to wait for the socket engine to finish
- if (state == QAbstractSocket::ClosingState)
+ if (state == QAbstractSocket::ClosingState) {
q->disconnectFromHost();
+ } else {
+ if (socketEngine)
+ socketEngine->setWriteNotificationEnabled(false);
+ }
return false;
}
@@ -872,8 +871,7 @@ bool QAbstractSocketPrivate::writeToSocket()
emit q->channelBytesWritten(0, written);
}
- if (writeBuffer.isEmpty() && socketEngine && socketEngine->isWriteNotificationEnabled()
- && !socketEngine->bytesToWrite())
+ if (writeBuffer.isEmpty() && socketEngine && !socketEngine->bytesToWrite())
socketEngine->setWriteNotificationEnabled(false);
if (state == QAbstractSocket::ClosingState)
q->disconnectFromHost();
@@ -1146,12 +1144,10 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
*/
void QAbstractSocketPrivate::_q_testConnection()
{
- if (socketEngine) {
- if (threadData->hasEventDispatcher()) {
- if (connectTimer)
- connectTimer->stop();
- }
+ if (connectTimer)
+ connectTimer->stop();
+ if (socketEngine) {
if (socketEngine->state() == QAbstractSocket::ConnectedState) {
// Fetch the parameters if our connection is completed;
// otherwise, fall out and try the next address.
@@ -1168,11 +1164,6 @@ void QAbstractSocketPrivate::_q_testConnection()
addresses.clear();
}
- if (threadData->hasEventDispatcher()) {
- if (connectTimer)
- connectTimer->stop();
- }
-
#if defined(QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::_q_testConnection() connection failed,"
" checking for alternative addresses");
@@ -2381,11 +2372,6 @@ void QAbstractSocket::abort()
return;
}
#endif
- if (d->connectTimer) {
- d->connectTimer->stop();
- delete d->connectTimer;
- d->connectTimer = 0;
- }
d->abortCalled = true;
close();
@@ -2432,15 +2418,7 @@ bool QAbstractSocket::atEnd() const
// Note! docs copied to QSslSocket::flush()
bool QAbstractSocket::flush()
{
- Q_D(QAbstractSocket);
-#ifndef QT_NO_SSL
- // Manual polymorphism; flush() isn't virtual, but QSslSocket overloads
- // it.
- if (QSslSocket *socket = qobject_cast<QSslSocket *>(this))
- return socket->flush();
-#endif
- Q_CHECK_SOCKETENGINE(false);
- return d->flush();
+ return d_func()->flush();
}
/*! \reimp
@@ -2463,8 +2441,9 @@ qint64 QAbstractSocket::readData(char *data, qint64 maxSize)
d->setError(d->socketEngine->error(), d->socketEngine->errorString());
d->resetSocketLayer();
d->state = QAbstractSocket::UnconnectedState;
- } else if (!d->socketEngine->isReadNotificationEnabled()) {
+ } else {
// Only do this when there was no error
+ d->hasPendingData = false;
d->socketEngine->setReadNotificationEnabled(true);
}
@@ -2830,12 +2809,12 @@ void QAbstractSocket::setReadBufferSize(qint64 size)
if (d->readBufferMaxSize == size)
return;
d->readBufferMaxSize = size;
- if (!d->emittedReadyRead && d->socketEngine) {
- // ensure that the read notification is enabled if we've now got
- // room in the read buffer
- // but only if we're not inside canReadNotification -- that will take care on its own
- if ((size == 0 || d->buffer.size() < size) && d->state == QAbstractSocket::ConnectedState) // Do not change the notifier unless we are connected.
- d->socketEngine->setReadNotificationEnabled(true);
+
+ // Do not change the notifier unless we are connected.
+ if (d->socketEngine && d->state == QAbstractSocket::ConnectedState) {
+ // Ensure that the read notification is enabled if we've now got
+ // room in the read buffer.
+ d->socketEngine->setReadNotificationEnabled(size == 0 || d->buffer.size() < size);
}
}
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index b718c21ff5..3164c96c1e 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -128,13 +128,12 @@ public:
inline void resolveProxy(quint16 port) { resolveProxy(QString(), port); }
void resetSocketLayer();
- bool flush();
+ virtual bool flush();
bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol);
virtual void configureCreatedSocket();
void startConnectingByName(const QString &host);
void fetchConnectionParameters();
- void setupSocketNotifiers();
bool readFromSocket();
bool writeToSocket();
void emitReadyRead();
@@ -144,6 +143,7 @@ public:
qint64 readBufferMaxSize;
bool isBuffered;
+ bool hasPendingData;
QTimer *connectTimer;
QTimer *disconnectTimer;
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index 19e9e1d9b7..5a05d7c98c 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -66,21 +66,20 @@
QT_BEGIN_NAMESPACE
#ifdef Q_OS_WIN
-#define QT_SOCKLEN_T int
-#define QT_SOCKOPTLEN_T int
+# define QT_SOCKLEN_T int
+# define QT_SOCKOPTLEN_T int
// The following definitions are copied from the MinGW header mswsock.h which
// was placed in the public domain. The WSASendMsg and WSARecvMsg functions
// were introduced with Windows Vista, so some Win32 headers are lacking them.
// There are no known versions of Windows CE or Embedded that contain them.
-#ifndef Q_OS_WINCE
# ifndef WSAID_WSARECVMSG
typedef INT (WINAPI *LPFN_WSARECVMSG)(SOCKET s, LPWSAMSG lpMsg,
LPDWORD lpdwNumberOfBytesRecvd,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
# define WSAID_WSARECVMSG {0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}
-# endif
+# endif // !WSAID_WSARECVMSG
# ifndef WSAID_WSASENDMSG
typedef struct {
LPWSAMSG lpMsg;
@@ -96,9 +95,8 @@ typedef INT (WSAAPI *LPFN_WSASENDMSG)(SOCKET s, LPWSAMSG lpMsg, DWORD dwFlags,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
# define WSAID_WSASENDMSG {0xa441e712,0x754f,0x43ca,{0x84,0xa7,0x0d,0xee,0x44,0xcf,0x60,0x6d}}
-# endif
-#endif
-#endif
+# endif // !WSAID_WSASENDMSG
+#endif // Q_OS_WIN
union qt_sockaddr {
sockaddr a;
@@ -210,7 +208,7 @@ public:
QSocketNotifier *readNotifier, *writeNotifier, *exceptNotifier;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
LPFN_WSASENDMSG sendmsg;
LPFN_WSARECVMSG recvmsg;
# endif
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 5ffe7b11b8..0c5b8d9264 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -387,7 +387,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
return false;
}
-#if !defined(Q_OS_WINCE)
if (socketType == QAbstractSocket::UdpSocket) {
// enable new behavior using
// SIO_UDP_CONNRESET
@@ -414,7 +413,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
&sendmsgguid, sizeof(sendmsgguid),
&sendmsg, sizeof(sendmsg), &bytesReturned, NULL, NULL) == SOCKET_ERROR)
sendmsg = 0;
-#endif
socketDescriptor = socket;
if (socket != INVALID_SOCKET) {
@@ -1091,7 +1089,6 @@ qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const
bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
{
-#if !defined(Q_OS_WINCE)
// Create a sockaddr struct and reset its port number.
qt_sockaddr storage;
QT_SOCKLEN_T storageSize = sizeof(storage);
@@ -1118,18 +1115,6 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
result = true;
}
-#else // Q_OS_WINCE
- bool result = false;
- fd_set readS;
- FD_ZERO(&readS);
- FD_SET((SOCKET)socketDescriptor, &readS);
- timeval timeout;
- timeout.tv_sec = 0;
- timeout.tv_usec = 5000;
- int available = ::select(1, &readS, 0, 0, &timeout);
- result = available > 0;
-#endif
-
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeHasPendingDatagrams() == %s",
result ? "true" : "false");
@@ -1141,7 +1126,6 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
{
qint64 ret = -1;
-#if !defined(Q_OS_WINCE)
int recvResult = 0;
DWORD flags;
DWORD bufferCount = 5;
@@ -1186,18 +1170,6 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
if (buf)
delete[] buf;
-#else // Q_OS_WINCE
- DWORD size = -1;
- DWORD bytesReturned;
- int ioResult = WSAIoctl(socketDescriptor, FIONREAD, 0,0, &size, sizeof(size), &bytesReturned, 0, 0);
- if (ioResult == SOCKET_ERROR) {
- int err = WSAGetLastError();
- WS_ERROR_DEBUG(err);
- } else {
- ret = qint64(size);
- }
-#endif
-
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %lli", ret);
#endif
@@ -1205,12 +1177,6 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const
return ret;
}
-#ifdef Q_OS_WINCE
-// Windows CE has no support for sendmsg or recvmsg. We set it to null here to simplify the code below.
-static int (*const recvmsg)(...) = 0;
-static int (*const sendmsg)(...) = 0;
-#endif
-
qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxLength, QIpPacketHeader *header,
QAbstractSocketEngine::PacketHeaderOptions options)
{
@@ -1330,12 +1296,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
memset(&msg, 0, sizeof(msg));
memset(&aa, 0, sizeof(aa));
-#if !defined(Q_OS_WINCE)
buf.buf = len ? (char*)data : 0;
-#else
- char tmp;
- buf.buf = len ? (char*)data : &tmp;
-#endif
msg.lpBuffers = &buf;
msg.dwBufferCount = 1;
msg.name = &aa.a;
@@ -1497,9 +1458,6 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength)
buf.len = maxLength;
DWORD flags = 0;
DWORD bytesRead = 0;
-#if defined(Q_OS_WINCE)
- WSASetLastError(0);
-#endif
if (::WSARecv(socketDescriptor, &buf, 1, &bytesRead, &flags, 0,0) == SOCKET_ERROR) {
int err = WSAGetLastError();
WS_ERROR_DEBUG(err);
@@ -1613,11 +1571,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout,
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
-#if !defined(Q_OS_WINCE)
ret = select(socketDescriptor + 1, &fdread, &fdwrite, &fdexception, timeout < 0 ? 0 : &tv);
-#else
- ret = select(1, &fdread, &fdwrite, &fdexception, timeout < 0 ? 0 : &tv);
-#endif
//... but if it is actually set, pretend it did not happen
if (ret > 0 && FD_ISSET((SOCKET)socketDescriptor, &fdexception))
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index a57a1dca2c..ee3e0d9f0e 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -64,11 +64,7 @@ static const int MaxWriteBufferSize = 128*1024;
//#define QSOCKS5SOCKETLAYER_DEBUG
#define MAX_DATA_DUMP 256
-#if !defined(Q_OS_WINCE)
#define SOCKS5_BLOCKING_BIND_TIMEOUT 5000
-#else
-#define SOCKS5_BLOCKING_BIND_TIMEOUT 10000
-#endif
#define Q_INIT_CHECK(returnValue) do { \
if (!d->data) { \
diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp
index de1dc29cfb..d9ffdbd214 100644
--- a/src/network/socket/qtcpserver.cpp
+++ b/src/network/socket/qtcpserver.cpp
@@ -543,8 +543,11 @@ QTcpSocket *QTcpServer::nextPendingConnection()
if (d->pendingConnections.isEmpty())
return 0;
- if (!d->socketEngine->isReadNotificationEnabled())
+ if (!d->socketEngine) {
+ qWarning("QTcpServer::nextPendingConnection() called while not listening");
+ } else if (!d->socketEngine->isReadNotificationEnabled()) {
d->socketEngine->setReadNotificationEnabled(true);
+ }
return d->pendingConnections.takeFirst();
}
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index c406009069..083648bc23 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -398,7 +398,8 @@ qint64 QUdpSocket::readDatagram(char *data, qint64 maxSize, QHostAddress *addres
readBytes = d->socketEngine->readDatagram(data, maxSize);
}
- d_func()->socketEngine->setReadNotificationEnabled(true);
+ d->hasPendingData = false;
+ d->socketEngine->setReadNotificationEnabled(true);
if (readBytes < 0)
d->setErrorAndEmit(d->socketEngine->error(), d->socketEngine->errorString());
return readBytes;
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index f50a7b1229..2d80f38bec 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -43,7 +43,7 @@ win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp \
socket/qlocalsocket_win.cpp \
socket/qlocalserver_win.cpp
-win32:!wince:!winrt:LIBS_PRIVATE += -ladvapi32
+win32:!winrt:LIBS_PRIVATE += -ladvapi32
winrt {
SOURCES += socket/qnativesocketengine_winrt.cpp \
@@ -54,15 +54,6 @@ winrt {
DEFINES += QT_LOCALSOCKET_TCP
}
-wince {
- SOURCES -= socket/qlocalsocket_win.cpp \
- socket/qlocalserver_win.cpp
- SOURCES += socket/qlocalsocket_tcp.cpp \
- socket/qlocalserver_tcp.cpp
-
- DEFINES += QT_LOCALSOCKET_TCP
-}
-
integrity: {
SOURCES -= socket/qlocalsocket_unix.cpp \
socket/qlocalserver_unix.cpp
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index c8040dec7f..e009824a69 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -119,7 +119,8 @@ const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1";
/*!
\enum QSslConfiguration::NextProtocolNegotiationStatus
- Describes the status of the Next Protocol Negotiation (NPN).
+ Describes the status of the Next Protocol Negotiation (NPN) or
+ Application-Layer Protocol Negotiation (ALPN).
\value NextProtocolNegotiationNone No application protocol
has been negotiated (yet).
@@ -209,9 +210,11 @@ bool QSslConfiguration::operator==(const QSslConfiguration &other) const
d->privateKey == other.d->privateKey &&
d->sessionCipher == other.d->sessionCipher &&
d->sessionProtocol == other.d->sessionProtocol &&
+ d->preSharedKeyIdentityHint == other.d->preSharedKeyIdentityHint &&
d->ciphers == other.d->ciphers &&
d->ellipticCurves == other.d->ellipticCurves &&
d->ephemeralServerKey == other.d->ephemeralServerKey &&
+ d->dhParams == other.d->dhParams &&
d->caCertificates == other.d->caCertificates &&
d->protocol == other.d->protocol &&
d->peerVerifyMode == other.d->peerVerifyMode &&
@@ -254,6 +257,7 @@ bool QSslConfiguration::isNull() const
d->ciphers.count() == 0 &&
d->ellipticCurves.isEmpty() &&
d->ephemeralServerKey.isNull() &&
+ d->dhParams == QSslDiffieHellmanParameters::defaultParameters() &&
d->localCertificateChain.isEmpty() &&
d->privateKey.isNull() &&
d->peerCertificate.isNull() &&
@@ -261,6 +265,7 @@ bool QSslConfiguration::isNull() const
d->sslOptions == QSslConfigurationPrivate::defaultSslOptions &&
d->sslSession.isNull() &&
d->sslSessionTicketLifeTimeHint == -1 &&
+ d->preSharedKeyIdentityHint.isNull() &&
d->nextAllowedProtocols.isEmpty() &&
d->nextNegotiatedProtocol.isNull() &&
d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
@@ -811,11 +816,65 @@ QVector<QSslEllipticCurve> QSslConfiguration::supportedEllipticCurves()
}
/*!
+ \since 5.8
+
+ Returns the identity hint.
+
+ \sa setPreSharedKeyIdentityHint()
+*/
+QByteArray QSslConfiguration::preSharedKeyIdentityHint() const
+{
+ return d->preSharedKeyIdentityHint;
+}
+
+/*!
+ \since 5.8
+
+ Sets the identity hint for a preshared key authentication. This will affect the next
+ initiated handshake; calling this function on an already-encrypted socket
+ will not affect the socket's identity hint.
+
+ The identity hint is used in QSslSocket::SslServerMode only!
+*/
+void QSslConfiguration::setPreSharedKeyIdentityHint(const QByteArray &hint)
+{
+ d->preSharedKeyIdentityHint = hint;
+}
+
+/*!
+ \since 5.8
+
+ Retrieves the current set of Diffie-Hellman parameters.
+
+ If no Diffie-Hellman parameters have been set, the QSslConfiguration object
+ defaults to using the 1024-bit MODP group from RFC 2409.
+ */
+QSslDiffieHellmanParameters QSslConfiguration::diffieHellmanParameters() const
+{
+ return d->dhParams;
+}
+
+/*!
+ \since 5.8
+
+ Sets a custom set of Diffie-Hellman parameters to be used by this socket when functioning as
+ a server.
+
+ If no Diffie-Hellman parameters have been set, the QSslConfiguration object
+ defaults to using the 1024-bit MODP group from RFC 2409.
+ */
+void QSslConfiguration::setDiffieHellmanParameters(const QSslDiffieHellmanParameters &dhparams)
+{
+ d->dhParams = dhparams;
+}
+
+/*!
\since 5.3
This function returns the protocol negotiated with the server
- if the Next Protocol Negotiation (NPN) TLS extension was enabled.
- In order for the NPN extension to be enabled, setAllowedNextProtocols()
+ if the Next Protocol Negotiation (NPN) or Application-Layer Protocol
+ Negotiation (ALPN) TLS extension was enabled.
+ In order for the NPN/ALPN extension to be enabled, setAllowedNextProtocols()
needs to be called explicitly before connecting to the server.
If no protocol could be negotiated or the extension was not enabled,
@@ -832,9 +891,10 @@ QByteArray QSslConfiguration::nextNegotiatedProtocol() const
\since 5.3
This function sets the allowed \a protocols to be negotiated with the
- server through the Next Protocol Negotiation (NPN) TLS extension; each
+ server through the Next Protocol Negotiation (NPN) or Application-Layer
+ Protocol Negotiation (ALPN) TLS extension; each
element in \a protocols must define one allowed protocol.
- The function must be called explicitly before connecting to send the NPN
+ The function must be called explicitly before connecting to send the NPN/ALPN
extension in the SSL handshake.
Whether or not the negotiation succeeded can be queried through
nextProtocolNegotiationStatus().
@@ -854,8 +914,8 @@ void QSslConfiguration::setAllowedNextProtocols(QList<QByteArray> protocols)
\since 5.3
This function returns the allowed protocols to be negotiated with the
- server through the Next Protocol Negotiation (NPN) TLS extension, as set
- by setAllowedNextProtocols().
+ server through the Next Protocol Negotiation (NPN) or Application-Layer
+ Protocol Negotiation (ALPN) TLS extension, as set by setAllowedNextProtocols().
\sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), setAllowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1
*/
@@ -867,7 +927,8 @@ QList<QByteArray> QSslConfiguration::allowedNextProtocols() const
/*!
\since 5.3
- This function returns the status of the Next Protocol Negotiation (NPN).
+ This function returns the status of the Next Protocol Negotiation (NPN)
+ or Application-Layer Protocol Negotiation (ALPN).
If the feature has not been enabled through setAllowedNextProtocols(),
this function returns NextProtocolNegotiationNone.
The status will be set before emitting the encrypted() signal.
diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h
index f0754d7ef5..61246e1009 100644
--- a/src/network/ssl/qsslconfiguration.h
+++ b/src/network/ssl/qsslconfiguration.h
@@ -69,6 +69,7 @@ class QSslCertificate;
class QSslCipher;
class QSslKey;
class QSslEllipticCurve;
+class QSslDiffieHellmanParameters;
class QSslConfigurationPrivate;
class Q_NETWORK_EXPORT QSslConfiguration
@@ -141,6 +142,12 @@ public:
void setEllipticCurves(const QVector<QSslEllipticCurve> &curves);
static QVector<QSslEllipticCurve> supportedEllipticCurves();
+ QByteArray preSharedKeyIdentityHint() const;
+ void setPreSharedKeyIdentityHint(const QByteArray &hint);
+
+ QSslDiffieHellmanParameters diffieHellmanParameters() const;
+ void setDiffieHellmanParameters(const QSslDiffieHellmanParameters &dhparams);
+
static QSslConfiguration defaultConfiguration();
static void setDefaultConfiguration(const QSslConfiguration &configuration);
diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h
index 364bba92ec..139a9fc32b 100644
--- a/src/network/ssl/qsslconfiguration_p.h
+++ b/src/network/ssl/qsslconfiguration_p.h
@@ -73,6 +73,7 @@
#include "qsslcipher.h"
#include "qsslkey.h"
#include "qsslellipticcurve.h"
+#include "qssldiffiehellmanparameters.h"
QT_BEGIN_NAMESPACE
@@ -87,8 +88,10 @@ public:
allowRootCertOnDemandLoading(true),
peerSessionShared(false),
sslOptions(QSslConfigurationPrivate::defaultSslOptions),
+ dhParams(QSslDiffieHellmanParameters::defaultParameters()),
sslSessionTicketLifeTimeHint(-1),
ephemeralServerKey(),
+ preSharedKeyIdentityHint(),
nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone)
{ }
@@ -117,11 +120,15 @@ public:
QVector<QSslEllipticCurve> ellipticCurves;
+ QSslDiffieHellmanParameters dhParams;
+
QByteArray sslSession;
int sslSessionTicketLifeTimeHint;
QSslKey ephemeralServerKey;
+ QByteArray preSharedKeyIdentityHint;
+
QList<QByteArray> nextAllowedProtocols;
QByteArray nextNegotiatedProtocol;
QSslConfiguration::NextProtocolNegotiationStatus nextProtocolNegotiationStatus;
diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
index f132d0228c..5a80d08e24 100644
--- a/src/network/ssl/qsslcontext_openssl.cpp
+++ b/src/network/ssl/qsslcontext_openssl.cpp
@@ -41,6 +41,7 @@
#include <QtNetwork/qsslsocket.h>
+#include <QtNetwork/qssldiffiehellmanparameters.h>
#include <QtCore/qmutex.h>
#include "private/qssl_p.h"
@@ -48,6 +49,7 @@
#include "private/qsslsocket_p.h"
#include "private/qsslsocket_openssl_p.h"
#include "private/qsslsocket_openssl_symbols_p.h"
+#include "private/qssldiffiehellmanparameters_p.h"
QT_BEGIN_NAMESPACE
@@ -55,22 +57,6 @@ QT_BEGIN_NAMESPACE
extern int q_X509Callback(int ok, X509_STORE_CTX *ctx);
extern QString getErrorsFromOpenSsl();
-static DH *get_dh1024()
-{
- // Default DH params
- // 1024-bit MODP Group
- // From RFC 2409
- QByteArray params = QByteArray::fromBase64(
- QByteArrayLiteral("MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR" \
- "Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL" \
- "/1y29Aa37e44a/taiZ+lrp8kEXxLH+ZJKGZR7OZTgf//////////AgEC"));
-
- const char *ptr = params.constData();
- DH *dh = q_d2i_DHparams(NULL, reinterpret_cast<const unsigned char **>(&ptr), params.length());
-
- return dh;
-}
-
QSslContext::QSslContext()
: ctx(0),
pkey(0),
@@ -325,10 +311,23 @@ init_context:
sslContext->setSessionASN1(configuration.sessionTicket());
// Set temp DH params
- DH *dh = 0;
- dh = get_dh1024();
- q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh);
- q_DH_free(dh);
+ QSslDiffieHellmanParameters dhparams = configuration.diffieHellmanParameters();
+
+ if (!dhparams.isValid()) {
+ sslContext->errorStr = QSslSocket::tr("Diffie-Hellman parameters are not valid");
+ sslContext->errorCode = QSslError::UnspecifiedError;
+ return;
+ }
+
+ if (!dhparams.isEmpty()) {
+ const QByteArray &params = dhparams.d.data()->derData;
+ const char *ptr = params.constData();
+ DH *dh = q_d2i_DHparams(NULL, reinterpret_cast<const unsigned char **>(&ptr), params.length());
+ if (dh == NULL)
+ qFatal("q_d2i_DHparams failed to convert QSslDiffieHellmanParameters to DER form");
+ q_SSL_CTX_set_tmp_dh(sslContext->ctx, dh);
+ q_DH_free(dh);
+ }
#ifndef OPENSSL_NO_EC
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
@@ -345,6 +344,11 @@ init_context:
}
#endif // OPENSSL_NO_EC
+#ifndef OPENSSL_NO_PSK
+ if (!client)
+ q_SSL_CTX_use_psk_identity_hint(sslContext->ctx, sslContext->sslConfiguration.preSharedKeyIdentityHint().constData());
+#endif // OPENSSL_NO_PSK
+
const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
if (!qcurves.isEmpty()) {
#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
@@ -458,6 +462,23 @@ SSL* QSslContext::createSsl()
m_npnContext.data = reinterpret_cast<unsigned char *>(m_supportedNPNVersions.data());
m_npnContext.len = m_supportedNPNVersions.count();
m_npnContext.status = QSslConfiguration::NextProtocolNegotiationNone;
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+ if (q_SSLeay() >= 0x10002000L) {
+ // Callback's type has a parameter 'const unsigned char ** out'
+ // since it was introduced in 1.0.2. Internally, OpenSSL's own code
+ // (tests/examples) cast it to unsigned char * (since it's 'out').
+ // We just re-use our NPN callback and cast here:
+ typedef int (*alpn_callback_t) (SSL *, const unsigned char **, unsigned char *,
+ const unsigned char *, unsigned int, void *);
+ // With ALPN callback is for a server side only, for a client m_npnContext.status
+ // will stay in NextProtocolNegotiationNone.
+ q_SSL_CTX_set_alpn_select_cb(ctx, alpn_callback_t(next_proto_cb), &m_npnContext);
+ // Client:
+ q_SSL_set_alpn_protos(ssl, m_npnContext.data, m_npnContext.len);
+ }
+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ...
+
+ // And in case our peer does not support ALPN, but supports NPN:
q_SSL_CTX_set_next_proto_select_cb(ctx, next_proto_cb, &m_npnContext);
}
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
diff --git a/src/network/ssl/qssldiffiehellmanparameters.cpp b/src/network/ssl/qssldiffiehellmanparameters.cpp
new file mode 100644
index 0000000000..d411ea0a5d
--- /dev/null
+++ b/src/network/ssl/qssldiffiehellmanparameters.cpp
@@ -0,0 +1,307 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+/*!
+ \class QSslDiffieHellmanParameters
+ \brief The QSslDiffieHellmanParameters class provides an interface for Diffie-Hellman parameters for servers.
+ \since 5.8
+
+ \reentrant
+ \ingroup network
+ \ingroup ssl
+ \ingroup shared
+ \inmodule QtNetwork
+
+ QSslDiffieHellmanParameters provides an interface for setting Diffie-Hellman parameters to servers based on QSslSocket.
+
+ \sa QSslSocket, QSslCipher, QSslConfiguration
+*/
+
+#include "qssldiffiehellmanparameters.h"
+#include "qssldiffiehellmanparameters_p.h"
+#include "qsslsocket.h"
+#include "qsslsocket_p.h"
+
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qatomic.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qbytearraymatcher.h>
+#include <QtCore/qiodevice.h>
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ Returns the default QSslDiffieHellmanParameters used by QSslSocket.
+
+ This is currently the 1024-bit MODP group from RFC 2459, also
+ known as the Second Oakley Group.
+*/
+QSslDiffieHellmanParameters QSslDiffieHellmanParameters::defaultParameters()
+{
+ // The 1024-bit MODP group from RFC 2459 (Second Oakley Group)
+ return QSslDiffieHellmanParameters(
+ QByteArray::fromBase64(QByteArrayLiteral(
+ "MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR"
+ "Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL"
+ "/1y29Aa37e44a/taiZ+lrp8kEXxLH+ZJKGZR7OZTgf//////////AgEC"
+ )),
+ QSsl::Der
+ );
+}
+
+/*!
+ Constructs an empty QSslDiffieHellmanParameters instance.
+
+ If an empty QSslDiffieHellmanParameters instance is set on a
+ QSslConfiguration object, Diffie-Hellman negotiation will
+ be disabled.
+
+ \sa isValid()
+ \sa QSslConfiguration
+*/
+QSslDiffieHellmanParameters::QSslDiffieHellmanParameters()
+ : d(new QSslDiffieHellmanParametersPrivate)
+{
+}
+
+/*!
+ Constructs a QSslDiffieHellmanParameters object using
+ the byte array \a encoded in either PEM or DER form.
+
+ After construction, the isValid() method should be used to
+ check whether the Diffie-Hellman parameters were valid and
+ loaded correctly.
+
+ \sa isValid()
+ \sa QSslConfiguration
+*/
+QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat encoding)
+ : d(new QSslDiffieHellmanParametersPrivate)
+{
+ switch (encoding) {
+ case QSsl::Der:
+ d->decodeDer(encoded);
+ break;
+ case QSsl::Pem:
+ d->decodePem(encoded);
+ break;
+ }
+}
+
+/*!
+ Constructs a QSslDiffieHellmanParameters object by
+ reading from \a device in either PEM or DER form.
+
+ After construction, the isValid() method should be used
+ to check whether the Diffie-Hellman parameters were valid
+ and loaded correctly.
+
+ \sa isValid()
+ \sa QSslConfiguration
+*/
+QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat encoding)
+ : d(new QSslDiffieHellmanParametersPrivate)
+{
+ if (!device)
+ return;
+
+ const QByteArray encoded = device->readAll();
+
+ switch (encoding) {
+ case QSsl::Der:
+ d->decodeDer(encoded);
+ break;
+ case QSsl::Pem:
+ d->decodePem(encoded);
+ break;
+ }
+}
+
+/*!
+ Constructs an identical copy of \a other.
+*/
+QSslDiffieHellmanParameters::QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other) : d(other.d)
+{
+}
+
+/*!
+ Destroys the QSslDiffieHellmanParameters object.
+*/
+QSslDiffieHellmanParameters::~QSslDiffieHellmanParameters()
+{
+}
+
+/*!
+ Copies the contents of \a other into this QSslDiffieHellmanParameters, making the two QSslDiffieHellmanParameters
+ identical.
+
+ Returns a reference to this QSslDiffieHellmanParameters.
+*/
+QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(const QSslDiffieHellmanParameters &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*!
+ \fn QSslDiffieHellmanParameters &QSslDiffieHellmanParameters::operator=(QSslDiffieHellmanParameters &&other)
+
+ Move-assigns \a other to this QSslDiffieHellmanParameters instance.
+*/
+
+/*!
+ \fn void QSslDiffieHellmanParameters::swap(QSslDiffieHellmanParameters &other)
+
+ Swaps this QSslDiffieHellmanParameters with \a other. This function is very fast and
+ never fails.
+*/
+
+/*!
+ Returns \c true if this is a an empty QSslDiffieHellmanParameters instance.
+
+ Setting an empty QSslDiffieHellmanParameters instance on a QSslSocket-based
+ server will disable Diffie-Hellman key exchange.
+*/
+bool QSslDiffieHellmanParameters::isEmpty() const Q_DECL_NOTHROW
+{
+ return d->derData.isNull() && d->error == QSslDiffieHellmanParameters::NoError;
+}
+
+/*!
+ Returns \c true if this is a valid QSslDiffieHellmanParameters; otherwise false.
+
+ This method should be used after constructing a QSslDiffieHellmanParameters
+ object to determine its validity.
+
+ If a QSslDiffieHellmanParameters object is not valid, you can use the error()
+ method to determine what error prevented the object from being constructed.
+
+ \sa clear()
+ \sa error()
+*/
+bool QSslDiffieHellmanParameters::isValid() const Q_DECL_NOTHROW
+{
+ return d->error == QSslDiffieHellmanParameters::NoError;
+}
+
+/*!
+ \enum QSslDiffieHellmanParameters::Error
+
+ Describes a QSslDiffieHellmanParameters error.
+
+ \value ErrorInvalidInputData The given input data could not be used to
+ construct a QSslDiffieHellmanParameters
+ object.
+
+ \value ErrorUnsafeParameters The Diffie-Hellman parameters are unsafe
+ and should not be used.
+*/
+
+/*!
+ Returns the error that caused the QSslDiffieHellmanParameters object
+ to be invalid.
+*/
+QSslDiffieHellmanParameters::Error QSslDiffieHellmanParameters::error() const Q_DECL_NOTHROW
+{
+ return d->error;
+}
+
+/*!
+ Returns a human-readable description of the error that caused the
+ QSslDiffieHellmanParameters object to be invalid.
+*/
+QString QSslDiffieHellmanParameters::errorString() const Q_DECL_NOTHROW
+{
+ switch (d->error) {
+ case QSslDiffieHellmanParameters::NoError:
+ return QCoreApplication::translate("QSslDiffieHellmanParameter", "No error");
+ case QSslDiffieHellmanParameters::InvalidInputDataError:
+ return QCoreApplication::translate("QSslDiffieHellmanParameter", "Invalid input data");
+ case QSslDiffieHellmanParameters::UnsafeParametersError:
+ return QCoreApplication::translate("QSslDiffieHellmanParameter", "The given Diffie-Hellman parameters are deemed unsafe");
+ }
+
+ Q_UNREACHABLE();
+ return QString();
+}
+
+/*!
+ \relates QSslDiffieHellmanParameters
+
+ Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.
+*/
+bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW
+{
+ return lhs.d->derData == rhs.d->derData;
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+/*!
+ \relates QSslDiffieHellmanParameters
+
+ Writes the set of Diffie-Hellman parameters in \a dhparm into the debug object \a debug for
+ debugging purposes.
+
+ The Diffie-Hellman parameters will be represented in Base64-encoded DER form.
+
+ \sa {Debugging Techniques}
+*/
+QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam)
+{
+ QDebugStateSaver saver(debug);
+ debug.resetFormat().nospace();
+ debug << "QSslDiffieHellmanParameters(" << dhparam.d->derData.toBase64() << ')';
+ return debug;
+}
+#endif
+
+/*!
+ \relates QHash
+
+ Returns an hash value for \a dhparam, using \a seed to seed
+ the calculation.
+*/
+uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed) Q_DECL_NOTHROW
+{
+ return qHash(dhparam.d->derData, seed);
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/ssl/qssldiffiehellmanparameters.h b/src/network/ssl/qssldiffiehellmanparameters.h
new file mode 100644
index 0000000000..aa40be83a6
--- /dev/null
+++ b/src/network/ssl/qssldiffiehellmanparameters.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QSSLDIFFIEHELLMANPARAMETERS_H
+#define QSSLDIFFIEHELLMANPARAMETERS_H
+
+#include <QtNetwork/qssl.h>
+#include <QtCore/qnamespace.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qshareddata.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_NO_SSL
+
+class QIODevice;
+class QSslContext;
+class QSslDiffieHellmanParametersPrivate;
+
+class QSslDiffieHellmanParameters;
+// qHash is a friend, but we can't use default arguments for friends (§8.3.6.4)
+Q_NETWORK_EXPORT uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed = 0) Q_DECL_NOTHROW;
+
+#ifndef QT_NO_DEBUG_STREAM
+class QDebug;
+Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparams);
+#endif
+
+Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW;
+
+inline bool operator!=(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW
+{
+ return !operator==(lhs, rhs);
+}
+
+class QSslDiffieHellmanParameters
+{
+public:
+ enum Error {
+ NoError,
+ InvalidInputDataError,
+ UnsafeParametersError
+ };
+
+ Q_NETWORK_EXPORT static QSslDiffieHellmanParameters defaultParameters();
+
+ Q_NETWORK_EXPORT QSslDiffieHellmanParameters();
+ Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(const QByteArray &encoded, QSsl::EncodingFormat format = QSsl::Pem);
+ Q_NETWORK_EXPORT explicit QSslDiffieHellmanParameters(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem);
+ Q_NETWORK_EXPORT QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other);
+ Q_NETWORK_EXPORT ~QSslDiffieHellmanParameters();
+ Q_NETWORK_EXPORT QSslDiffieHellmanParameters &operator=(const QSslDiffieHellmanParameters &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ QSslDiffieHellmanParameters &operator=(QSslDiffieHellmanParameters &&other) Q_DECL_NOTHROW { swap(other); return *this; }
+#endif
+
+ void swap(QSslDiffieHellmanParameters &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
+
+ Q_NETWORK_EXPORT bool isEmpty() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT bool isValid() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT QSslDiffieHellmanParameters::Error error() const Q_DECL_NOTHROW;
+ Q_NETWORK_EXPORT QString errorString() const Q_DECL_NOTHROW;
+
+private:
+ QExplicitlySharedDataPointer<QSslDiffieHellmanParametersPrivate> d;
+ friend class QSslContext;
+ friend Q_NETWORK_EXPORT bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs) Q_DECL_NOTHROW;
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslDiffieHellmanParameters &dhparam);
+#endif
+ friend Q_NETWORK_EXPORT uint qHash(const QSslDiffieHellmanParameters &dhparam, uint seed) Q_DECL_NOTHROW;
+};
+
+Q_DECLARE_SHARED(QSslDiffieHellmanParameters)
+
+#endif // QT_NO_SSL
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/global/qconfig-dist.h b/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp
index c9739db990..42222f3f38 100644
--- a/src/corelib/global/qconfig-dist.h
+++ b/src/network/ssl/qssldiffiehellmanparameters_dummy.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
+** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -38,11 +38,22 @@
****************************************************************************/
-/*
- Empty leaves all features enabled. See doc/html/emb-features.html for choices.
+#include "qssldiffiehellmanparameters.h"
+#include "qssldiffiehellmanparameters_p.h"
- Note that disabling some features will produce a libqt that is not
- compatible with other libqt builds. Such modifications are only
- supported on Qt for Embedded Linux where reducing the library size is
- important and where the application suite is often a fixed set.
-*/
+#include <QtCore/qglobal.h>
+#include <QtCore/qbytearray.h>
+
+QT_BEGIN_NAMESPACE
+
+void QSslDiffieHellmanParametersPrivate::decodeDer(const QByteArray &)
+{
+ Q_UNIMPLEMENTED();
+}
+
+void QSslDiffieHellmanParametersPrivate::decodePem(const QByteArray &)
+{
+ Q_UNIMPLEMENTED();
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp b/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp
new file mode 100644
index 0000000000..949da1b7df
--- /dev/null
+++ b/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qssldiffiehellmanparameters.h"
+#include "qssldiffiehellmanparameters_p.h"
+#include "qsslsocket_openssl_symbols_p.h"
+#include "qsslsocket.h"
+#include "qsslsocket_p.h"
+
+#include <QtCore/qatomic.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qiodevice.h>
+#ifndef QT_NO_DEBUG_STREAM
+#include <QtCore/qdebug.h>
+#endif
+
+// For q_BN_is_word.
+#include <openssl/bn.h>
+
+QT_BEGIN_NAMESPACE
+
+static bool isSafeDH(DH *dh)
+{
+ int status = 0;
+ int bad = 0;
+
+ QSslSocketPrivate::ensureInitialized();
+
+ // Mark p < 1024 bits as unsafe.
+ if (q_BN_num_bits(dh->p) < 1024) {
+ return false;
+ }
+
+ if (q_DH_check(dh, &status) != 1)
+ return false;
+
+ // From https://wiki.openssl.org/index.php/Diffie-Hellman_parameters:
+ //
+ // The additional call to BN_mod_word(dh->p, 24)
+ // (and unmasking of DH_NOT_SUITABLE_GENERATOR)
+ // is performed to ensure your program accepts
+ // IETF group parameters. OpenSSL checks the prime
+ // is congruent to 11 when g = 2; while the IETF's
+ // primes are congruent to 23 when g = 2.
+ // Without the test, the IETF parameters would
+ // fail validation. For details, see Diffie-Hellman
+ // Parameter Check (when g = 2, must p mod 24 == 11?).
+ if (q_BN_is_word(dh->g, DH_GENERATOR_2)) {
+ long residue = q_BN_mod_word(dh->p, 24);
+ if (residue == 11 || residue == 23)
+ status &= ~DH_NOT_SUITABLE_GENERATOR;
+ }
+
+ bad |= DH_CHECK_P_NOT_PRIME;
+ bad |= DH_CHECK_P_NOT_SAFE_PRIME;
+ bad |= DH_NOT_SUITABLE_GENERATOR;
+
+ return !(status & bad);
+}
+
+void QSslDiffieHellmanParametersPrivate::decodeDer(const QByteArray &der)
+{
+ if (der.isEmpty()) {
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ return;
+ }
+
+ const unsigned char *data = reinterpret_cast<const unsigned char *>(der.data());
+ int len = der.size();
+
+ QSslSocketPrivate::ensureInitialized();
+
+ DH *dh = q_d2i_DHparams(NULL, &data, len);
+ if (dh) {
+ if (isSafeDH(dh))
+ derData = der;
+ else
+ error = QSslDiffieHellmanParameters::UnsafeParametersError;
+ } else {
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ }
+
+ q_DH_free(dh);
+}
+
+void QSslDiffieHellmanParametersPrivate::decodePem(const QByteArray &pem)
+{
+ if (pem.isEmpty()) {
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ return;
+ }
+
+ if (!QSslSocket::supportsSsl()) {
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ return;
+ }
+
+ QSslSocketPrivate::ensureInitialized();
+
+ BIO *bio = q_BIO_new_mem_buf(const_cast<char *>(pem.data()), pem.size());
+ if (!bio) {
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ return;
+ }
+
+ DH *dh = Q_NULLPTR;
+ q_PEM_read_bio_DHparams(bio, &dh, 0, 0);
+
+ if (dh) {
+ if (isSafeDH(dh)) {
+ char *buf = Q_NULLPTR;
+ int len = q_i2d_DHparams(dh, reinterpret_cast<unsigned char **>(&buf));
+ if (len > 0)
+ derData = QByteArray(buf, len);
+ else
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ } else {
+ error = QSslDiffieHellmanParameters::UnsafeParametersError;
+ }
+ } else {
+ error = QSslDiffieHellmanParameters::InvalidInputDataError;
+ }
+
+ q_DH_free(dh);
+ q_BIO_free(bio);
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/network/ssl/qssldiffiehellmanparameters_p.h
index f2c620a966..a5da4e51fc 100644
--- a/src/widgets/kernel/qwidgetsfunctions_wince.h
+++ b/src/network/ssl/qssldiffiehellmanparameters_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
+** Copyright (C) 2015 Mikkel Krautz <mikkel@krautz.dk>
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the QtWidgets module of the Qt Toolkit.
+** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -36,25 +36,43 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QWIDGETSFUNCTIONS_WCE_H
-#define QWIDGETSFUNCTIONS_WCE_H
-#include <QtCore/qglobal.h>
-#ifdef Q_OS_WINCE
-#include <QtCore/qfunctions_wince.h>
+#ifndef QSSLDIFFIEHELLMANPARAMETERS_P_H
+#define QSSLDIFFIEHELLMANPARAMETERS_P_H
+
+#include "qsslkey.h"
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qssldiffiehellmanparameters.cpp. This header file may change from version to version
+// without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QSharedData>
+
+#include "qssldiffiehellmanparameters.h"
+#include "qsslsocket_p.h" // includes wincrypt.h
-#ifdef QT_BUILD_GUI_LIB
QT_BEGIN_NAMESPACE
-QT_END_NAMESPACE
-#endif
+class QSslDiffieHellmanParametersPrivate : public QSharedData
+{
+public:
+ QSslDiffieHellmanParametersPrivate() : error(QSslDiffieHellmanParameters::NoError) {};
+
+ void decodeDer(const QByteArray &der);
+ void decodePem(const QByteArray &pem);
-//WinCe 7 has shell support
-#ifndef ShellExecute
-HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd);
-#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f)
-#endif
+ QSslDiffieHellmanParameters::Error error;
+ QByteArray derData;
+};
+
+QT_END_NAMESPACE
-#endif // Q_OS_WINCE
-#endif // QWIDGETSFUNCTIONS_WCE_H
+#endif // QSSLDIFFIEHELLMANPARAMETERS_P_H
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 472db3aa81..580b0fbdde 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -836,15 +836,7 @@ bool QSslSocket::atEnd() const
// Note! docs copied from QAbstractSocket::flush()
bool QSslSocket::flush()
{
- Q_D(QSslSocket);
-#ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << "QSslSocket::flush()";
-#endif
- if (d->mode != UnencryptedMode)
- // encrypt any unencrypted bytes in our buffer
- d->transmit();
-
- return d->plainSocket ? d->plainSocket->flush() : false;
+ return d_func()->flush();
}
/*!
@@ -923,6 +915,8 @@ void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration)
d->configuration.privateKey = configuration.privateKey();
d->configuration.ciphers = configuration.ciphers();
d->configuration.ellipticCurves = configuration.ellipticCurves();
+ d->configuration.preSharedKeyIdentityHint = configuration.preSharedKeyIdentityHint();
+ d->configuration.dhParams = configuration.diffieHellmanParameters();
d->configuration.caCertificates = configuration.caCertificates();
d->configuration.peerVerifyDepth = configuration.peerVerifyDepth();
d->configuration.peerVerifyMode = configuration.peerVerifyMode();
@@ -2615,6 +2609,22 @@ QByteArray QSslSocketPrivate::peek(qint64 maxSize)
/*!
\internal
*/
+bool QSslSocketPrivate::flush()
+{
+#ifdef QSSLSOCKET_DEBUG
+ qCDebug(lcSsl) << "QSslSocketPrivate::flush()";
+#endif
+ if (mode != QSslSocket::UnencryptedMode) {
+ // encrypt any unencrypted bytes in our buffer
+ transmit();
+ }
+
+ return plainSocket && plainSocket->flush();
+}
+
+/*!
+ \internal
+*/
bool QSslSocketPrivate::rootCertOnDemandLoadingSupported()
{
return s_loadRootCertsOnDemand;
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index c069ff2f9d..1f2ed7687b 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -116,7 +116,7 @@ public:
bool canReadLine() const Q_DECL_OVERRIDE;
void close() Q_DECL_OVERRIDE;
bool atEnd() const Q_DECL_OVERRIDE;
- bool flush();
+ bool flush(); // ### Qt6: remove me (implementation moved to private flush())
void abort();
// From QAbstractSocket:
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index c164342166..194acbeacc 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -68,57 +68,18 @@ QT_BEGIN_NAMESPACE
static SSLContextRef qt_createSecureTransportContext(QSslSocket::SslMode mode)
{
const bool isServer = mode == QSslSocket::SslServerMode;
- SSLContextRef context = Q_NULLPTR;
-
-#ifndef Q_OS_OSX
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
- context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
+ SSLContextRef context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
if (!context)
qCWarning(lcSsl) << "SSLCreateContext failed";
-#else // Q_OS_OSX
-
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
- // We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
- context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
- if (!context)
- qCWarning(lcSsl) << "SSLCreateContext failed";
- } else {
-#else
- {
-#endif
- const OSStatus errCode = SSLNewContext(isServer, &context);
- if (errCode != noErr || !context)
- qCWarning(lcSsl) << "SSLNewContext failed with error:" << errCode;
- }
-#endif // !Q_OS_OSX
-
return context;
}
static void qt_releaseSecureTransportContext(SSLContextRef context)
{
- if (!context)
- return;
-
-#ifndef Q_OS_OSX
- CFRelease(context);
-#else
-
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
+ if (context)
CFRelease(context);
- } else {
-#else
- {
-#endif // QT_MAC_PLATFORM_...
- const OSStatus errCode = SSLDisposeContext(context);
- if (errCode != noErr)
- qCWarning(lcSsl) << "SSLDisposeContext failed with error:" << errCode;
- }
-#endif // !Q_OS_OSX
}
static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfigurationPrivate &configuration,
@@ -132,7 +93,6 @@ static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfiguration
OSStatus err = noErr;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_5_0)
if (configuration.protocol == QSsl::SslV3) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
@@ -210,117 +170,10 @@ static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfiguration
#endif
return false;
}
-#endif
return err == noErr;
}
-#ifdef Q_OS_OSX
-
-static bool qt_setSessionProtocolOSX(SSLContextRef context, const QSslConfigurationPrivate &configuration,
- QTcpSocket *plainSocket)
-{
- // This function works with (now) deprecated API that does not even exist on
- // iOS but is the only API we have on OS X below 10.8
-
- // Without SSLSetProtocolVersionMin/Max functions it's quite difficult
- // to have the required result:
- // If we use SSLSetProtocolVersion - any constant except the ones with 'Only' suffix -
- // allows a negotiation and we can not set the lower limit.
- // SSLSetProtocolVersionEnabled supports only a limited subset of constants, if you believe their docs:
- // kSSLProtocol2
- // kSSLProtocol3
- // kTLSProtocol1
- // kSSLProtocolAll
- // Here we can only have a look into the SecureTransport's code and hope that what we see there
- // and what we have on 10.7 is similar:
- // SSLSetProtocoLVersionEnabled actually accepts other constants also,
- // called twice with two different protocols it sets a range,
- // called once with a protocol (when all protocols were disabled)
- // - only this protocol is enabled (without a lower limit negotiation).
-
- Q_ASSERT(context);
-
-#ifndef QSSLSOCKET_DEBUG
- Q_UNUSED(plainSocket)
-#endif
-
- OSStatus err = noErr;
-
- // First, disable ALL:
- if (SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, false) != noErr)
- return false;
-
- if (configuration.protocol == QSsl::SslV3) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
- #endif
- err = SSLSetProtocolVersion(context, kSSLProtocol3Only);
- } else if (configuration.protocol == QSsl::TlsV1_0) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0";
- #endif
- err = SSLSetProtocolVersion(context, kTLSProtocol1Only);
- } else if (configuration.protocol == QSsl::TlsV1_1) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true);
- } else if (configuration.protocol == QSsl::TlsV1_2) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
- } else if (configuration.protocol == QSsl::AnyProtocol) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : any";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, true);
- } else if (configuration.protocol == QSsl::TlsV1SslV3) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
- if (err == noErr)
- err = SSLSetProtocolVersionEnabled(context, kSSLProtocol3, true);
- } else if (configuration.protocol == QSsl::SecureProtocols) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
- if (err == noErr)
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true);
- } else if (configuration.protocol == QSsl::TlsV1_0OrLater) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
- if (err == noErr)
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true);
- } else if (configuration.protocol == QSsl::TlsV1_1OrLater) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
- if (err == noErr)
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true);
- } else if (configuration.protocol == QSsl::TlsV1_2OrLater) {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
- #endif
- err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
- } else {
- #ifdef QSSLSOCKET_DEBUG
- qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration";
- #endif
- return false;
- }
-
- return err == noErr;
-}
-
-#endif // Q_OS_OSX
-
QSecureTransportContext::QSecureTransportContext(SSLContextRef c)
: context(c)
{
@@ -351,7 +204,7 @@ bool QSslSocketPrivate::s_loadedCiphersAndCerts = false;
bool QSslSocketPrivate::s_loadRootCertsOnDemand = false;
-#ifndef Q_OS_IOS // dhparam is not used on iOS. (see the SSLSetDiffieHellmanParams call below)
+#if !defined(QT_PLATFORM_UIKIT) // dhparam is not used on iOS or tvOS. (see the SSLSetDiffieHellmanParams call below)
static const uint8_t dhparam[] =
"\x30\x82\x01\x08\x02\x82\x01\x01\x00\x97\xea\xd0\x46\xf7\xae\xa7\x76\x80"
"\x9c\x74\x56\x98\xd8\x56\x97\x2b\x20\x6c\x77\xe2\x82\xbb\xc8\x84\xbe\xe7"
@@ -370,8 +223,8 @@ static const uint8_t dhparam[] =
"\x90\x0b\x35\x64\xff\xd9\xe3\xac\xf2\xf2\xeb\x3a\x63\x02\x01\x02";
#endif
-// No ioErr on iOS. (defined in MacErrors.h on OS X)
-#ifdef Q_OS_IOS
+// No ioErr on iOS/tvOS. (defined in MacErrors.h on OS X)
+#if defined(QT_PLATFORM_UIKIT)
# define ioErr -36
#endif
@@ -959,21 +812,6 @@ bool QSslSocketBackendPrivate::initSslContext()
return false;
}
-#ifdef Q_OS_OSX
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_8) {
- // Starting from OS X 10.8 SSLSetSessionOption with kSSLSessionOptionBreakOnServerAuth/
- // kSSLSessionOptionBreakOnClientAuth disables automatic certificate validation.
- // But for OS X versions below 10.8 we have to do it explicitly:
- const OSStatus err = SSLSetEnableCertVerify(context, false);
- if (err != noErr) {
- destroySslContext();
- setErrorAndEmit(QSslSocket::SslInternalError,
- QStringLiteral("SSLSetEnableCertVerify failed: %1").arg(err));
- return false;
- }
- }
-#endif
-
if (mode == QSslSocket::SslClientMode) {
// enable Server Name Indication (SNI)
QString tlsHostName(verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName);
@@ -1011,7 +849,7 @@ bool QSslSocketBackendPrivate::initSslContext()
return false;
}
}
-#ifndef Q_OS_IOS
+#if !defined(QT_PLATFORM_UIKIT)
// No SSLSetDiffieHellmanParams on iOS; calling it is optional according to docs.
SSLSetDiffieHellmanParams(context, dhparam, sizeof(dhparam));
#endif
@@ -1128,20 +966,7 @@ bool QSslSocketBackendPrivate::setSessionProtocol()
return false;
}
-#ifndef Q_OS_OSX
return qt_setSessionProtocol(context, configuration, plainSocket);
-#else
-
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- return qt_setSessionProtocol(context, configuration, plainSocket);
- } else {
-#else
- {
-#endif
- return qt_setSessionProtocolOSX(context, configuration, plainSocket);
- }
-#endif
}
bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index c7b4875134..35d7654730 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -201,6 +201,15 @@ static unsigned int q_ssl_psk_client_callback(SSL *ssl,
Q_ASSERT(d);
return d->tlsPskClientCallback(hint, identity, max_identity_len, psk, max_psk_len);
}
+
+static unsigned int q_ssl_psk_server_callback(SSL *ssl,
+ const char *identity,
+ unsigned char *psk, unsigned int max_psk_len)
+{
+ QSslSocketBackendPrivate *d = reinterpret_cast<QSslSocketBackendPrivate *>(q_SSL_get_ex_data(ssl, QSslSocketBackendPrivate::s_indexForSSLExtraData));
+ Q_ASSERT(d);
+ return d->tlsPskServerCallback(identity, psk, max_psk_len);
+}
#endif
} // extern "C"
@@ -436,8 +445,12 @@ bool QSslSocketBackendPrivate::initSslContext()
#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
// Set the client callback for PSK
- if (q_SSLeay() >= 0x10001000L && mode == QSslSocket::SslClientMode)
- q_SSL_set_psk_client_callback(ssl, &q_ssl_psk_client_callback);
+ if (q_SSLeay() >= 0x10001000L) {
+ if (mode == QSslSocket::SslClientMode)
+ q_SSL_set_psk_client_callback(ssl, &q_ssl_psk_client_callback);
+ else if (mode == QSslSocket::SslServerMode)
+ q_SSL_set_psk_server_callback(ssl, &q_ssl_psk_server_callback);
+ }
#endif
return true;
@@ -522,15 +535,9 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
#if defined(Q_OS_WIN)
HINSTANCE hLib = LoadLibraryW(L"Crypt32");
if (hLib) {
-#if defined(Q_OS_WINCE)
- ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, L"CertOpenStore");
- ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, L"CertFindCertificateInStore");
- ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, L"CertCloseStore");
-#else
ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW");
ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore");
ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore");
-#endif
if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore)
qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen
} else {
@@ -691,15 +698,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
#if defined(Q_OS_WIN)
if (ptrCertOpenSystemStoreW && ptrCertFindCertificateInStore && ptrCertCloseStore) {
HCERTSTORE hSystemStore;
-#if defined(Q_OS_WINCE)
- hSystemStore = ptrCertOpenSystemStoreW(CERT_STORE_PROV_SYSTEM_W,
- 0,
- 0,
- CERT_STORE_NO_CRYPT_RELEASE_FLAG|CERT_SYSTEM_STORE_CURRENT_USER,
- L"ROOT");
-#else
hSystemStore = ptrCertOpenSystemStoreW(0, L"ROOT");
-#endif
if(hSystemStore) {
PCCERT_CONTEXT pc = NULL;
while(1) {
@@ -1273,6 +1272,31 @@ unsigned int QSslSocketBackendPrivate::tlsPskClientCallback(const char *hint,
return pskLength;
}
+unsigned int QSslSocketBackendPrivate::tlsPskServerCallback(const char *identity,
+ unsigned char *psk, unsigned int max_psk_len)
+{
+ QSslPreSharedKeyAuthenticator authenticator;
+
+ // Fill in some read-only fields (for the user)
+ authenticator.d->identityHint = configuration.preSharedKeyIdentityHint;
+ authenticator.d->identity = identity;
+ authenticator.d->maximumIdentityLength = 0; // user cannot set an identity
+ authenticator.d->maximumPreSharedKeyLength = int(max_psk_len);
+
+ // Let the client provide the remaining bits...
+ Q_Q(QSslSocket);
+ emit q->preSharedKeyAuthenticationRequired(&authenticator);
+
+ // No PSK set? Return now to make the handshake fail
+ if (authenticator.preSharedKey().isEmpty())
+ return 0;
+
+ // Copy data back into OpenSSL
+ const int pskLength = qMin(authenticator.preSharedKey().length(), authenticator.maximumPreSharedKeyLength());
+ ::memcpy(psk, authenticator.preSharedKey().constData(), pskLength);
+ return pskLength;
+}
+
#ifdef Q_OS_WIN
void QSslSocketBackendPrivate::fetchCaRootForCert(const QSslCertificate &cert)
@@ -1574,7 +1598,22 @@ void QSslSocketBackendPrivate::continueHandshake()
} else {
const unsigned char *proto = 0;
unsigned int proto_len = 0;
- q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len);
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+ if (q_SSLeay() >= 0x10002000L) {
+ q_SSL_get0_alpn_selected(ssl, &proto, &proto_len);
+ if (proto_len && mode == QSslSocket::SslClientMode) {
+ // Client does not have a callback that sets it ...
+ configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated;
+ }
+ }
+
+ if (!proto_len) { // Test if NPN was more lucky ...
+#else
+ {
+#endif
+ q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len);
+ }
+
if (proto_len)
configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast<const char *>(proto), proto_len);
else
diff --git a/src/network/ssl/qsslsocket_openssl_android.cpp b/src/network/ssl/qsslsocket_openssl_android.cpp
index d73ed8995e..b5d2458d56 100644
--- a/src/network/ssl/qsslsocket_openssl_android.cpp
+++ b/src/network/ssl/qsslsocket_openssl_android.cpp
@@ -70,6 +70,7 @@ QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData()
QJNIEnvironmentPrivate env;
jobjectArray jcertificates = static_cast<jobjectArray>(certificates.object());
const jint nCertificates = env->GetArrayLength(jcertificates);
+ certificateData.reserve(static_cast<int>(nCertificates));
for (int i = 0; i < nCertificates; ++i) {
jbyteArray jCert = static_cast<jbyteArray>(env->GetObjectArrayElement(jcertificates, i));
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index 0674c05d71..c6572315f0 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -143,6 +143,7 @@ public:
bool checkSslErrors();
void storePeerCertificates();
unsigned int tlsPskClientCallback(const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len);
+ unsigned int tlsPskServerCallback(const char *identity, unsigned char *psk, unsigned int max_psk_len);
#ifdef Q_OS_WIN
void fetchCaRootForCert(const QSslCertificate &cert);
void _q_caRootLoaded(QSslCertificate,QSslCertificate) Q_DECL_OVERRIDE;
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index d420f78dc7..0f9241e470 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -151,6 +151,10 @@ DEFINEFUNC3(int, BIO_read, BIO *a, a, void *b, b, int c, c, return -1, return)
DEFINEFUNC(BIO_METHOD *, BIO_s_mem, void, DUMMYARG, return 0, return)
DEFINEFUNC3(int, BIO_write, BIO *a, a, const void *b, b, int c, c, return -1, return)
DEFINEFUNC(int, BN_num_bits, const BIGNUM *a, a, return 0, return)
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+DEFINEFUNC2(int, BN_is_word, BIGNUM *a, a, BN_ULONG w, w, return 0, return)
+#endif
+DEFINEFUNC2(BN_ULONG, BN_mod_word, const BIGNUM *a, a, BN_ULONG w, w, return -1, return)
#ifndef OPENSSL_NO_EC
DEFINEFUNC(const EC_GROUP*, EC_KEY_get0_group, const EC_KEY* k, k, return 0, return)
DEFINEFUNC(int, EC_GROUP_get_degree, const EC_GROUP* g, g, return 0, return)
@@ -207,6 +211,7 @@ DEFINEFUNC4(RSA *, PEM_read_bio_RSAPrivateKey, BIO *a, a, RSA **b, b, pem_passwo
#ifndef OPENSSL_NO_EC
DEFINEFUNC4(EC_KEY *, PEM_read_bio_ECPrivateKey, BIO *a, a, EC_KEY **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
#endif
+DEFINEFUNC4(DH *, PEM_read_bio_DHparams, BIO *a, a, DH **b, b, pem_password_cb *c, c, void *d, d, return 0, return)
DEFINEFUNC7(int, PEM_write_bio_DSAPrivateKey, BIO *a, a, DSA *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return)
DEFINEFUNC7(int, PEM_write_bio_RSAPrivateKey, BIO *a, a, RSA *b, b, const EVP_CIPHER *c, c, unsigned char *d, d, int e, e, pem_password_cb *f, f, void *g, g, return 0, return)
#ifndef OPENSSL_NO_EC
@@ -300,6 +305,8 @@ DEFINEFUNC2(void *, SSL_get_ex_data, const SSL *ssl, ssl, int idx, idx, return N
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
DEFINEFUNC2(void, SSL_set_psk_client_callback, SSL* ssl, ssl, q_psk_client_callback_t callback, callback, return, DUMMYARG)
+DEFINEFUNC2(void, SSL_set_psk_server_callback, SSL* ssl, ssl, q_psk_server_callback_t callback, callback, return, DUMMYARG)
+DEFINEFUNC2(int, SSL_CTX_use_psk_identity_hint, SSL_CTX* ctx, ctx, const char *hint, hint, return 0, return)
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#ifndef OPENSSL_NO_SSL2
@@ -418,10 +425,24 @@ DEFINEFUNC3(void, SSL_CTX_set_next_proto_select_cb, SSL_CTX *s, s,
void *arg, arg, return, DUMMYARG)
DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s,
const unsigned char **data, data, unsigned *len, len, return, DUMMYARG)
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+DEFINEFUNC3(int, SSL_set_alpn_protos, SSL *s, s, const unsigned char *protos, protos,
+ unsigned protos_len, protos_len, return -1, return)
+DEFINEFUNC3(void, SSL_CTX_set_alpn_select_cb, SSL_CTX *s, s,
+ int (*cb) (SSL *ssl, const unsigned char **out,
+ unsigned char *outlen,
+ const unsigned char *in,
+ unsigned int inlen, void *arg), cb,
+ void *arg, arg, return, DUMMYARG)
+DEFINEFUNC3(void, SSL_get0_alpn_selected, const SSL *s, s, const unsigned char **data, data,
+ unsigned *len, len, return, DUMMYARG)
+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L ...
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return 0, return)
DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG)
DEFINEFUNC3(DH *, d2i_DHparams, DH**a, a, const unsigned char **pp, pp, long length, length, return 0, return)
+DEFINEFUNC2(int, i2d_DHparams, DH *a, a, unsigned char **p, p, return -1, return)
+DEFINEFUNC2(int, DH_check, DH *dh, dh, int *codes, codes, return 0, return)
DEFINEFUNC3(BIGNUM *, BN_bin2bn, const unsigned char *s, s, int len, len, BIGNUM *ret, ret, return 0, return)
#ifndef OPENSSL_NO_EC
DEFINEFUNC(EC_KEY *, EC_KEY_dup, const EC_KEY *ec, ec, return 0, return)
@@ -768,6 +789,10 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(EC_GROUP_get_degree)
#endif
RESOLVEFUNC(BN_num_bits)
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ RESOLVEFUNC(BN_is_word)
+#endif
+ RESOLVEFUNC(BN_mod_word)
RESOLVEFUNC(CRYPTO_free)
RESOLVEFUNC(CRYPTO_num_locks)
RESOLVEFUNC(CRYPTO_set_id_callback)
@@ -816,6 +841,7 @@ bool q_resolveOpenSslSymbols()
#ifndef OPENSSL_NO_EC
RESOLVEFUNC(PEM_read_bio_ECPrivateKey)
#endif
+ RESOLVEFUNC(PEM_read_bio_DHparams)
RESOLVEFUNC(PEM_write_bio_DSAPrivateKey)
RESOLVEFUNC(PEM_write_bio_RSAPrivateKey)
#ifndef OPENSSL_NO_EC
@@ -889,6 +915,8 @@ bool q_resolveOpenSslSymbols()
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10001000L && !defined(OPENSSL_NO_PSK)
RESOLVEFUNC(SSL_set_psk_client_callback)
+ RESOLVEFUNC(SSL_set_psk_server_callback)
+ RESOLVEFUNC(SSL_CTX_use_psk_identity_hint)
#endif
RESOLVEFUNC(SSL_write)
#ifndef OPENSSL_NO_SSL2
@@ -975,6 +1003,8 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(DH_new)
RESOLVEFUNC(DH_free)
RESOLVEFUNC(d2i_DHparams)
+ RESOLVEFUNC(i2d_DHparams)
+ RESOLVEFUNC(DH_check)
RESOLVEFUNC(BN_bin2bn)
#ifndef OPENSSL_NO_EC
RESOLVEFUNC(EC_KEY_dup)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index 36e041b6cb..c0ddb8e888 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -227,6 +227,21 @@ int q_BIO_read(BIO *a, void *b, int c);
BIO_METHOD *q_BIO_s_mem();
int q_BIO_write(BIO *a, const void *b, int c);
int q_BN_num_bits(const BIGNUM *a);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+int q_BN_is_word(BIGNUM *a, BN_ULONG w);
+#else
+// BN_is_word is implemented purely as a
+// macro in OpenSSL < 1.1. It doesn't
+// call any functions.
+//
+// The implementation of BN_is_word is
+// 100% the same between 1.0.0, 1.0.1
+// and 1.0.2.
+//
+// Users are required to include <openssl/bn.h>.
+#define q_BN_is_word BN_is_word
+#endif // OPENSSL_VERSION_NUMBER >= 0x10100000L
+BN_ULONG q_BN_mod_word(const BIGNUM *a, BN_ULONG w);
#ifndef OPENSSL_NO_EC
const EC_GROUP* q_EC_KEY_get0_group(const EC_KEY* k);
int q_EC_GROUP_get_degree(const EC_GROUP* g);
@@ -284,6 +299,7 @@ RSA *q_PEM_read_bio_RSAPrivateKey(BIO *a, RSA **b, pem_password_cb *c, void *d);
#ifndef OPENSSL_NO_EC
EC_KEY *q_PEM_read_bio_ECPrivateKey(BIO *a, EC_KEY **b, pem_password_cb *c, void *d);
#endif
+DH *q_PEM_read_bio_DHparams(BIO *a, DH **b, pem_password_cb *c, void *d);
int q_PEM_write_bio_DSAPrivateKey(BIO *a, DSA *b, const EVP_CIPHER *c, unsigned char *d,
int e, pem_password_cb *f, void *g);
int q_PEM_write_bio_RSAPrivateKey(BIO *a, RSA *b, const EVP_CIPHER *c, unsigned char *d,
@@ -376,6 +392,9 @@ void *q_SSL_get_ex_data(const SSL *ssl, int idx);
#ifndef OPENSSL_NO_PSK
typedef unsigned int (*q_psk_client_callback_t)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len);
void q_SSL_set_psk_client_callback(SSL *ssl, q_psk_client_callback_t callback);
+typedef unsigned int (*q_psk_server_callback_t)(SSL *ssl, const char *identity, unsigned char *psk, unsigned int max_psk_len);
+void q_SSL_set_psk_server_callback(SSL *ssl, q_psk_server_callback_t callback);
+int q_SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
#endif // OPENSSL_NO_PSK
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#ifndef OPENSSL_NO_SSL2
@@ -472,6 +491,8 @@ STACK_OF(X509) *q_X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
DH *q_DH_new();
void q_DH_free(DH *dh);
DH *q_d2i_DHparams(DH **a, const unsigned char **pp, long length);
+int q_i2d_DHparams(DH *a, unsigned char **p);
+int q_DH_check(DH *dh, int *codes);
BIGNUM *q_BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
#define q_SSL_CTX_set_tmp_dh(ctx, dh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_DH, 0, (char *)dh)
@@ -518,6 +539,9 @@ DSA *q_d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length);
#define q_PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \
PEM_ASN1_write_bio((int (*)(void*, unsigned char**))q_i2d_DSAPrivateKey,PEM_STRING_DSA,\
bp,(char *)x,enc,kstr,klen,cb,u)
+#define q_PEM_read_bio_DHparams(bp, dh, cb, u) \
+ (DH *)q_PEM_ASN1_read_bio( \
+ (void *(*)(void**, const unsigned char**, long int))q_d2i_DHparams, PEM_STRING_DHPARAMS, bp, (void **)x, cb, u)
#endif
#define q_SSL_CTX_set_options(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)
#define q_SSL_CTX_set_mode(ctx,op) q_SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
@@ -558,6 +582,19 @@ void q_SSL_CTX_set_next_proto_select_cb(SSL_CTX *s,
void *arg);
void q_SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,
unsigned *len);
+#if OPENSSL_VERSION_NUMBER >= 0x10002000L
+int q_SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,
+ unsigned protos_len);
+void q_SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,
+ int (*cb) (SSL *ssl,
+ const unsigned char **out,
+ unsigned char *outlen,
+ const unsigned char *in,
+ unsigned int inlen,
+ void *arg), void *arg);
+void q_SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,
+ unsigned *len);
+#endif
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
// Helper function
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index 5d4d52cd6d..e791b9d166 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -89,11 +89,7 @@ QT_BEGIN_NAMESPACE
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
-#if defined(Q_OS_WINCE)
- typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*);
-#else
typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(HCRYPTPROV_LEGACY, LPCWSTR);
-#endif
typedef PCCERT_CONTEXT (WINAPI *PtrCertFindCertificateInStore)(HCERTSTORE, DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT);
typedef BOOL (WINAPI *PtrCertCloseStore)(HCERTSTORE, DWORD);
#endif // Q_OS_WIN && !Q_OS_WINRT
@@ -193,6 +189,7 @@ public:
virtual qint64 peek(char *data, qint64 maxSize) Q_DECL_OVERRIDE;
virtual QByteArray peek(qint64 maxSize) Q_DECL_OVERRIDE;
+ bool flush() Q_DECL_OVERRIDE;
// Platform specific functions
virtual void startClientEncryption() = 0;
diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp
index edc8ca0bbb..f5dc9fcdcd 100644
--- a/src/network/ssl/qsslsocket_winrt.cpp
+++ b/src/network/ssl/qsslsocket_winrt.cpp
@@ -215,7 +215,9 @@ QList<QSslCipher> QSslSocketBackendPrivate::defaultCiphers()
const QString protocolStrings[] = { QStringLiteral("SSLv3"), QStringLiteral("TLSv1"),
QStringLiteral("TLSv1.1"), QStringLiteral("TLSv1.2") };
const QSsl::SslProtocol protocols[] = { QSsl::SslV3, QSsl::TlsV1_0, QSsl::TlsV1_1, QSsl::TlsV1_2 };
- for (int i = 0; i < ARRAYSIZE(protocols); ++i) {
+ const int size = static_cast<int>(ARRAYSIZE(protocols));
+ ciphers.reserve(size);
+ for (int i = 0; i < size; ++i) {
QSslCipher cipher;
cipher.d->isNull = false;
cipher.d->name = QStringLiteral("WINRT");
diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
index c70664ef9b..edbbeadf51 100644
--- a/src/network/ssl/ssl.pri
+++ b/src/network/ssl/ssl.pri
@@ -1,5 +1,5 @@
# OpenSSL support; compile in QSslSocket.
-contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
+contains(QT_CONFIG, ssl) {
HEADERS += ssl/qasn1element_p.h \
ssl/qssl.h \
ssl/qssl_p.h \
@@ -9,6 +9,8 @@ contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, op
ssl/qsslconfiguration_p.h \
ssl/qsslcipher.h \
ssl/qsslcipher_p.h \
+ ssl/qssldiffiehellmanparameters.h \
+ ssl/qssldiffiehellmanparameters_p.h \
ssl/qsslellipticcurve.h \
ssl/qsslerror.h \
ssl/qsslkey.h \
@@ -24,6 +26,7 @@ contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, op
ssl/qsslcertificate.cpp \
ssl/qsslconfiguration.cpp \
ssl/qsslcipher.cpp \
+ ssl/qssldiffiehellmanparameters.cpp \
ssl/qsslellipticcurve.cpp \
ssl/qsslkey_p.cpp \
ssl/qsslerror.cpp \
@@ -35,6 +38,7 @@ contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, op
HEADERS += ssl/qsslsocket_winrt_p.h
SOURCES += ssl/qsslcertificate_qt.cpp \
ssl/qsslcertificate_winrt.cpp \
+ ssl/qssldiffiehellmanparameters_dummy.cpp \
ssl/qsslkey_qt.cpp \
ssl/qsslkey_winrt.cpp \
ssl/qsslsocket_winrt.cpp \
@@ -44,43 +48,45 @@ contains(QT_CONFIG, ssl) | contains(QT_CONFIG, openssl) | contains(QT_CONFIG, op
contains(QT_CONFIG, securetransport) {
HEADERS += ssl/qsslsocket_mac_p.h
SOURCES += ssl/qsslcertificate_qt.cpp \
+ ssl/qssldiffiehellmanparameters_dummy.cpp \
ssl/qsslkey_qt.cpp \
ssl/qsslkey_mac.cpp \
ssl/qsslsocket_mac_shared.cpp \
ssl/qsslsocket_mac.cpp \
ssl/qsslellipticcurve_dummy.cpp
}
-}
-contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
- HEADERS += ssl/qsslcontext_openssl_p.h \
- ssl/qsslsocket_openssl_p.h \
- ssl/qsslsocket_openssl_symbols_p.h
- SOURCES += ssl/qsslcertificate_openssl.cpp \
- ssl/qsslcontext_openssl.cpp \
- ssl/qsslellipticcurve_openssl.cpp \
- ssl/qsslkey_openssl.cpp \
- ssl/qsslsocket_openssl.cpp \
- ssl/qsslsocket_openssl_symbols.cpp
+ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked) {
+ HEADERS += ssl/qsslcontext_openssl_p.h \
+ ssl/qsslsocket_openssl_p.h \
+ ssl/qsslsocket_openssl_symbols_p.h
+ SOURCES += ssl/qsslcertificate_openssl.cpp \
+ ssl/qsslcontext_openssl.cpp \
+ ssl/qssldiffiehellmanparameters_openssl.cpp \
+ ssl/qsslellipticcurve_openssl.cpp \
+ ssl/qsslkey_openssl.cpp \
+ ssl/qsslsocket_openssl.cpp \
+ ssl/qsslsocket_openssl_symbols.cpp
- darwin:SOURCES += ssl/qsslsocket_mac_shared.cpp
+ darwin:SOURCES += ssl/qsslsocket_mac_shared.cpp
- android: SOURCES += ssl/qsslsocket_openssl_android.cpp
+ android: SOURCES += ssl/qsslsocket_openssl_android.cpp
- # Add optional SSL libs
- # Static linking of OpenSSL with msvc:
- # - Binaries http://slproweb.com/products/Win32OpenSSL.html
- # - also needs -lUser32 -lAdvapi32 -lGdi32 -lCrypt32
- # - libs in <OPENSSL_DIR>\lib\VC\static
- # - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
+ # Add optional SSL libs
+ # Static linking of OpenSSL with msvc:
+ # - Binaries http://slproweb.com/products/Win32OpenSSL.html
+ # - also needs -lUser32 -lAdvapi32 -lGdi32 -lCrypt32
+ # - libs in <OPENSSL_DIR>\lib\VC\static
+ # - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
- CONFIG(debug, debug|release) {
- LIBS_PRIVATE += $$OPENSSL_LIBS_DEBUG
- } else {
- LIBS_PRIVATE += $$OPENSSL_LIBS_RELEASE
- }
+ CONFIG(debug, debug|release) {
+ LIBS_PRIVATE += $$OPENSSL_LIBS_DEBUG
+ } else {
+ LIBS_PRIVATE += $$OPENSSL_LIBS_RELEASE
+ }
- QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS
- LIBS_PRIVATE += $$OPENSSL_LIBS
- win32: LIBS_PRIVATE += -lcrypt32
+ QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS
+ LIBS_PRIVATE += $$OPENSSL_LIBS
+ win32: LIBS_PRIVATE += -lcrypt32
+ }
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 868e9ed265..6365a7421b 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1006,11 +1006,11 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data,
glStencilMask(0xff); // Enable stencil writes
if (dirtyStencilRegion.intersects(currentScissorBounds)) {
- QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects();
+ const QRegion clearRegion = dirtyStencilRegion.intersected(currentScissorBounds);
glClearStencil(0); // Clear to zero
- for (int i = 0; i < clearRegion.size(); ++i) {
+ for (const QRect &rect : clearRegion) {
#ifndef QT_GL_NO_SCISSOR_TEST
- setScissor(clearRegion.at(i));
+ setScissor(rect);
#endif
glClear(GL_STENCIL_BUFFER_BIT);
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index fed1779388..f249984893 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1918,7 +1918,8 @@ void QGLTextureCache::insert(QGLContext* ctx, qint64 key, QGLTexture* texture, i
{
QWriteLocker locker(&m_lock);
const QGLTextureCacheKey cacheKey = {key, QGLContextPrivate::contextGroup(ctx)};
- m_cache.insert(cacheKey, texture, cost);
+ const bool inserted = m_cache.insert(cacheKey, texture, cost);
+ Q_UNUSED(inserted) Q_ASSERT(inserted);
}
void QGLTextureCache::remove(qint64 key)
diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm
index a18510a9e2..28cde1264d 100644
--- a/src/platformsupport/cglconvenience/cglconvenience.mm
+++ b/src/platformsupport/cglconvenience/cglconvenience.mm
@@ -78,22 +78,15 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format)
if (format.swapBehavior() != QSurfaceFormat::SingleBuffer)
attrs.append(NSOpenGLPFADoubleBuffer);
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
- if (format.profile() == QSurfaceFormat::CoreProfile
- && ((format.majorVersion() == 3 && format.minorVersion() >= 2)
- || format.majorVersion() > 3)) {
- attrs << NSOpenGLPFAOpenGLProfile;
- attrs << NSOpenGLProfileVersion3_2Core;
- } else {
- attrs << NSOpenGLPFAOpenGLProfile;
- attrs << NSOpenGLProfileVersionLegacy;
- }
+ if (format.profile() == QSurfaceFormat::CoreProfile
+ && ((format.majorVersion() == 3 && format.minorVersion() >= 2)
+ || format.majorVersion() > 3)) {
+ attrs << NSOpenGLPFAOpenGLProfile;
+ attrs << NSOpenGLProfileVersion3_2Core;
+ } else {
+ attrs << NSOpenGLPFAOpenGLProfile;
+ attrs << NSOpenGLProfileVersionLegacy;
}
-#else
- if (format.profile() == QSurfaceFormat::CoreProfile)
- qWarning("Mac OSX >= 10.7 is needed for OpenGL Core Profile support");
-#endif
if (format.depthBufferSize() > 0)
attrs << NSOpenGLPFADepthSize << format.depthBufferSize();
diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm
index 68a367cce3..02d1295b0f 100644
--- a/src/platformsupport/clipboard/qmacmime.mm
+++ b/src/platformsupport/clipboard/qmacmime.mm
@@ -43,7 +43,7 @@
#import <AppKit/AppKit.h>
#endif
-#if defined(Q_OS_IOS)
+#if defined(QT_PLATFORM_UIKIT)
#import <UIKit/UIKit.h>
#endif
@@ -522,11 +522,6 @@ QString QMacPasteboardMimeRtfText::mimeFor(QString flav)
bool QMacPasteboardMimeRtfText::canConvert(const QString &mime, QString flav)
{
-#if defined(Q_OS_IOS)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_7_0)
- return false;
-#endif
-
return mime == mimeFor(flav);
}
diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri
index a0b37cae1a..6a4689eb19 100644
--- a/src/platformsupport/eventdispatchers/eventdispatchers.pri
+++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri
@@ -17,6 +17,6 @@ HEADERS +=\
contains(QT_CONFIG, glib) {
SOURCES +=$$PWD/qeventdispatcher_glib.cpp
HEADERS +=$$PWD/qeventdispatcher_glib_p.h
- QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB
- LIBS_PRIVATE += $$QT_LIBS_GLIB
+ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GLIB
+ LIBS_PRIVATE += $$QMAKE_LIBS_GLIB
}
diff --git a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp
index 7d49c35d84..de369e0b00 100644
--- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp
+++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher.cpp
@@ -151,11 +151,10 @@ messageDebugEntries[] = {
{WM_IME_ENDCOMPOSITION, "WM_IME_ENDCOMPOSITION", true},
{WM_IME_NOTIFY, "WM_IME_NOTIFY", true},
{WM_IME_REQUEST, "WM_IME_REQUEST", true},
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
{WM_QUERYENDSESSION, "WM_QUERYENDSESSION", true},
{WM_ENDSESSION, "WM_ENDSESSION", true},
#endif
-#ifndef Q_OS_WINCE
{WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true},
{WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true},
{WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true},
@@ -181,7 +180,6 @@ messageDebugEntries[] = {
{WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true},
{WM_DISPLAYCHANGE, "WM_DISPLAYCHANGE", true},
{WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true},
-#endif // !Q_OS_WINCE
{WM_THEMECHANGED, "WM_THEMECHANGED", true}
};
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
index fa1b8d0acd..2cad3441e4 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp
+++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
@@ -81,6 +81,12 @@ const QImage QFbBackingStore::image()
return mImage;
}
+
+QImage QFbBackingStore::toImage() const
+{
+ return mImage;
+}
+
void QFbBackingStore::lock()
{
mImageMutex.lock();
@@ -110,4 +116,3 @@ void QFbBackingStore::endPaint()
}
QT_END_NAMESPACE
-
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
index fc06b95475..c8dfe3489c 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h
+++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
@@ -72,6 +72,7 @@ public:
void resize(const QSize &size, const QRegion &region) Q_DECL_OVERRIDE;
const QImage image();
+ QImage toImage() const override;
void lock();
void unlock();
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index 4066743cc2..01de2a59b2 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -206,15 +206,13 @@ void QFbScreen::generateRects()
remainingScreen -= localGeometry;
QRegion windowRegion(localGeometry);
windowRegion -= remainingScreen;
- foreach (const QRect &rect, windowRegion.rects()) {
+ for (const QRect &rect : windowRegion)
mCachedRects += QPair<QRect, int>(rect, i);
- }
}
#endif
}
- const QVector<QRect> remainingScreenRects = remainingScreen.rects();
- mCachedRects.reserve(mCachedRects.count() + remainingScreenRects.count());
- foreach (const QRect &rect, remainingScreenRects)
+ mCachedRects.reserve(mCachedRects.count() + remainingScreen.rectCount());
+ for (const QRect &rect : remainingScreen)
mCachedRects += QPair<QRect, int>(rect, -1);
mIsUpToDate = true;
}
@@ -254,7 +252,7 @@ QRegion QFbScreen::doRedraw()
rectRegion -= intersect;
// we only expect one rectangle, but defensive coding...
- foreach (const QRect &rect, intersect.rects()) {
+ for (const QRect &rect : intersect) {
bool firstLayer = true;
if (layer == -1) {
mCompositePainter->setCompositionMode(QPainter::CompositionMode_Source);
diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index d70b3b6a1a..52cf771b2a 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -8,6 +8,4 @@ SOURCES += \
$$PWD/qbasicfontdatabase.cpp \
$$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp
-CONFIG += opentype
-
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri
index ebb64d15b4..272e7591ba 100644
--- a/src/platformsupport/fontdatabases/mac/coretext.pri
+++ b/src/platformsupport/fontdatabases/mac/coretext.pri
@@ -5,11 +5,10 @@ contains(QT_CONFIG, freetype) {
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
HEADERS += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h
SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp
- CONFIG += opentype
}
-ios: \
- # On iOS CoreText and CoreGraphics are stand-alone frameworks
+uikit: \
+ # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 533e0e2d5b..d81a68d6e5 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -44,7 +44,7 @@
#if defined(Q_OS_OSX)
#import <AppKit/AppKit.h>
#import <IOKit/graphics/IOGraphicsLib.h>
-#elif defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
#import <UIKit/UIFont.h>
#endif
@@ -191,7 +191,7 @@ static CFArrayRef availableFamilyNames()
{
#if defined(Q_OS_OSX)
return CTFontManagerCopyAvailableFontFamilyNames();
-#elif defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
return (CFArrayRef) [[UIFont familyNames] retain];
#endif
}
@@ -517,46 +517,37 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
static QHash<QString, QStringList> fallbackLists;
if (!family.isEmpty()) {
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_6_0)
- // CTFontCopyDefaultCascadeListForLanguages is available in the SDK
- #if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_8, __IPHONE_6_0)
- // But we have to feature check at runtime
- if (&CTFontCopyDefaultCascadeListForLanguages)
- #endif
- {
- QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family));
- if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) {
- if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) {
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
-
- QCFType<CFArrayRef> cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages);
- if (cascadeList) {
- QStringList fallbackList;
- const int numCascades = CFArrayGetCount(cascadeList);
- for (int i = 0; i < numCascades; ++i) {
- CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
- QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
- fallbackList.append(QCFString::toQString(fallbackFamilyName));
- }
+ QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family));
+ if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) {
+ if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) {
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
+
+ QCFType<CFArrayRef> cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages);
+ if (cascadeList) {
+ QStringList fallbackList;
+ const int numCascades = CFArrayGetCount(cascadeList);
+ for (int i = 0; i < numCascades; ++i) {
+ CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
+ QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
+ fallbackList.append(QCFString::toQString(fallbackFamilyName));
+ }
#if defined(Q_OS_OSX)
- // Since we are only returning a list of default fonts for the current language, we do not
- // cover all unicode completely. This was especially an issue for some of the common script
- // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
- // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
- // of Unicode 2.1.
- if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
- fallbackList.append(QStringLiteral("Arial Unicode MS"));
+ // Since we are only returning a list of default fonts for the current language, we do not
+ // cover all unicode completely. This was especially an issue for some of the common script
+ // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
+ // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
+ // of Unicode 2.1.
+ if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
+ fallbackList.append(QStringLiteral("Arial Unicode MS"));
#endif
- return fallbackList;
- }
+ return fallbackList;
}
}
}
-#endif
}
// We were not able to find a fallback for the specific family,
@@ -620,7 +611,6 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
return fallbackLists[styleLookupKey.arg(styleHint)];
}
-#if HAVE_CORETEXT
static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName = QString())
{
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
@@ -638,7 +628,7 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi
// QUrl::fromLocalFile() doesn't accept qrc pseudo-paths like ":/fonts/myfont.ttf".
// Therefore construct from QString with the qrc:// scheme -> "qrc:///fonts/myfont.ttf".
fontURL = QUrl(QStringLiteral("qrc://") + fileName.mid(1)).toCFURL();
- } else if (!fileName.isEmpty()) {
+ } else {
// At this point we hope that filename is in a format that QUrl can handle.
fontURL = QUrl::fromLocalFile(fileName).toCFURL();
}
@@ -653,104 +643,41 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi
CFArrayAppendValue(array, descriptor);
return array;
}
-#endif
QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
QCFType<CFArrayRef> fonts;
QStringList families;
-#if HAVE_CORETEXT
- if (&CTFontManagerRegisterGraphicsFont) {
- CFErrorRef error = 0;
- if (!fontData.isEmpty()) {
- QByteArray* fontDataCopy = new QByteArray(fontData);
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
- fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
- QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
- if (cgFont) {
- if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
- QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
- fonts = createDescriptorArrayForFont(font
+ CFErrorRef error = 0;
+ if (!fontData.isEmpty()) {
+ QByteArray* fontDataCopy = new QByteArray(fontData);
+ QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
+ fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
+ QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
+ if (cgFont) {
+ if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
+ QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
+ fonts = createDescriptorArrayForFont(font
#ifndef QT_NO_FREETYPE
- , m_useFreeType ? fileName : QString()
-#endif
- );
- m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
- }
- }
- } else {
- QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
- if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_6, __IPHONE_7_0)
- if (&CTFontManagerCreateFontDescriptorsFromURL)
- fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
- else
+ , m_useFreeType ? fileName : QString()
#endif
- {
- // We're limited to a single font per file, unless we dive into the font tables
- QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 1,
- &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributes, kCTFontURLAttribute, fontURL);
- QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithAttributes(attributes);
- QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, 0.0, NULL);
- fonts = createDescriptorArrayForFont(font);
- }
-
- m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
+ );
+ m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
}
}
-
- if (error) {
- NSLog(@"Unable to register font: %@", error);
- CFRelease(error);
+ } else {
+ QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
+ if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
+ fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
+ m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
}
}
-#endif
-#if HAVE_CORETEXT && HAVE_ATS
- else
-#endif
-#if HAVE_ATS
- {
- ATSFontContainerRef fontContainer;
- OSStatus e;
-
- if (!fontData.isEmpty()) {
- e = ATSFontActivateFromMemory((void *) fontData.constData(), fontData.size(),
- kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
- kATSOptionFlagsDefault, &fontContainer);
- } else {
- FSRef ref;
- if (FSPathMakeRef(reinterpret_cast<const UInt8 *>(fileName.toUtf8().constData()),
- &ref, 0) != noErr)
- return QStringList();
- e = ATSFontActivateFromFileReference(&ref, kATSFontContextLocal, kATSFontFormatUnspecified, 0,
- kATSOptionFlagsDefault, &fontContainer);
- }
-
- if (e == noErr) {
- ItemCount fontCount = 0;
- e = ATSFontFindFromContainer(fontContainer, kATSOptionFlagsDefault, 0, 0, &fontCount);
- if (e != noErr)
- return QStringList();
-
- QVarLengthArray<ATSFontRef> containedFonts(fontCount);
- e = ATSFontFindFromContainer(fontContainer, kATSOptionFlagsDefault, fontCount, containedFonts.data(), &fontCount);
- if (e != noErr)
- return QStringList();
-
- CFMutableArrayRef fontsArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < containedFonts.size(); ++i) {
- QCFType<CTFontRef> font = CTFontCreateWithPlatformFont(containedFonts[i], 12.0, NULL, NULL);
- CFArrayAppendValue(fontsArray, QCFType<CTFontDescriptorRef>(CTFontCopyFontDescriptor(font)));
- }
- fonts = fontsArray;
-
- m_applicationFonts.append(QVariant::fromValue(fontContainer));
- }
+ if (error) {
+ NSLog(@"Unable to register font: %@", error);
+ CFRelease(error);
}
-#endif
if (fonts) {
const int numFonts = CFArrayGetCount(fonts);
@@ -847,41 +774,39 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f)
static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
{
-#ifdef Q_OS_IOS
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) {
- // Use Dynamic Type to resolve theme fonts if possible, to get
- // correct font sizes and style based on user configuration.
- NSString *textStyle = 0;
- switch (f) {
- case QPlatformTheme::TitleBarFont:
- case QPlatformTheme::HeaderViewFont:
- textStyle = UIFontTextStyleHeadline;
- break;
- case QPlatformTheme::MdiSubWindowTitleFont:
- textStyle = UIFontTextStyleSubheadline;
- break;
- case QPlatformTheme::TipLabelFont:
- case QPlatformTheme::SmallFont:
- textStyle = UIFontTextStyleFootnote;
- break;
- case QPlatformTheme::MiniFont:
- textStyle = UIFontTextStyleCaption2;
- break;
- case QPlatformTheme::FixedFont:
- // Fall back to regular code path, as iOS doesn't provide
- // an appropriate text style for this theme font.
- break;
- default:
- textStyle = UIFontTextStyleBody;
- break;
- }
+#if defined(QT_PLATFORM_UIKIT)
+ // Use Dynamic Type to resolve theme fonts if possible, to get
+ // correct font sizes and style based on user configuration.
+ NSString *textStyle = 0;
+ switch (f) {
+ case QPlatformTheme::TitleBarFont:
+ case QPlatformTheme::HeaderViewFont:
+ textStyle = UIFontTextStyleHeadline;
+ break;
+ case QPlatformTheme::MdiSubWindowTitleFont:
+ textStyle = UIFontTextStyleSubheadline;
+ break;
+ case QPlatformTheme::TipLabelFont:
+ case QPlatformTheme::SmallFont:
+ textStyle = UIFontTextStyleFootnote;
+ break;
+ case QPlatformTheme::MiniFont:
+ textStyle = UIFontTextStyleCaption2;
+ break;
+ case QPlatformTheme::FixedFont:
+ // Fall back to regular code path, as iOS doesn't provide
+ // an appropriate text style for this theme font.
+ break;
+ default:
+ textStyle = UIFontTextStyleBody;
+ break;
+ }
- if (textStyle) {
- UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
- return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
- }
+ if (textStyle) {
+ UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
+ return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
}
-#endif // Q_OS_IOS
+#endif // Q_OS_IOS, Q_OS_TVOS
// OSX default case and iOS fallback case
CTFontUIFontType fontType = fontTypeFromTheme(f);
@@ -948,31 +873,15 @@ void QCoreTextFontDatabase::removeApplicationFonts()
return;
foreach (const QVariant &font, m_applicationFonts) {
-#if HAVE_CORETEXT
- if (&CTFontManagerUnregisterGraphicsFont && &CTFontManagerUnregisterFontsForURL) {
- CFErrorRef error;
- if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
- CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
- } else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
- CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
- }
+ CFErrorRef error;
+ if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
+ CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
+ } else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
+ CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
}
-#endif
-#if HAVE_CORETEXT && HAVE_ATS
- else
-#endif
-#if HAVE_ATS
- if (font.canConvert(qMetaTypeId<ATSFontContainerRef>())) {
- ATSFontDeactivate(font.value<ATSFontContainerRef>(), 0, kATSOptionFlagsDoNotNotify);
- }
-#endif
}
m_applicationFonts.clear();
-
-#if HAVE_ATS
- ATSFontNotify(kATSFontNotifyActionFontsChanged, 0);
-#endif
}
#ifndef QT_NO_FREETYPE
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 2cc6b09a15..1bc3522bda 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -52,27 +52,20 @@
//
#include <qglobal.h>
-#define HAVE_CORETEXT QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_4_1)
-#define HAVE_ATS QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_5, __IPHONE_NA)
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformtheme.h>
#include <private/qcore_mac_p.h>
-#ifndef Q_OS_IOS
+#ifdef Q_OS_OSX
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>
#include <CoreGraphics/CoreGraphics.h>
#endif
-#if HAVE_CORETEXT
Q_DECLARE_METATYPE(QCFType<CGFontRef>);
Q_DECLARE_METATYPE(QCFType<CFURLRef>);
-#endif
-#if HAVE_ATS
-Q_DECLARE_METATYPE(ATSFontContainerRef);
-#endif
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 942bb6c6bb..971f0b0cce 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -224,7 +224,7 @@ void QCoreTextFontEngine::init()
synthesisFlags = 0;
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont);
-#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait))
glyphFormat = QFontEngine::Format_ARGB;
else
@@ -258,6 +258,9 @@ void QCoreTextFontEngine::init()
} else
avgCharWidth = QFontEngine::averageCharWidth();
+ underlineThickness = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont));
+ underlinePos = -QFixed::fromReal(CTFontGetUnderlinePosition(ctfont));
+
cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000;
// HACK hb_coretext requires both CTFont and CGFont but user_data is only void*
@@ -608,7 +611,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
if (!im.width() || !im.height())
return im;
-#ifndef Q_OS_IOS
+#ifdef Q_OS_OSX
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
#else
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
@@ -657,7 +660,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
}
}
-#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
else if (supportsColorGlyphs()) {
// CGContextSetTextMatrix does not work with color glyphs, so we use
// the CTM instead. This means we must translate the CTM as well, to
@@ -805,6 +808,16 @@ bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) co
return false;
}
+QFixed QCoreTextFontEngine::lineThickness() const
+{
+ return underlineThickness;
+}
+
+QFixed QCoreTextFontEngine::underlinePosition() const
+{
+ return underlinePos;
+}
+
QFontEngine::Properties QCoreTextFontEngine::properties() const
{
Properties result;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 67a5a3185b..27289239c6 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -54,7 +54,7 @@
#include <private/qfontengine_p.h>
#include <private/qcore_mac_p.h>
-#ifndef Q_OS_IOS
+#ifdef Q_OS_OSX
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>
@@ -92,6 +92,9 @@ public:
int synthesized() const Q_DECL_OVERRIDE { return synthesisFlags; }
bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; }
+ QFixed lineThickness() const Q_DECL_OVERRIDE;
+ QFixed underlinePosition() const Q_DECL_OVERRIDE;
+
void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight);
FaceId faceId() const Q_DECL_OVERRIDE;
@@ -115,7 +118,7 @@ public:
static bool supportsColorGlyphs()
{
-#if defined(Q_OS_IOS)
+#if defined(QT_PLATFORM_UIKIT)
return true;
#elif MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
@@ -141,6 +144,8 @@ private:
int synthesisFlags;
CGAffineTransform transform;
QFixed avgCharWidth;
+ QFixed underlineThickness;
+ QFixed underlinePos;
QFontEngine::FaceId face_id;
mutable bool kerningPairsLoaded;
};
diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp
index 3b1a87b8cd..58e811dff1 100644
--- a/src/platformsupport/graphics/qrasterbackingstore.cpp
+++ b/src/platformsupport/graphics/qrasterbackingstore.cpp
@@ -89,7 +89,7 @@ bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
const qreal devicePixelRatio = m_image.devicePixelRatio();
const QPoint delta(dx * devicePixelRatio, dy * devicePixelRatio);
- foreach (const QRect &rect, region.rects())
+ for (const QRect &rect : region)
qt_scrollRectInImage(m_image, QRect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio), delta);
return true;
@@ -103,7 +103,7 @@ void QRasterBackingStore::beginPaint(const QRegion &region)
QPainter painter(&m_image);
painter.setCompositionMode(QPainter::CompositionMode_Source);
const QColor blank = Qt::transparent;
- foreach (const QRect &rect, region.rects())
+ for (const QRect &rect : region)
painter.fillRect(rect, blank);
}
diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
index 7c29be7804..dbaaf524e8 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
+++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
@@ -140,7 +140,7 @@ void QOpenGLCompositorBackingStore::updateTexture()
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (!ctx->isOpenGLES() || ctx->format().majorVersion() >= 3) {
- foreach (const QRect &rect, m_dirty.rects()) {
+ for (const QRect &rect : m_dirty) {
QRect r = imageRect & rect;
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_image.width());
glTexSubImage2D(GL_TEXTURE_2D, 0, r.x(), r.y(), r.width(), r.height(), GL_RGBA, GL_UNSIGNED_BYTE,
@@ -148,7 +148,7 @@ void QOpenGLCompositorBackingStore::updateTexture()
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
} else {
- foreach (const QRect &rect, m_dirty.rects()) {
+ for (const QRect &rect : m_dirty) {
// intersect with image rect to be sure
QRect r = imageRect & rect;
@@ -161,7 +161,7 @@ void QOpenGLCompositorBackingStore::updateTexture()
fixed |= r;
}
- foreach (const QRect &rect, fixed.rects()) {
+ for (const QRect &rect : fixed) {
// if the sub-rect is full-width we can pass the image data directly to
// OpenGL instead of copying, since there's no gap between scanlines
if (rect.width() == imageRect.width()) {
@@ -258,7 +258,7 @@ void QOpenGLCompositorBackingStore::beginPaint(const QRegion &region)
if (m_image.hasAlphaChannel()) {
QPainter p(&m_image);
p.setCompositionMode(QPainter::CompositionMode_Source);
- foreach (const QRect &r, region.rects())
+ for (const QRect &r : region)
p.fillRect(r, Qt::transparent);
}
}
diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro
index 60be964b74..9f6f3380e1 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -29,6 +29,6 @@ include(platformcompositor/platformcompositor.pri)
include(dbusmenu/dbusmenu.pri)
include(dbustray/dbustray.pri)
}
-ios: include(graphics/graphics.pri)
+uikit: include(graphics/graphics.pri)
load(qt_module)
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index cc590cc545..8028e65147 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -7,7 +7,7 @@ TEMPLATE = subdirs
#win32:SUBDIRS += nla
win32:SUBDIRS += generic
-win32:!wince:!winrt: SUBDIRS += nativewifi
+win32:!winrt: SUBDIRS += nativewifi
mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
mac:SUBDIRS += generic
android:SUBDIRS += android
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index aa0fc6b945..02ea7abf88 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -50,17 +50,10 @@
#include <QtCore/qdebug.h>
#include <QtCore/private/qcoreapplication_p.h>
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN32)
#include "../platformdefs_win.h"
#endif
-#ifdef Q_OS_WINCE
-typedef ULONG NDIS_OID, *PNDIS_OID;
-# ifndef QT_NO_WINCE_NUIOUSER
-# include <nuiouser.h>
-# endif
-#endif // Q_OS_WINCE
-
#ifdef Q_OS_WINRT
#include <qfunctions_winrt.h>
@@ -92,36 +85,22 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_NETWORKINTERFACE
static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
{
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN32)
DWORD bytesWritten;
NDIS_MEDIUM medium;
NDIS_PHYSICAL_MEDIUM physicalMedium;
-#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER)
- NDISUIO_QUERY_OID nicGetOid;
- HANDLE handle = CreateFile((PTCHAR)NDISUIO_DEVICE_NAME, 0,
- FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
-#else
unsigned long oid;
HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0,
FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
-#endif
if (handle == INVALID_HANDLE_VALUE)
return QNetworkConfiguration::BearerUnknown;
bytesWritten = 0;
-#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER)
- ZeroMemory(&nicGetOid, sizeof(NDISUIO_QUERY_OID));
- nicGetOid.Oid = OID_GEN_MEDIA_SUPPORTED;
- nicGetOid.ptcDeviceName = (PTCHAR)interface.utf16();
- bool result = DeviceIoControl(handle, IOCTL_NDISUIO_QUERY_OID_VALUE, &nicGetOid, sizeof(nicGetOid),
- &nicGetOid, sizeof(nicGetOid), &bytesWritten, 0);
-#else
oid = OID_GEN_MEDIA_SUPPORTED;
bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
&medium, sizeof(medium), &bytesWritten, 0);
-#endif
if (!result) {
CloseHandle(handle);
return QNetworkConfiguration::BearerUnknown;
@@ -129,22 +108,9 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf
bytesWritten = 0;
-#if defined(Q_OS_WINCE) && !defined(QT_NO_WINCE_NUIOUSER)
- medium = NDIS_MEDIUM( *(LPDWORD)nicGetOid.Data );
-
- ZeroMemory(&nicGetOid, sizeof(NDISUIO_QUERY_OID));
- nicGetOid.Oid = OID_GEN_PHYSICAL_MEDIUM;
- nicGetOid.ptcDeviceName = (PTCHAR)interface.utf16();
-
- result = DeviceIoControl(handle, IOCTL_NDISUIO_QUERY_OID_VALUE, &nicGetOid, sizeof(nicGetOid),
- &nicGetOid, sizeof(nicGetOid), &bytesWritten, 0);
-
- physicalMedium = NDIS_PHYSICAL_MEDIUM( *(LPDWORD)nicGetOid.Data );
-#else
oid = OID_GEN_PHYSICAL_MEDIUM;
result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
&physicalMedium, sizeof(physicalMedium), &bytesWritten, 0);
-#endif
if (!result) {
CloseHandle(handle);
diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro
index 32ff5446e5..113d0667d2 100644
--- a/src/plugins/bearer/nla/nla.pro
+++ b/src/plugins/bearer/nla/nla.pro
@@ -2,11 +2,7 @@ TARGET = qnlabearer
QT = core core-private network network-private
-!wince* {
- LIBS += -lws2_32
-} else {
- LIBS += -lws2
-}
+LIBS += -lws2_32
HEADERS += qnlaengine.h \
../platformdefs_win.h \
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index 6026e06b55..86decd312b 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -43,10 +43,12 @@
#include <QWindow>
#include <QGuiApplication>
#include <QTouchDevice>
+#include <qmath.h>
#include <qpa/qwindowsysteminterface.h>
#include "qtuiocursor_p.h"
+#include "qtuiotoken_p.h"
#include "qtuiohandler_p.h"
#include "qoscbundle_p.h"
@@ -55,6 +57,12 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcTuioSource, "qt.qpa.tuio.source")
Q_LOGGING_CATEGORY(lcTuioSet, "qt.qpa.tuio.set")
+// With TUIO the first application takes exclusive ownership of the "device"
+// we cannot attach more than one application to the same port anyway.
+// Forcing delivery makes it easy to use simulators in the same machine
+// and forget about headaches about unfocused TUIO windows.
+static bool forceDelivery = qEnvironmentVariableIsSet("QT_TUIOTOUCH_DELIVER_WITHOUT_FOCUS");
+
QTuioHandler::QTuioHandler(const QString &specification)
: m_device(new QTouchDevice) // not leaked, QTouchDevice cleans up registered devices itself
{
@@ -157,29 +165,49 @@ void QTuioHandler::processPackets()
messages.push_back(msg);
}
- foreach (const QOscMessage &message, messages) {
- if (message.addressPattern() != "/tuio/2Dcur") {
- qWarning() << "Ignoring unknown address pattern " << message.addressPattern();
- continue;
- }
-
- QList<QVariant> arguments = message.arguments();
- if (arguments.count() == 0) {
- qWarning("Ignoring TUIO message with no arguments");
- continue;
- }
-
- QByteArray messageType = arguments.at(0).toByteArray();
- if (messageType == "source") {
- process2DCurSource(message);
- } else if (messageType == "alive") {
- process2DCurAlive(message);
- } else if (messageType == "set") {
- process2DCurSet(message);
- } else if (messageType == "fseq") {
- process2DCurFseq(message);
+ for (const QOscMessage &message : messages) {
+ if (message.addressPattern() == "/tuio/2Dcur") {
+ QList<QVariant> arguments = message.arguments();
+ if (arguments.count() == 0) {
+ qWarning("Ignoring TUIO message with no arguments");
+ continue;
+ }
+
+ QByteArray messageType = arguments.at(0).toByteArray();
+ if (messageType == "source") {
+ process2DCurSource(message);
+ } else if (messageType == "alive") {
+ process2DCurAlive(message);
+ } else if (messageType == "set") {
+ process2DCurSet(message);
+ } else if (messageType == "fseq") {
+ process2DCurFseq(message);
+ } else {
+ qWarning() << "Ignoring unknown TUIO message type: " << messageType;
+ continue;
+ }
+ } else if (message.addressPattern() == "/tuio/2Dobj") {
+ QList<QVariant> arguments = message.arguments();
+ if (arguments.count() == 0) {
+ qWarning("Ignoring TUIO message with no arguments");
+ continue;
+ }
+
+ QByteArray messageType = arguments.at(0).toByteArray();
+ if (messageType == "source") {
+ process2DObjSource(message);
+ } else if (messageType == "alive") {
+ process2DObjAlive(message);
+ } else if (messageType == "set") {
+ process2DObjSet(message);
+ } else if (messageType == "fseq") {
+ process2DObjFseq(message);
+ } else {
+ qWarning() << "Ignoring unknown TUIO message type: " << messageType;
+ continue;
+ }
} else {
- qWarning() << "Ignoring unknown TUIO message type: " << messageType;
+ qWarning() << "Ignoring unknown address pattern " << message.addressPattern();
continue;
}
}
@@ -328,11 +356,6 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message)
Q_UNUSED(message); // TODO: do we need to do anything with the frame id?
QWindow *win = QGuiApplication::focusWindow();
- // With TUIO the first application takes exclusive ownership of the "device"
- // we cannot attach more than one application to the same port anyway.
- // Forcing delivery makes it easy to use simulators in the same machine
- // and forget about headaches about unfocused TUIO windows.
- static bool forceDelivery = qEnvironmentVariableIsSet("QT_TUIOTOUCH_DELIVER_WITHOUT_FOCUS");
if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery)
win = QGuiApplication::topLevelWindows().at(0);
@@ -342,12 +365,12 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message)
QList<QWindowSystemInterface::TouchPoint> tpl;
tpl.reserve(m_activeCursors.size() + m_deadCursors.size());
- foreach (const QTuioCursor &tc, m_activeCursors) {
+ for (const QTuioCursor &tc : m_activeCursors) {
QWindowSystemInterface::TouchPoint tp = cursorToTouchPoint(tc, win);
tpl.append(tp);
}
- foreach (const QTuioCursor &tc, m_deadCursors) {
+ for (const QTuioCursor &tc : m_deadCursors) {
QWindowSystemInterface::TouchPoint tp = cursorToTouchPoint(tc, win);
tp.state = Qt::TouchPointReleased;
tpl.append(tp);
@@ -357,5 +380,181 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message)
m_deadCursors.clear();
}
+void QTuioHandler::process2DObjSource(const QOscMessage &message)
+{
+ QList<QVariant> arguments = message.arguments();
+ if (arguments.count() != 2) {
+ qWarning() << "Ignoring malformed TUIO source message: " << arguments.count();
+ return;
+ }
+
+ if (QMetaType::Type(arguments.at(1).type()) != QMetaType::QByteArray) {
+ qWarning("Ignoring malformed TUIO source message (bad argument type)");
+ return;
+ }
+
+ qCDebug(lcTuioSource) << "Got TUIO source message from: " << arguments.at(1).toByteArray();
+}
+
+void QTuioHandler::process2DObjAlive(const QOscMessage &message)
+{
+ QList<QVariant> arguments = message.arguments();
+
+ // delta the notified tokens that are active, against the ones we already
+ // know of.
+ //
+ // TBD: right now we're assuming one 2DObj alive message corresponds to a
+ // new data source from the input. is this correct, or do we need to store
+ // changes and only process the deltas on fseq?
+ QMap<int, QTuioToken> oldActiveTokens = m_activeTokens;
+ QMap<int, QTuioToken> newActiveTokens;
+
+ for (int i = 1; i < arguments.count(); ++i) {
+ if (QMetaType::Type(arguments.at(i).type()) != QMetaType::Int) {
+ qWarning() << "Ignoring malformed TUIO alive message (bad argument on position" << i << arguments << ')';
+ return;
+ }
+
+ int sessionId = arguments.at(i).toInt();
+ if (!oldActiveTokens.contains(sessionId)) {
+ // newly active
+ QTuioToken token(sessionId);
+ token.setState(Qt::TouchPointPressed);
+ newActiveTokens.insert(sessionId, token);
+ } else {
+ // we already know about it, remove it so it isn't marked as released
+ QTuioToken token = oldActiveTokens.value(sessionId);
+ token.setState(Qt::TouchPointStationary); // position change in SET will update if needed
+ newActiveTokens.insert(sessionId, token);
+ oldActiveTokens.remove(sessionId);
+ }
+ }
+
+ // anything left is dead now
+ QMap<int, QTuioToken>::ConstIterator it = oldActiveTokens.constBegin();
+
+ // deadTokens should be cleared from the last FSEQ now
+ m_deadTokens.reserve(oldActiveTokens.size());
+
+ // TODO: there could be an issue of resource exhaustion here if FSEQ isn't
+ // sent in a timely fashion. we should probably track message counts and
+ // force-flush if we get too many built up.
+ while (it != oldActiveTokens.constEnd()) {
+ m_deadTokens.append(it.value());
+ ++it;
+ }
+
+ m_activeTokens = newActiveTokens;
+}
+
+void QTuioHandler::process2DObjSet(const QOscMessage &message)
+{
+ QList<QVariant> arguments = message.arguments();
+ if (arguments.count() < 7) {
+ qWarning() << "Ignoring malformed TUIO set message with too few arguments: " << arguments.count();
+ return;
+ }
+
+ if (QMetaType::Type(arguments.at(1).type()) != QMetaType::Int ||
+ QMetaType::Type(arguments.at(2).type()) != QMetaType::Int ||
+ QMetaType::Type(arguments.at(3).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(4).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(5).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(6).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(7).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(8).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(9).type()) != QMetaType::Float ||
+ QMetaType::Type(arguments.at(10).type()) != QMetaType::Float) {
+ qWarning() << "Ignoring malformed TUIO set message with bad types: " << arguments;
+ return;
+ }
+
+ int id = arguments.at(1).toInt();
+ int classId = arguments.at(2).toInt();
+ float x = arguments.at(3).toFloat();
+ float y = arguments.at(4).toFloat();
+ float angle = arguments.at(5).toFloat();
+ float vx = arguments.at(6).toFloat();
+ float vy = arguments.at(7).toFloat();
+ float angularVelocity = arguments.at(8).toFloat();
+ float acceleration = arguments.at(9).toFloat();
+ float angularAcceleration = arguments.at(10).toFloat();
+
+ QMap<int, QTuioToken>::Iterator it = m_activeTokens.find(id);
+ if (it == m_activeTokens.end()) {
+ qWarning() << "Ignoring malformed TUIO set for nonexistent token " << classId;
+ return;
+ }
+
+ qCDebug(lcTuioSet) << "Processing SET for token " << classId << id << " @ " << x << y << "∡" << angle <<
+ "vel" << vx << vy << angularVelocity << "acc" << acceleration << angularAcceleration;
+ QTuioToken &tok = *it;
+ tok.setClassId(classId);
+ tok.setX(x);
+ tok.setY(y);
+ tok.setVX(vx);
+ tok.setVY(vy);
+ tok.setAcceleration(acceleration);
+ tok.setAngle(angle);
+ tok.setAngularVelocity(angularAcceleration);
+ tok.setAngularAcceleration(angularAcceleration);
+}
+
+QWindowSystemInterface::TouchPoint QTuioHandler::tokenToTouchPoint(const QTuioToken &tc, QWindow *win)
+{
+ QWindowSystemInterface::TouchPoint tp;
+ tp.id = tc.id();
+ tp.uniqueId = tc.classId(); // TODO TUIO 2.0: populate a QVariant, and register the mapping from int to arbitrary UID data
+ tp.flags = QTouchEvent::TouchPoint::Token;
+ tp.pressure = 1.0f;
+
+ tp.normalPosition = QPointF(tc.x(), tc.y());
+
+ if (!m_transform.isIdentity())
+ tp.normalPosition = m_transform.map(tp.normalPosition);
+
+ tp.state = tc.state();
+ tp.area = QRectF(0, 0, 1, 1);
+
+ // We map the token position to the size of the window.
+ QPointF relPos = QPointF(win->size().width() * tp.normalPosition.x(), win->size().height() * tp.normalPosition.y());
+ QPointF delta = relPos - relPos.toPoint();
+ tp.area.moveCenter(win->mapToGlobal(relPos.toPoint()) + delta);
+ tp.velocity = QVector2D(win->size().width() * tc.vx(), win->size().height() * tc.vy());
+ tp.rotation = tc.angle() * 180.0 / M_PI; // convert radians to degrees
+ return tp;
+}
+
+
+void QTuioHandler::process2DObjFseq(const QOscMessage &message)
+{
+ Q_UNUSED(message); // TODO: do we need to do anything with the frame id?
+
+ QWindow *win = QGuiApplication::focusWindow();
+ if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery)
+ win = QGuiApplication::topLevelWindows().at(0);
+
+ if (!win)
+ return;
+
+ QList<QWindowSystemInterface::TouchPoint> tpl;
+ tpl.reserve(m_activeTokens.size() + m_deadTokens.size());
+
+ for (const QTuioToken & t : m_activeTokens) {
+ QWindowSystemInterface::TouchPoint tp = tokenToTouchPoint(t, win);
+ tpl.append(tp);
+ }
+
+ for (const QTuioToken & t : m_deadTokens) {
+ QWindowSystemInterface::TouchPoint tp = tokenToTouchPoint(t, win);
+ tp.state = Qt::TouchPointReleased;
+ tp.velocity = QVector2D();
+ tpl.append(tp);
+ }
+ QWindowSystemInterface::handleTouchEvent(win, m_device, tpl);
+
+ m_deadTokens.clear();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler_p.h b/src/plugins/generic/tuiotouch/qtuiohandler_p.h
index 3034872aae..2e444f2a0d 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler_p.h
+++ b/src/plugins/generic/tuiotouch/qtuiohandler_p.h
@@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE
class QTouchDevice;
class QOscMessage;
class QTuioCursor;
+class QTuioToken;
class QTuioHandler : public QObject
{
@@ -69,14 +70,21 @@ private slots:
void process2DCurAlive(const QOscMessage &message);
void process2DCurSet(const QOscMessage &message);
void process2DCurFseq(const QOscMessage &message);
+ void process2DObjSource(const QOscMessage &message);
+ void process2DObjAlive(const QOscMessage &message);
+ void process2DObjSet(const QOscMessage &message);
+ void process2DObjFseq(const QOscMessage &message);
private:
QWindowSystemInterface::TouchPoint cursorToTouchPoint(const QTuioCursor &tc, QWindow *win);
+ QWindowSystemInterface::TouchPoint tokenToTouchPoint(const QTuioToken &tc, QWindow *win);
QTouchDevice *m_device;
QUdpSocket m_socket;
QMap<int, QTuioCursor> m_activeCursors;
QVector<QTuioCursor> m_deadCursors;
+ QMap<int, QTuioToken> m_activeTokens;
+ QVector<QTuioToken> m_deadTokens;
QTransform m_transform;
};
diff --git a/src/plugins/generic/tuiotouch/qtuiotoken_p.h b/src/plugins/generic/tuiotouch/qtuiotoken_p.h
new file mode 100644
index 0000000000..5084aeed11
--- /dev/null
+++ b/src/plugins/generic/tuiotouch/qtuiotoken_p.h
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUIOOBJECT_P_H
+#define QTUIOOBJECT_P_H
+
+#include <Qt>
+#include <qmath.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \internal
+
+ A fiducial object, or token, represented by 2Dobj in TUIO 1.x and tok in TUIO 2:
+ a physical object whose position and rotation can be uniquely tracked
+ on the touchscreen surface.
+*/
+class QTuioToken
+{
+public:
+ QTuioToken(int id = -1)
+ : m_id(id)
+ , m_classId(-1)
+ , m_x(0)
+ , m_y(0)
+ , m_vx(0)
+ , m_vy(0)
+ , m_acceleration(0)
+ , m_angle(0)
+ , m_angularVelocity(0)
+ , m_angularAcceleration(0)
+ , m_state(Qt::TouchPointPressed)
+ {
+ }
+
+ int id() const { return m_id; }
+
+ int classId() const { return m_classId; }
+ void setClassId(int classId) { m_classId = classId; }
+
+ void setX(float x)
+ {
+ if (state() == Qt::TouchPointStationary &&
+ !qFuzzyCompare(m_x + 2.0, x + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0
+ setState(Qt::TouchPointMoved);
+ }
+ m_x = x;
+ }
+ float x() const { return m_x; }
+
+ void setY(float y)
+ {
+ if (state() == Qt::TouchPointStationary &&
+ !qFuzzyCompare(m_y + 2.0, y + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0
+ setState(Qt::TouchPointMoved);
+ }
+ m_y = y;
+ }
+ float y() const { return m_y; }
+
+ void setVX(float vx) { m_vx = vx; }
+ float vx() const { return m_vx; }
+
+ void setVY(float vy) { m_vy = vy; }
+ float vy() const { return m_vy; }
+
+ void setAcceleration(float acceleration) { m_acceleration = acceleration; }
+ float acceleration() const { return m_acceleration; }
+
+ float angle() const { return m_angle; }
+ void setAngle(float angle)
+ {
+ if (angle > M_PI)
+ angle = angle - M_PI * 2.0; // zero is pointing upwards, and is the default; but we want to have negative angles when rotating left
+ if (state() == Qt::TouchPointStationary &&
+ !qFuzzyCompare(m_angle + 2.0, angle + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0
+ setState(Qt::TouchPointMoved);
+ }
+ m_angle = angle;
+ }
+
+ float angularVelocity() const { return m_angularVelocity; }
+ void setAngularVelocity(float angularVelocity) { m_angularVelocity = angularVelocity; }
+
+ float angularAcceleration() const { return m_angularAcceleration; }
+ void setAngularAcceleration(float angularAcceleration) { m_angularAcceleration = angularAcceleration; }
+
+ void setState(const Qt::TouchPointState &state) { m_state = state; }
+ Qt::TouchPointState state() const { return m_state; }
+
+private:
+ int m_id; // sessionID, temporary object ID
+ int m_classId; // classID (e.g. marker ID)
+ float m_x;
+ float m_y;
+ float m_vx;
+ float m_vy;
+ float m_acceleration;
+ float m_angle;
+ float m_angularVelocity;
+ float m_angularAcceleration;
+ Qt::TouchPointState m_state;
+};
+
+QT_END_NAMESPACE
+
+#endif // QTUIOOBJECT_P_H
diff --git a/src/plugins/generic/tuiotouch/tuiotouch.pro b/src/plugins/generic/tuiotouch/tuiotouch.pro
index ae2ccde058..ad6a1c6876 100644
--- a/src/plugins/generic/tuiotouch/tuiotouch.pro
+++ b/src/plugins/generic/tuiotouch/tuiotouch.pro
@@ -15,7 +15,8 @@ HEADERS += \
qoscbundle_p.h \
qoscmessage_p.h \
qtuiohandler_p.h \
- qtuiocursor_p.h
+ qtuiocursor_p.h \
+ qtuiotoken_p.h
OTHER_FILES += \
tuiotouch.json
diff --git a/src/plugins/imageformats/gif/gif.pro b/src/plugins/imageformats/gif/gif.pro
index a361bc2532..c2625be85a 100644
--- a/src/plugins/imageformats/gif/gif.pro
+++ b/src/plugins/imageformats/gif/gif.pro
@@ -1,9 +1,8 @@
TARGET = qgif
-include(../../../gui/image/qgifhandler.pri)
-INCLUDEPATH += ../../../gui/image
-SOURCES += $$PWD/main.cpp
-HEADERS += $$PWD/main.h
+SOURCES += main.cpp qgifhandler.cpp
+HEADERS += main.h qgifhandler_p.h
+
OTHER_FILES += gif.json
PLUGIN_TYPE = imageformats
diff --git a/src/gui/image/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 476b456563..476b456563 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
diff --git a/src/gui/image/qgifhandler_p.h b/src/plugins/imageformats/gif/qgifhandler_p.h
index bc3debe83c..bc3debe83c 100644
--- a/src/gui/image/qgifhandler_p.h
+++ b/src/plugins/imageformats/gif/qgifhandler_p.h
diff --git a/src/plugins/imageformats/ico/ico.pro b/src/plugins/imageformats/ico/ico.pro
index 60afdaed70..7ca1f18cb1 100644
--- a/src/plugins/imageformats/ico/ico.pro
+++ b/src/plugins/imageformats/ico/ico.pro
@@ -1,10 +1,7 @@
TARGET = qico
-QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-ico)"
-
-HEADERS += qicohandler.h main.h
-SOURCES += main.cpp \
- qicohandler.cpp
+HEADERS += main.h qicohandler.h
+SOURCES += main.cpp qicohandler.cpp
OTHER_FILES += ico.json
PLUGIN_TYPE = imageformats
diff --git a/src/plugins/imageformats/imageformats.pro b/src/plugins/imageformats/imageformats.pro
index 2b05f2feec..3de77c056d 100644
--- a/src/plugins/imageformats/imageformats.pro
+++ b/src/plugins/imageformats/imageformats.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-!contains(QT_CONFIG, no-jpeg):!contains(QT_CONFIG, jpeg):SUBDIRS += jpeg
-!contains(QT_CONFIG, no-gif):!contains(QT_CONFIG, gif):SUBDIRS += gif
!contains(QT_CONFIG, no-ico):SUBDIRS += ico
+contains(QT_CONFIG, jpeg): SUBDIRS += jpeg
+contains(QT_CONFIG, gif): SUBDIRS += gif
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index 526556179c..9181abb465 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -2,12 +2,18 @@ TARGET = qjpeg
QT += core-private
-QTDIR_build:REQUIRES = "!contains(QT_CONFIG, no-jpeg)"
+SOURCES += main.cpp qjpeghandler.cpp
+HEADERS += main.h qjpeghandler_p.h
+
+contains(QT_CONFIG, system-jpeg) {
+ msvc: \
+ LIBS += libjpeg.lib
+ else: \
+ LIBS += -ljpeg
+} else {
+ include($$PWD/../../../3rdparty/libjpeg.pri)
+}
-include(../../../gui/image/qjpeghandler.pri)
-INCLUDEPATH += ../../../gui/image
-SOURCES += main.cpp
-HEADERS += main.h
OTHER_FILES += jpeg.json
PLUGIN_TYPE = imageformats
diff --git a/src/gui/image/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 52e8b39f11..52e8b39f11 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
diff --git a/src/gui/image/qjpeghandler_p.h b/src/plugins/imageformats/jpeg/qjpeghandler_p.h
index 534ce12115..534ce12115 100644
--- a/src/gui/image/qjpeghandler_p.h
+++ b/src/plugins/imageformats/jpeg/qjpeghandler_p.h
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 200d5789a8..994fe8386b 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -278,7 +278,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint
QList<QInputMethodEvent::Attribute> attributes = t.attributes.imAttributes();
if (!t.text.isEmpty())
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant());
+ attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0);
QInputMethodEvent event(t.text, attributes);
QCoreApplication::sendEvent(input, &event);
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index dc420775cf..125a03469f 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -645,7 +645,7 @@ jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPos
: localPos - text.length() + newCursorPosition;
//move the cursor
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection,
- newLocalPos, 0, QVariant()));
+ newLocalPos, 0));
}
}
m_blockUpdateSelection = updateSelectionWasBlocked;
@@ -691,7 +691,7 @@ jboolean QAndroidInputContext::finishComposingText()
// Moving Qt's cursor to where the preedit cursor used to be
QList<QInputMethodEvent::Attribute> attributes;
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0, QVariant()));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0));
QInputMethodEvent event(QString(), attributes);
event.setCommitString(m_composingText);
@@ -848,8 +848,7 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur
QList<QInputMethodEvent::Attribute> attributes;
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor,
newCursorPosition,
- 1,
- QVariant()));
+ 1));
// Show compose text underlined
QTextCharFormat underlined;
underlined.setFontUnderline(true);
@@ -921,7 +920,7 @@ jboolean QAndroidInputContext::setComposingRegion(jint start, jint end)
QVariant(underlined)));
// Keep the cursor position unchanged (don't move to end of preedit)
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1, QVariant()));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1));
QInputMethodEvent event(m_composingText, attributes);
event.setCommitString(QString(), relativeStart, length);
@@ -955,7 +954,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end)
// preedit cursor
int localOldPos = query->value(Qt::ImCursorPosition).toInt();
int pos = localCursorPos - localOldPos;
- attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1, QVariant()));
+ attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1));
//but we have to tell Qt about the compose text all over again
@@ -970,8 +969,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end)
// actually changing the selection
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection,
localCursorPos,
- end - start,
- QVariant()));
+ end - start));
}
QInputMethodEvent event(m_composingText, attributes);
sendInputMethodEventThreadSafe(&event);
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 80d7e31aa3..e10bd95e12 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -80,6 +80,8 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::Pri
Qt::ApplicationState QAndroidPlatformIntegration::m_defaultApplicationState = Qt::ApplicationActive;
+bool QAndroidPlatformIntegration::m_showPasswordEnabled = false;
+
void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
{
if (resource=="JavaVM")
@@ -191,6 +193,19 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
}
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
}
+
+ auto contentResolver = javaActivity.callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;");
+ Q_ASSERT(contentResolver.isValid());
+ QJNIObjectPrivate txtShowPassValue = QJNIObjectPrivate::callStaticObjectMethod("android/provider/Settings$System",
+ "getString",
+ "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
+ contentResolver.object(),
+ QJNIObjectPrivate::getStaticObjectField("android/provider/Settings$System", "TEXT_SHOW_PASSWORD", "Ljava/lang/String;").object());
+ if (txtShowPassValue.isValid()) {
+ bool ok = false;
+ const int txtShowPass = txtShowPassValue.toString().toInt(&ok);
+ m_showPasswordEnabled = ok ? (txtShowPass == 1) : false;
+ }
}
QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState);
@@ -313,6 +328,9 @@ QPlatformServices *QAndroidPlatformIntegration::services() const
QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const
{
switch (hint) {
+ case PasswordMaskDelay:
+ // this number is from a hard-coded value in Android code (cf. PasswordTransformationMethod)
+ return m_showPasswordEnabled ? 1500 : 0;
case ShowIsMaximized:
return true;
default:
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h
index 1f06c23d0b..bda0bee9ad 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/qandroidplatformintegration.h
@@ -143,6 +143,8 @@ private:
static Qt::ApplicationState m_defaultApplicationState;
+ static bool m_showPasswordEnabled;
+
QPlatformFontDatabase *m_androidFDB;
QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
QAndroidPlatformServices *m_androidPlatformServices;
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index a73550606b..155d6bfb8d 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -379,9 +379,8 @@ void QAndroidPlatformScreen::doRedraw()
}
}
- foreach (const QRect &rect, visibleRegion.rects()) {
+ for (const QRect &rect : visibleRegion)
compositePainter.fillRect(rect, QColor(Qt::transparent));
- }
ret = ANativeWindow_unlockAndPost(m_nativeSurface);
if (ret >= 0)
diff --git a/src/plugins/platforms/bsdfb/bsdfb.json b/src/plugins/platforms/bsdfb/bsdfb.json
new file mode 100644
index 0000000000..97b3e7707e
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/bsdfb.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "bsdfb" ]
+}
diff --git a/src/plugins/platforms/bsdfb/bsdfb.pro b/src/plugins/platforms/bsdfb/bsdfb.pro
new file mode 100644
index 0000000000..c24d8dd9e5
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/bsdfb.pro
@@ -0,0 +1,15 @@
+TARGET = qbsdfb
+
+QT += core-private gui-private platformsupport-private
+
+SOURCES = main.cpp qbsdfbintegration.cpp qbsdfbscreen.cpp
+HEADERS = qbsdfbintegration.h qbsdfbscreen.h
+
+CONFIG += qpa/genericunixfontdatabase
+
+OTHER_FILES += bsdfb.json
+
+PLUGIN_TYPE = platforms
+PLUGIN_CLASS_NAME = QBsdFbIntegrationPlugin
+!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
+load(qt_plugin)
diff --git a/src/plugins/platforms/bsdfb/main.cpp b/src/plugins/platforms/bsdfb/main.cpp
new file mode 100644
index 0000000000..f4ab3dee39
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 <qpa/qplatformintegrationplugin.h>
+#include "qbsdfbintegration.h"
+
+QT_BEGIN_NAMESPACE
+
+class QBsdFbIntegrationPlugin : public QPlatformIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "bsdfb.json")
+public:
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
+};
+
+QPlatformIntegration* QBsdFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
+{
+ Q_UNUSED(paramList);
+ if (!system.compare(QLatin1String("bsdfb"), Qt::CaseInsensitive))
+ return new QBsdFbIntegration(paramList);
+
+ return nullptr;
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
+
diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
new file mode 100644
index 0000000000..edb4f4e660
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 "qbsdfbintegration.h"
+#include "qbsdfbscreen.h"
+
+#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
+#include <QtPlatformSupport/private/qgenericunixservices_p.h>
+#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
+
+#include <QtPlatformSupport/private/qfbvthandler_p.h>
+#include <QtPlatformSupport/private/qfbbackingstore_p.h>
+#include <QtPlatformSupport/private/qfbwindow_p.h>
+#include <QtPlatformSupport/private/qfbcursor_p.h>
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatforminputcontext.h>
+#include <qpa/qplatforminputcontextfactory_p.h>
+
+#if !defined(QT_NO_TSLIB)
+#include <QtPlatformSupport/private/qtslib_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList)
+{
+ m_fontDb.reset(new QGenericUnixFontDatabase);
+ m_services.reset(new QGenericUnixServices);
+ m_primaryScreen.reset(new QBsdFbScreen(paramList));
+}
+
+QBsdFbIntegration::~QBsdFbIntegration()
+{
+ destroyScreen(m_primaryScreen.data());
+}
+
+void QBsdFbIntegration::initialize()
+{
+ if (m_primaryScreen->initialize())
+ screenAdded(m_primaryScreen.data());
+ else
+ qWarning("bsdfb: Failed to initialize screen");
+
+ m_inputContext.reset(QPlatformInputContextFactory::create());
+ m_nativeInterface.reset(new QPlatformNativeInterface);
+ m_vtHandler.reset(new QFbVtHandler);
+
+ if (!qEnvironmentVariableIntValue("QT_QPA_FB_DISABLE_INPUT"))
+ createInputHandlers();
+}
+
+bool QBsdFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps:
+ return true;
+ case WindowManagement:
+ return false;
+ default:
+ return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
+QPlatformBackingStore *QBsdFbIntegration::createPlatformBackingStore(QWindow *window) const
+{
+ return new QFbBackingStore(window);
+}
+
+QPlatformWindow *QBsdFbIntegration::createPlatformWindow(QWindow *window) const
+{
+ return new QFbWindow(window);
+}
+
+QAbstractEventDispatcher *QBsdFbIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
+QList<QPlatformScreen *> QBsdFbIntegration::screens() const
+{
+ QList<QPlatformScreen *> list;
+ list.append(m_primaryScreen.data());
+ return list;
+}
+
+QPlatformFontDatabase *QBsdFbIntegration::fontDatabase() const
+{
+ return m_fontDb.data();
+}
+
+QPlatformServices *QBsdFbIntegration::services() const
+{
+ return m_services.data();
+}
+
+void QBsdFbIntegration::createInputHandlers()
+{
+#ifndef QT_NO_TSLIB
+ const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB");
+ if (useTslib)
+ new QTsLibMouseHandler(QLatin1String("TsLib"), QString());
+#endif
+}
+
+QPlatformNativeInterface *QBsdFbIntegration::nativeInterface() const
+{
+ return m_nativeInterface.data();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.h b/src/plugins/platforms/bsdfb/qbsdfbintegration.h
new file mode 100644
index 0000000000..2be5ea260d
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 QBSDFBINTEGRATION_H
+#define QBSDFBINTEGRATION_H
+
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformnativeinterface.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractEventDispatcher;
+class QBsdFbScreen;
+class QFbVtHandler;
+
+class QBsdFbIntegration : public QPlatformIntegration, public QPlatformNativeInterface
+{
+public:
+ explicit QBsdFbIntegration(const QStringList &paramList);
+ ~QBsdFbIntegration() override;
+
+ void initialize() override;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
+
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
+
+ QAbstractEventDispatcher *createEventDispatcher() const override;
+
+ QPlatformFontDatabase *fontDatabase() const override;
+ QPlatformServices *services() const override;
+ QPlatformInputContext *inputContext() const override { return m_inputContext.data(); }
+
+ QPlatformNativeInterface *nativeInterface() const override;
+
+ QList<QPlatformScreen *> screens() const;
+
+private:
+ void createInputHandlers();
+
+ QScopedPointer<QBsdFbScreen> m_primaryScreen;
+ QScopedPointer<QPlatformInputContext> m_inputContext;
+ QScopedPointer<QPlatformFontDatabase> m_fontDb;
+ QScopedPointer<QPlatformServices> m_services;
+ QScopedPointer<QFbVtHandler> m_vtHandler;
+ QScopedPointer<QPlatformNativeInterface> m_nativeInterface;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBSDFBINTEGRATION_H
diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
new file mode 100644
index 0000000000..ee2dce6867
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
@@ -0,0 +1,276 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 "qbsdfbscreen.h"
+#include <QtPlatformSupport/private/qfbcursor_p.h>
+#include <QtPlatformSupport/private/qfbwindow_p.h>
+#include <QtCore/QRegularExpression>
+#include <QtGui/QPainter>
+
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
+#include <qimage.h>
+#include <qdebug.h>
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <limits.h>
+#include <signal.h>
+
+#include <sys/consio.h>
+#include <sys/fbio.h>
+
+QT_BEGIN_NAMESPACE
+
+enum {
+ DefaultDPI = 100
+};
+
+static int openFramebufferDevice(const QString &dev)
+{
+ const QByteArray devPath = QFile::encodeName(dev);
+
+ int fd = QT_OPEN(devPath.constData(), O_RDWR);
+
+ if (fd == -1)
+ fd = QT_OPEN(devPath.constData(), O_RDONLY);
+
+ return fd;
+}
+
+static QRect determineGeometry(const struct fbtype &fb, const QRect &userGeometry)
+{
+ int xoff = 0;
+ int yoff = 0;
+ int w = 0;
+ int h = 0;
+
+ if (userGeometry.isValid()) {
+ w = qMin(userGeometry.width(), fb.fb_width);
+ h = qMin(userGeometry.height(), fb.fb_height);
+
+ int xxoff = userGeometry.x(), yyoff = userGeometry.y();
+ if (xxoff != 0 || yyoff != 0) {
+ if (xxoff < 0 || xxoff + w > fb.fb_width)
+ xxoff = fb.fb_width - w;
+ if (yyoff < 0 || yyoff + h > fb.fb_height)
+ yyoff = fb.fb_height - h;
+ xoff += xxoff;
+ yoff += yyoff;
+ } else {
+ xoff += (fb.fb_width - w)/2;
+ yoff += (fb.fb_height - h)/2;
+ }
+ } else {
+ w = fb.fb_width;
+ h = fb.fb_height;
+ }
+
+ if (w == 0 || h == 0) {
+ qWarning("Unable to find screen geometry, using 320x240");
+ w = 320;
+ h = 240;
+ }
+
+ return QRect(xoff, yoff, w, h);
+}
+
+static QSizeF determinePhysicalSize(const QSize &mmSize, const QSize &res)
+{
+ int mmWidth = mmSize.width();
+ int mmHeight = mmSize.height();
+
+ if (mmWidth <= 0 && mmHeight <= 0) {
+ const int dpi = DefaultDPI;
+ mmWidth = qRound(res.width() * 25.4 / dpi);
+ mmHeight = qRound(res.height() * 25.4 / dpi);
+ } else if (mmWidth > 0 && mmHeight <= 0) {
+ mmHeight = res.height() * mmWidth/res.width();
+ } else if (mmHeight > 0 && mmWidth <= 0) {
+ mmWidth = res.width() * mmHeight/res.height();
+ }
+
+ return QSize(mmWidth, mmHeight);
+}
+
+QBsdFbScreen::QBsdFbScreen(const QStringList &args)
+ : m_arguments(args)
+{
+}
+
+QBsdFbScreen::~QBsdFbScreen()
+{
+ if (m_framebufferFd != -1) {
+ munmap(m_mmap.data - m_mmap.offset, m_mmap.size);
+ qt_safe_close(m_framebufferFd);
+ }
+}
+
+bool QBsdFbScreen::initialize()
+{
+ QRegularExpression fbRx(QLatin1String("fb=(.*)"));
+ QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)"));
+ QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
+ QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)"));
+
+ QString fbDevice;
+ QSize userMmSize;
+ QRect userGeometry;
+
+ // Parse arguments
+ for (const QString &arg : qAsConst(m_arguments)) {
+ QRegularExpressionMatch match;
+ if (arg.contains(mmSizeRx, &match))
+ userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt());
+ else if (arg.contains(sizeRx, &match))
+ userGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt()));
+ else if (arg.contains(offsetRx, &match))
+ userGeometry.setTopLeft(QPoint(match.captured(1).toInt(), match.captured(2).toInt()));
+ else if (arg.contains(fbRx, &match))
+ fbDevice = match.captured(1);
+ }
+
+ if (!fbDevice.isEmpty()) {
+ // Open the device
+ m_framebufferFd = openFramebufferDevice(fbDevice);
+ } else {
+ m_framebufferFd = STDIN_FILENO;
+ }
+
+ if (m_framebufferFd == -1) {
+ qErrnoWarning(errno, "Failed to open framebuffer %s", qPrintable(fbDevice));
+ return false;
+ }
+
+ struct fbtype fb;
+ if (ioctl(m_framebufferFd, FBIOGTYPE, &fb) != 0) {
+ qErrnoWarning(errno, "Error reading framebuffer information");
+ return false;
+ }
+
+ int line_length = 0;
+ if (ioctl(m_framebufferFd, FBIO_GETLINEWIDTH, &line_length) != 0) {
+ qErrnoWarning(errno, "Error reading line length information");
+ return false;
+ }
+
+ mDepth = fb.fb_depth;
+
+ m_bytesPerLine = line_length;
+ const QRect geometry = determineGeometry(fb, userGeometry);
+ mGeometry = QRect(QPoint(0, 0), geometry.size());
+ switch (mDepth) {
+ case 32:
+ mFormat = QImage::Format_RGB32;
+ break;
+ case 24:
+ mFormat = QImage::Format_RGB888;
+ break;
+ case 16:
+ // falling back
+ default:
+ mFormat = QImage::Format_RGB16;
+ break;
+ }
+ mPhysicalSize = determinePhysicalSize(userMmSize, geometry.size());
+
+ // mmap the framebuffer
+ const size_t pagemask = getpagesize() - 1;
+ m_mmap.size = (m_bytesPerLine * fb.fb_height + pagemask) & ~pagemask;
+ uchar *data = static_cast<uchar*>(mmap(nullptr, m_mmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebufferFd, 0));
+ if (data == MAP_FAILED) {
+ qErrnoWarning(errno, "Failed to mmap framebuffer");
+ return false;
+ }
+
+ m_mmap.offset = geometry.y() * m_bytesPerLine + geometry.x() * mDepth / 8;
+ m_mmap.data = data + m_mmap.offset;
+
+ QFbScreen::initializeCompositor();
+ m_onscreenImage = QImage(m_mmap.data, geometry.width(), geometry.height(), m_bytesPerLine, mFormat);
+
+ mCursor = new QFbCursor(this);
+
+ return true;
+}
+
+QRegion QBsdFbScreen::doRedraw()
+{
+ const QRegion touched = QFbScreen::doRedraw();
+
+ if (touched.isEmpty())
+ return touched;
+
+ if (!m_blitter)
+ m_blitter.reset(new QPainter(&m_onscreenImage));
+
+ const auto rects = touched.rects();
+ for (const QRect &rect : rects)
+ m_blitter->drawImage(rect, *mScreenImage, rect);
+ return touched;
+}
+
+// grabWindow() grabs "from the screen" not from the backingstores.
+QPixmap QBsdFbScreen::grabWindow(WId wid, int x, int y, int width, int height) const
+{
+ if (!wid) {
+ if (width < 0)
+ width = m_onscreenImage.width() - x;
+ if (height < 0)
+ height = m_onscreenImage.height() - y;
+ return QPixmap::fromImage(m_onscreenImage).copy(x, y, width, height);
+ }
+
+ const QFbWindow *window = windowForId(wid);
+ if (window) {
+ const QRect geom = window->geometry();
+ if (width < 0)
+ width = geom.width() - x;
+ if (height < 0)
+ height = geom.height() - y;
+ QRect rect(geom.topLeft() + QPoint(x, y), QSize(width, height));
+ rect &= window->geometry();
+ return QPixmap::fromImage(m_onscreenImage).copy(rect);
+ }
+
+ return QPixmap();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.h b/src/plugins/platforms/bsdfb/qbsdfbscreen.h
new file mode 100644
index 0000000000..0d9964afd5
--- /dev/null
+++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2015-2016 Oleksandr Tymoshenko <gonzo@bluezbox.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 QBSDFBSCREEN_H
+#define QBSDFBSCREEN_H
+
+#include <QtPlatformSupport/private/qfbscreen_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPainter;
+
+class QBsdFbScreen : public QFbScreen
+{
+ Q_OBJECT
+public:
+ explicit QBsdFbScreen(const QStringList &args);
+ ~QBsdFbScreen() override;
+
+ bool initialize();
+
+ QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override;
+
+ QRegion doRedraw() override;
+
+private:
+ QStringList m_arguments;
+ int m_framebufferFd = -1;
+ QImage m_onscreenImage;
+
+ int m_bytesPerLine = -1;
+
+ struct {
+ uchar *data;
+ int offset, size;
+ } m_mmap;
+
+ QScopedPointer<QPainter> m_blitter;
+};
+
+QT_END_NAMESPACE
+
+#endif // QBSDFBSCREEN_H
diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm
index c496134606..170f17504f 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplication.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm
@@ -71,11 +71,11 @@
**
****************************************************************************/
-#include <qcocoaapplication.h>
+#include "qcocoaapplication.h"
-#include <qcocoaintrospection.h>
-#include <qcocoaapplicationdelegate.h>
-#include <qcocoahelpers.h>
+#include "qcocoaintrospection.h"
+#include "qcocoaapplicationdelegate.h"
+#include "qcocoahelpers.h"
#include <qguiapplication.h>
#include <qdebug.h>
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index fa05626d18..52a3e756b9 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -57,11 +57,8 @@ public:
QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
void flush(QWindow *widget, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
-#ifndef QT_NO_OPENGL
QImage toImage() const Q_DECL_OVERRIDE;
-#else
- QImage toImage() const; // No QPlatformBackingStore::toImage() for NO_OPENGL builds.
-#endif
+
void resize (const QSize &size, const QRegion &) Q_DECL_OVERRIDE;
bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE;
void beginPaint(const QRegion &region) Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index b060d6a082..20233518b3 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -96,9 +96,8 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
const qreal devicePixelRatio = m_qImage.devicePixelRatio();
QPoint qpoint(dx * devicePixelRatio, dy * devicePixelRatio);
- const QVector<QRect> qrects = area.rects();
- for (int i = 0; i < qrects.count(); ++i) {
- const QRect &qrect = QRect(qrects.at(i).topLeft() * devicePixelRatio, qrects.at(i).size() * devicePixelRatio);
+ for (const QRect &rect : area) {
+ const QRect qrect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio);
qt_scrollRectInImage(m_qImage, qrect, qpoint);
}
return true;
@@ -109,10 +108,9 @@ void QCocoaBackingStore::beginPaint(const QRegion &region)
if (m_qImage.hasAlphaChannel()) {
QPainter p(&m_qImage);
p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = region.rects();
const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(), end = rects.end(); it != end; ++it)
- p.fillRect(*it, blank);
+ for (const QRect &rect : region)
+ p.fillRect(rect, blank);
}
}
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
index 85468009f3..aaa12c6edb 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
@@ -132,7 +132,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
- (void)setDialogHelper:(QCocoaColorDialogHelper *)helper
{
mHelper = helper;
- [mColorPanel setShowsAlpha:mHelper->options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
+
if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) {
[self restoreOriginalContentView];
} else if (!mStolenContentView) {
@@ -483,6 +483,14 @@ bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowMod
{
if (windowModality == Qt::WindowModal)
windowModality = Qt::ApplicationModal;
+
+ // Workaround for Apple rdar://25792119: If you invoke
+ // -setShowsAlpha: multiple times before showing the color
+ // picker, its height grows irrevocably. Instead, only
+ // invoke it once, when we show the dialog.
+ [[NSColorPanel sharedColorPanel] setShowsAlpha:
+ options()->testOption(QColorDialogOptions::ShowAlphaChannel)];
+
sharedColorPanel()->init(this);
return sharedColorPanel()->show(windowModality, parent);
}
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index 872b97566f..1ebcde0584 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -128,7 +128,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
QPixmap pm = dragPixmap(m_drag, hotSpot);
QSize pmDeviceIndependentSize = pm.size() / pm.devicePixelRatio();
NSImage *nsimage = qt_mac_create_nsimage(pm);
- [nsimage setSize : qt_mac_toNSSize(pmDeviceIndependentSize)];
+ [nsimage setSize:pmDeviceIndependentSize.toCGSize()];
QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacInternalPasteboardMime::MIME_DND);
m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 4eb35f5495..0375dd85f2 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -61,6 +61,8 @@
#include <qvarlengtharray.h>
#include <stdlib.h>
#include <qabstracteventdispatcher.h>
+#include <qsysinfo.h>
+#include <qglobal.h>
#include <QDir>
#include <qpa/qplatformnativeinterface.h>
@@ -160,6 +162,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
// here to make sure it gets the correct value.
[mSavePanel setDelegate:self];
+#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11)
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_11)
+ mOpenPanel.accessoryViewDisclosed = YES;
+#endif
+
if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept))
[mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]];
if (mOptions->isLabelExplicitlySet(QFileDialogOptions::FileName))
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index ec2f7f8cf1..723e85f784 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -77,10 +77,6 @@ CGImageRef qt_mac_toCGImageMask(const QImage &qImage);
QImage qt_mac_toQImage(CGImageRef image);
QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
-NSSize qt_mac_toNSSize(const QSize &qtSize);
-NSRect qt_mac_toNSRect(const QRect &rect);
-QRect qt_mac_toQRect(const NSRect &rect);
-
QColor qt_mac_toQColor(const NSColor *color);
QColor qt_mac_toQColor(CGColorRef color);
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 7480d99d19..9ccca1684c 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -202,34 +202,13 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon)
HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region)
{
HIMutableShapeRef shape = HIShapeCreateMutable();
- QVector<QRect> rects = region.rects();
- if (!rects.isEmpty()) {
- int n = rects.count();
- const QRect *qt_r = rects.constData();
- while (n--) {
- CGRect cgRect = CGRectMake(qt_r->x(), qt_r->y(), qt_r->width(), qt_r->height());
- HIShapeUnionWithRect(shape, &cgRect);
- ++qt_r;
- }
+ for (const QRect &rect : region) {
+ CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
+ HIShapeUnionWithRect(shape, &cgRect);
}
return shape;
}
-NSSize qt_mac_toNSSize(const QSize &qtSize)
-{
- return NSMakeSize(qtSize.width(), qtSize.height());
-}
-
-NSRect qt_mac_toNSRect(const QRect &rect)
-{
- return NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-QRect qt_mac_toQRect(const NSRect &rect)
-{
- return QRect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
-}
-
QColor qt_mac_toQColor(const NSColor *color)
{
QColor qtColor;
@@ -340,38 +319,8 @@ QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
// (and providing no public API to get the underlying color without this insanity)
if (qt_mac_isSystemColorOrInstance(color, @"controlColor", @"NSGradientPatternColor") ||
qt_mac_isSystemColorOrInstance(color, @"windowBackgroundColor", @"NSGradientPatternColor")) {
- static QColor newColor;
- if (!newColor.isValid()) {
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- newColor = qt_mac_toQColor(color.CGColor);
- } else
-#endif
- {
- NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
- pixelsWide:1
- pixelsHigh:1
- bitsPerSample:8
- samplesPerPixel:4
- hasAlpha:YES
- isPlanar:NO
- colorSpaceName:NSDeviceRGBColorSpace
- bytesPerRow:4
- bitsPerPixel:32];
- [NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep]];
- NSEraseRect(NSMakeRect(0, 0, 1, 1));
- [color drawSwatchInRect:NSMakeRect(0, 0, 1, 1)];
- [NSGraphicsContext restoreGraphicsState];
- NSUInteger pixel[4];
- [offscreenRep getPixel:pixel atX:0 y:0];
- [offscreenRep release];
- newColor = QColor(pixel[0], pixel[1], pixel[2], pixel[3]);
- }
- }
-
qtBrush.setStyle(Qt::SolidPattern);
- qtBrush.setColor(newColor);
+ qtBrush.setColor(qt_mac_toQColor(color.CGColor));
return qtBrush;
}
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.h b/src/plugins/platforms/cocoa/qcocoakeymapper.h
index 93ebc5b9dc..4ba615efeb 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.h
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.h
@@ -40,7 +40,7 @@
#ifndef QCOCOAKEYMAPPER_H
#define QCOCOAKEYMAPPER_H
-#include <qcocoahelpers.h>
+#include "qcocoahelpers.h"
#include <AppKit/AppKit.h>
#include <Carbon/Carbon.h>
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
index 0cbdc5d9c8..e8d8a473c3 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm
@@ -91,11 +91,8 @@ QT_USE_NAMESPACE
@class QT_MANGLE_NAMESPACE(QNSMenu);
@class QT_MANGLE_NAMESPACE(QNSImageView);
-@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- <NSUserNotificationCenterDelegate>
-#endif
- {
+@interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject <NSUserNotificationCenterDelegate>
+{
@public
QCocoaSystemTrayIcon *systray;
NSStatusItem *item;
@@ -109,11 +106,8 @@ QT_USE_NAMESPACE
-(QRectF)geometry;
- (void)triggerSelector:(id)sender button:(Qt::MouseButton)mouseButton;
- (void)doubleClickSelector:(id)sender;
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification;
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification;
-#endif
@end
@interface QT_MANGLE_NAMESPACE(QNSImageView) : NSImageView {
@@ -142,19 +136,11 @@ class QSystemTrayIconSys
public:
QSystemTrayIconSys(QCocoaSystemTrayIcon *sys) {
item = [[QNSStatusItem alloc] initWithSysTray:sys];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item];
- }
-#endif
+ [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:item];
}
~QSystemTrayIconSys() {
[[[item item] view] setHidden: YES];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil];
- }
-#endif
+ [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:nil];
[item release];
}
QNSStatusItem *item;
@@ -296,71 +282,15 @@ bool QCocoaSystemTrayIcon::supportsMessages() const
void QCocoaSystemTrayIcon::showMessage(const QString &title, const QString &message,
const QIcon& icon, MessageIcon, int)
{
+ Q_UNUSED(icon);
if (!m_sys)
return;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- NSUserNotification *notification = [[NSUserNotification alloc] init];
- notification.title = [NSString stringWithUTF8String:title.toUtf8().data()];
- notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()];
-
- [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
+ NSUserNotification *notification = [[NSUserNotification alloc] init];
+ notification.title = [NSString stringWithUTF8String:title.toUtf8().data()];
+ notification.informativeText = [NSString stringWithUTF8String:message.toUtf8().data()];
- return;
- }
-#endif
-
-#ifdef QT_MAC_SYSTEMTRAY_USE_GROWL
- // Make sure that we have Growl installed on the machine we are running on.
- QCFType<CFURLRef> cfurl;
- OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
- CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
- if (status == kLSApplicationNotFoundErr)
- return;
- QCFType<CFBundleRef> bundle = CFBundleCreate(0, cfurl);
-
- if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"),
- kCFCompareCaseInsensitive | kCFCompareBackwards) != kCFCompareEqualTo)
- return;
- QPixmap notificationIconPixmap = icon.pixmap(32, 32);
- QTemporaryFile notificationIconFile;
- QString notificationType(QLatin1String("Notification")), notificationIcon, notificationApp(qt_mac_applicationName());
- if (notificationApp.isEmpty())
- notificationApp = QLatin1String("Application");
- if (!notificationIconPixmap.isNull() && notificationIconFile.open()) {
- QImageWriter writer(&notificationIconFile, "PNG");
- if (writer.write(notificationIconPixmap.toImage()))
- notificationIcon = QLatin1String("image from location \"file://") + notificationIconFile.fileName() + QLatin1String("\"");
- }
- const QString script(QLatin1String(
- "tell application \"System Events\"\n"
- "set isRunning to (count of (every process whose bundle identifier is \"com.Growl.GrowlHelperApp\")) > 0\n"
- "end tell\n"
- "if isRunning\n"
- "tell application id \"com.Growl.GrowlHelperApp\"\n"
- "-- Make a list of all the notification types (all)\n"
- "set the allNotificationsList to {\"") + notificationType + QLatin1String("\"}\n"
-
- "-- Make a list of the notifications (enabled)\n"
- "set the enabledNotificationsList to {\"") + notificationType + QLatin1String("\"}\n"
-
- "-- Register our script with growl.\n"
- "register as application \"") + notificationApp + QLatin1String("\" all notifications allNotificationsList default notifications enabledNotificationsList\n"
-
- "-- Send a Notification...\n") +
- QLatin1String("notify with name \"") + notificationType +
- QLatin1String("\" title \"") + title +
- QLatin1String("\" description \"") + message +
- QLatin1String("\" application name \"") + notificationApp +
- QLatin1String("\" ") + notificationIcon +
- QLatin1String("\nend tell\nend if"));
- qt_mac_execute_apple_script(script, 0);
-#else
- Q_UNUSED(icon);
- Q_UNUSED(title);
- Q_UNUSED(message);
-#endif
+ [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
}
QT_END_NAMESPACE
@@ -499,7 +429,6 @@ QT_END_NAMESPACE
emit systray->activated(QPlatformSystemTrayIcon::DoubleClick);
}
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification {
Q_UNUSED(center);
Q_UNUSED(notification);
@@ -511,7 +440,6 @@ QT_END_NAMESPACE
Q_UNUSED(notification);
emit systray->messageClicked();
}
-#endif
@end
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index d9e94735ac..6415233250 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -275,6 +275,7 @@ protected:
void syncWindowState(Qt::WindowState newState);
void reinsertChildWindow(QCocoaWindow *child);
void removeChildWindow(QCocoaWindow *child);
+ bool isNativeWindowTypeInconsistent();
// private:
public: // for QNSView
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 91ce91004f..86df38c583 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -505,7 +505,7 @@ QRect QCocoaWindow::geometry() const
NSRect screenRect = [[m_contentView window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
NSPoint screenPoint = screenRect.origin;
QPoint position = qt_mac_flipPoint(screenPoint).toPoint();
- QSize size = qt_mac_toQRect([m_contentView bounds]).size();
+ QSize size = QRectF::fromCGRect([m_contentView bounds]).toRect().size();
return QRect(position, size);
}
@@ -652,7 +652,7 @@ void QCocoaWindow::setVisible(bool visible)
if (visible) {
// We need to recreate if the modality has changed as the style mask will need updating
- if (m_windowModality != window()->modality())
+ if (m_windowModality != window()->modality() || isNativeWindowTypeInconsistent())
recreateWindow(parent());
// Register popup windows. The Cocoa platform plugin will forward mouse events
@@ -1107,11 +1107,10 @@ void QCocoaWindow::propagateSizeHints()
// sizeIncrement is observed to take values of (-1, -1) and (0, 0) for windows that should be
// resizable and that have no specific size increment set. Cocoa expects (1.0, 1.0) in this case.
- const QSize sizeIncrement = windowSizeIncrement();
- if (!sizeIncrement.isEmpty())
- [m_nsWindow setResizeIncrements : qt_mac_toNSSize(sizeIncrement)];
- else
- [m_nsWindow setResizeIncrements : NSMakeSize(1.0, 1.0)];
+ QSize sizeIncrement = windowSizeIncrement();
+ if (sizeIncrement.isEmpty())
+ sizeIncrement = QSize(1, 1);
+ [m_nsWindow setResizeIncrements:sizeIncrement.toCGSize()];
QRect rect = geometry();
QSize baseSize = windowBaseSize();
@@ -1532,6 +1531,17 @@ void QCocoaWindow::removeChildWindow(QCocoaWindow *child)
[m_nsWindow removeChildWindow:child->m_nsWindow];
}
+bool QCocoaWindow::isNativeWindowTypeInconsistent()
+{
+ if (!m_nsWindow)
+ return false;
+
+ const bool isPanel = [m_nsWindow isKindOfClass:[QNSPanel class]];
+ const bool usePanel = shouldUseNSPanel();
+
+ return isPanel != usePanel;
+}
+
void QCocoaWindow::removeMonitor()
{
if (!monitor)
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 00d65ea7f8..02ae64a58e 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -85,7 +85,6 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
bool m_resendKeyEvent;
bool m_scrolling;
bool m_updatingDrag;
- bool m_exposedOnMoveToWindow;
NSEvent *m_currentlyInterpretedKeyEvent;
bool m_isMenuView;
QSet<quint32> m_acceptedKeyDowns;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 3469166fdc..7834c2991d 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -39,8 +39,6 @@
#include <QtCore/qglobal.h>
-#include <dlfcn.h>
-
#include "qnsview.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
@@ -72,9 +70,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
static QTouchDevice *touchDevice = 0;
-// ### HACK Remove once 10.8 is unsupported
-static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
-
static bool _q_dontOverrideCtrlLMB = false;
@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
@@ -134,10 +129,6 @@ static bool _q_dontOverrideCtrlLMB = false;
+ (void)initialize
{
- NSString **notificationNameVar = (NSString **)dlsym(RTLD_NEXT, "NSWindowDidChangeOcclusionStateNotification");
- if (notificationNameVar)
- _q_NSWindowDidChangeOcclusionStateNotification = *notificationNameVar;
-
_q_dontOverrideCtrlLMB = qt_mac_resolveOption(false, "QT_MAC_DONT_OVERRIDE_CTRL_LMB");
}
@@ -291,18 +282,6 @@ static bool _q_dontOverrideCtrlLMB = false;
- (void)viewDidMoveToWindow
{
m_backingStore = Q_NULLPTR;
- m_isMenuView = [self.window.className isEqualToString:@"NSCarbonMenuWindow"];
- if (self.window) {
- // This is the case of QWidgetAction's generated QWidget inserted in an NSMenu.
- // 10.9 and newer get the NSWindowDidChangeOcclusionStateNotification
- if (!_q_NSWindowDidChangeOcclusionStateNotification && m_isMenuView) {
- m_exposedOnMoveToWindow = true;
- m_platformWindow->exposeWindow();
- }
- } else if (m_exposedOnMoveToWindow) {
- m_exposedOnMoveToWindow = false;
- m_platformWindow->obscureWindow();
- }
}
- (void)viewWillMoveToWindow:(NSWindow *)newWindow
@@ -343,9 +322,9 @@ static bool _q_dontOverrideCtrlLMB = false;
if (m_platformWindow->m_isNSWindowChild) {
return;
#if 0
- //geometry = qt_mac_toQRect([self frame]);
+ //geometry = QRectF::fromCGRect([self frame]).toRect();
qDebug() << "nsview updateGeometry" << m_platformWindow->window();
- QRect screenRect = qt_mac_toQRect([m_platformWindow->m_nsWindow convertRectToScreen:[self frame]]);
+ QRect screenRect = QRectF::fromCGRect([m_platformWindow->m_nsWindow convertRectToScreen:[self frame]]).toRect();
qDebug() << "screenRect" << screenRect;
screenRect.moveTop(qt_mac_flipYCoordinate(screenRect.y() + screenRect.height()));
@@ -360,10 +339,10 @@ static bool _q_dontOverrideCtrlLMB = false;
geometry = QRect(windowRect.origin.x, qt_mac_flipYCoordinate(windowRect.origin.y + rect.size.height), rect.size.width, rect.size.height);
} else if (m_platformWindow->m_contentViewIsToBeEmbedded) {
// embedded child window, use the frame rect ### merge with case below
- geometry = qt_mac_toQRect([self bounds]);
+ geometry = QRectF::fromCGRect([self bounds]).toRect();
} else {
// child window, use the frame rect
- geometry = qt_mac_toQRect([self frame]);
+ geometry = QRectF::fromCGRect([self frame]).toRect();
}
if (m_platformWindow->m_nsWindow && geometry == m_platformWindow->geometry())
@@ -432,7 +411,7 @@ static bool _q_dontOverrideCtrlLMB = false;
// set the active window to zero here, the new key window's
// NSWindowDidBecomeKeyNotification hander will change the active window
NSWindow *keyWindow = [NSApp keyWindow];
- if (!keyWindow) {
+ if (!keyWindow || keyWindow == windowNotification.object) {
// no new key window, go ahead and set the active window to zero
if (!m_platformWindow->windowIsPopupType() && !m_isMenuView)
QWindowSystemInterface::handleWindowActivated(0);
@@ -446,14 +425,7 @@ static bool _q_dontOverrideCtrlLMB = false;
m_platformWindow->obscureWindow();
} else if ([notificationName isEqualToString: @"NSWindowDidOrderOnScreenAndFinishAnimatingNotification"]) {
m_platformWindow->exposeWindow();
- } else if (_q_NSWindowDidChangeOcclusionStateNotification
- && [notificationName isEqualToString:_q_NSWindowDidChangeOcclusionStateNotification]) {
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
-// ### HACK Remove the enum declaration, the warning disabling and the cast further down once 10.8 is unsupported
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wobjc-method-access")
- enum { NSWindowOcclusionStateVisible = 1UL << 1 };
-#endif
+ } else if ([notificationName isEqualToString:NSWindowDidChangeOcclusionStateNotification]) {
// Several unit tests expect paint and/or expose events for windows that are
// sometimes (unpredictably) occluded and some unit tests depend on QWindow::isExposed -
// don't send Expose/Obscure events when running under QTestLib.
@@ -466,9 +438,6 @@ QT_WARNING_DISABLE_CLANG("-Wobjc-method-access")
m_platformWindow->obscureWindow();
}
}
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
-QT_WARNING_POP
-#endif
} else if (notificationName == NSWindowDidChangeScreenNotification) {
if (m_window) {
NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen];
@@ -525,7 +494,7 @@ QT_WARNING_POP
m_backingStore = backingStore;
m_backingStoreOffset = offset * m_backingStore->getBackingStoreDevicePixelRatio();
- foreach (QRect rect, region.rects())
+ for (const QRect &rect : region)
[self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
@@ -586,7 +555,7 @@ QT_WARNING_POP
- (void) drawRect:(NSRect)dirtyRect
{
- qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_window << qt_mac_toQRect(dirtyRect);
+ qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_window << QRectF::fromCGRect(dirtyRect);
#ifndef QT_NO_OPENGL
if (m_glContext && m_shouldSetGLContextinDrawRect) {
@@ -1395,7 +1364,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
[event magnification], windowPoint, screenPoint);
}
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- (void)smartMagnifyWithEvent:(NSEvent *)event
{
static bool zoomIn = true;
@@ -1408,7 +1376,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
zoomIn ? 1.0f : 0.0f, windowPoint, screenPoint);
zoomIn = !zoomIn;
}
-#endif
- (void)rotateWithEvent:(NSEvent *)event
{
@@ -1524,16 +1491,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
NSEventPhase phase = [theEvent phase];
Qt::ScrollPhase ph = Qt::ScrollUpdate;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
- if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
- // On 10.8 and above, MayBegin is likely to happen. We treat it the same as an actual begin.
- if (phase == NSEventPhaseMayBegin) {
- m_scrolling = true;
- ph = Qt::ScrollBegin;
- }
- }
-#endif
- if (phase == NSEventPhaseBegan) {
+
+ // MayBegin is likely to happen. We treat it the same as an actual begin.
+ if (phase == NSEventPhaseMayBegin) {
+ m_scrolling = true;
+ ph = Qt::ScrollBegin;
+ } else if (phase == NSEventPhaseBegan) {
// If MayBegin did not happen, Began is the actual beginning.
if (!m_scrolling)
ph = Qt::ScrollBegin;
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 395c25c915..759c4d26a5 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -88,10 +88,7 @@ static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransfor
if (rgn.isEmpty()) {
CGContextAddRect(hd, CGRectMake(0, 0, 0, 0));
} else {
- QVector<QRect> rects = rgn.rects();
- const int count = rects.size();
- for (int i = 0; i < count; i++) {
- const QRect &r = rects[i];
+ for (const QRect &r : rgn) {
CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height());
CGContextAddRect(hd, mac_r);
}
diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro
index 005a4da6db..f4c3b5cc3b 100644
--- a/src/plugins/platforms/direct2d/direct2d.pro
+++ b/src/plugins/platforms/direct2d/direct2d.pro
@@ -4,7 +4,7 @@ QT *= core-private
QT *= gui-private
QT *= platformsupport-private
-LIBS *= -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32
+LIBS += -ldwmapi -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32
include(../windows/windows.pri)
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp
index 97eadb207b..38f2352934 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp
@@ -95,7 +95,7 @@ void QWindowsDirect2DBackingStore::beginPaint(const QRegion &region)
painter.setCompositionMode(QPainter::CompositionMode_Source);
- foreach (const QRect &r, region.rects())
+ for (const QRect &r : region)
painter.fillRect(r, clear);
}
@@ -127,10 +127,14 @@ void QWindowsDirect2DBackingStore::resize(const QSize &size, const QRegion &regi
QPixmap *newPixmap = nativeWindow(window())->pixmap();
if (!old.isNull()) {
- foreach (const QRect &rect, region.rects()) {
+ for (const QRect &rect : region)
platformPixmap(newPixmap)->copy(old.handle(), rect);
- }
}
}
+QImage QWindowsDirect2DBackingStore::toImage() const
+{
+ return nativeWindow(window())->pixmap()->toImage();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h
index 9d754866cc..670c4e9840 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h
@@ -60,6 +60,8 @@ public:
QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
void flush(QWindow *targetWindow, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
+
+ QImage toImage() const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp
index 4e677166b2..c750b02078 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp
@@ -122,7 +122,7 @@ void QWindowsDirect2DWindow::flush(QWindowsDirect2DBitmap *bitmap, const QRegion
QRegion clipped = region;
clipped &= QRect(QPoint(), size);
- foreach (const QRect &rect, clipped.rects()) {
+ for (const QRect &rect : clipped) {
QRectF rectF(rect);
dc->DrawBitmap(bitmap->bitmap(),
to_d2d_rect_f(rectF),
diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
index 0bcf93aa3d..8d5e1e50c4 100644
--- a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
@@ -70,9 +70,7 @@ void QDirectFbBackingStore::flush(QWindow *, const QRegion &region, const QPoint
{
m_pmdata->blittable()->unlock();
- QVector<QRect> rects = region.rects();
- for (int i = 0 ; i < rects.size(); i++) {
- const QRect rect = rects.at(i);
+ for (const QRect &rect : region) {
DFBRegion dfbReg(rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y());
m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC));
}
@@ -108,13 +106,15 @@ bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy)
if (area.rectCount() == 1) {
scrollSurface(m_dfbSurface.data(), area.boundingRect(), dx, dy);
} else {
- const QVector<QRect> rects = area.rects();
- const int n = rects.size();
- for (int i=0; i<n; ++i) {
- scrollSurface(m_dfbSurface.data(), rects.at(i), dx, dy);
- }
+ for (const QRect &rect : area)
+ scrollSurface(m_dfbSurface.data(), rect, dx, dy);
}
return true;
}
+QImage QDirectFbBackingStore::toImage() const
+{
+ return m_pixmap.data()->toImage();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.h b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
index 33ab1c111d..af1ce92e64 100644
--- a/src/plugins/platforms/directfb/qdirectfbbackingstore.h
+++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.h
@@ -59,6 +59,8 @@ public:
void resize (const QSize &size, const QRegion &staticContents);
bool scroll(const QRegion &area, int dx, int dy);
+ QImage toImage() const override;
+
private:
void lockSurfaceToImage();
diff --git a/src/plugins/platforms/eglfs/api/api.pri b/src/plugins/platforms/eglfs/api/api.pri
new file mode 100644
index 0000000000..957dee554c
--- /dev/null
+++ b/src/plugins/platforms/eglfs/api/api.pri
@@ -0,0 +1,15 @@
+
+SOURCES += $$PWD/qeglfswindow.cpp \
+ $$PWD/qeglfsscreen.cpp \
+ $$PWD/qeglfscursor.cpp \
+ $$PWD/qeglfshooks.cpp \
+ $$PWD/qeglfsdeviceintegration.cpp
+
+HEADERS += $$PWD/qeglfswindow_p.h \
+ $$PWD/qeglfsscreen_p.h \
+ $$PWD/qeglfscursor_p.h \
+ $$PWD/qeglfshooks_p.h \
+ $$PWD/qeglfsdeviceintegration_p.h \
+ $$PWD/qeglfsglobal.h
+
+INCLUDEPATH += $$PWD
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index 6c8c35b1dc..ffee21a9b0 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -37,9 +37,9 @@
**
****************************************************************************/
-#include "qeglfscursor.h"
+#include "qeglfscursor_p.h"
#include "qeglfsintegration.h"
-#include "qeglfsscreen.h"
+#include "qeglfsscreen_p.h"
#include <qpa/qwindowsysteminterface.h>
#include <QtGui/QOpenGLContext>
diff --git a/src/plugins/platforms/eglfs/qeglfscursor.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
index bb30d53d6c..bb30d53d6c 100644
--- a/src/plugins/platforms/eglfs/qeglfscursor.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 5cbc5dbdb0..a735f4dba4 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -37,10 +37,12 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "qeglfsdeviceintegration_p.h"
#include "qeglfsintegration.h"
-#include "qeglfscursor.h"
-#include "qeglfswindow.h"
+#include "qeglfscursor_p.h"
+#include "qeglfswindow_p.h"
+#include "qeglfshooks_p.h"
+
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QGuiApplication>
#include <private/qguiapplication_p.h>
@@ -64,14 +66,28 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration")
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QEGLDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))
+ (QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive))
#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
- (QEGLDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
+ (QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
+
+static inline QEglFSDeviceIntegration *loadIntegration(QFactoryLoader *loader, const QString &key)
+{
+ const int index = loader->indexOf(key);
+ if (index != -1) {
+ QObject *plugin = loader->instance(index);
+ if (QEglFSDeviceIntegrationPlugin *factory = qobject_cast<QEglFSDeviceIntegrationPlugin *>(plugin)) {
+ if (QEglFSDeviceIntegration *result = factory->create())
+ return result;
+ }
+ }
+ return Q_NULLPTR;
+}
+
#endif // QT_NO_LIBRARY
-QStringList QEGLDeviceIntegrationFactory::keys(const QString &pluginPath)
+QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
{
QStringList list;
#ifndef QT_NO_LIBRARY
@@ -95,19 +111,19 @@ QStringList QEGLDeviceIntegrationFactory::keys(const QString &pluginPath)
return list;
}
-QEGLDeviceIntegration *QEGLDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
+QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
{
- QEGLDeviceIntegration *integration = Q_NULLPTR;
+ QEglFSDeviceIntegration *integration = Q_NULLPTR;
#ifndef QT_NO_LIBRARY
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
- integration = qLoadPlugin<QEGLDeviceIntegration, QEGLDeviceIntegrationPlugin>(directLoader(), key);
+ integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(directLoader(), key);
}
#else
Q_UNUSED(pluginPath);
#endif
if (!integration)
- integration = qLoadPlugin<QEGLDeviceIntegration, QEGLDeviceIntegrationPlugin>(loader(), key);
+ integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(loader(), key);
if (integration)
qCDebug(qLcEglDevDebug) << "Using EGL device integration" << key;
else
@@ -118,7 +134,7 @@ QEGLDeviceIntegration *QEGLDeviceIntegrationFactory::create(const QString &key,
static int framebuffer = -1;
-QByteArray QEGLDeviceIntegration::fbDeviceName() const
+QByteArray QEglFSDeviceIntegration::fbDeviceName() const
{
#ifdef Q_OS_LINUX
QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");
@@ -131,7 +147,7 @@ QByteArray QEGLDeviceIntegration::fbDeviceName() const
#endif
}
-int QEGLDeviceIntegration::framebufferIndex() const
+int QEglFSDeviceIntegration::framebufferIndex() const
{
int fbIndex = 0;
#ifndef QT_NO_REGULAREXPRESSION
@@ -143,7 +159,7 @@ int QEGLDeviceIntegration::framebufferIndex() const
return fbIndex;
}
-void QEGLDeviceIntegration::platformInit()
+void QEglFSDeviceIntegration::platformInit()
{
#ifdef Q_OS_LINUX
QByteArray fbDev = fbDeviceName();
@@ -161,7 +177,7 @@ void QEGLDeviceIntegration::platformInit()
#endif
}
-void QEGLDeviceIntegration::platformDestroy()
+void QEglFSDeviceIntegration::platformDestroy()
{
#ifdef Q_OS_LINUX
if (framebuffer != -1)
@@ -169,27 +185,27 @@ void QEGLDeviceIntegration::platformDestroy()
#endif
}
-EGLNativeDisplayType QEGLDeviceIntegration::platformDisplay() const
+EGLNativeDisplayType QEglFSDeviceIntegration::platformDisplay() const
{
return EGL_DEFAULT_DISPLAY;
}
-EGLDisplay QEGLDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)
+EGLDisplay QEglFSDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay)
{
return eglGetDisplay(nativeDisplay);
}
-bool QEGLDeviceIntegration::usesDefaultScreen()
+bool QEglFSDeviceIntegration::usesDefaultScreen()
{
return true;
}
-void QEGLDeviceIntegration::screenInit()
+void QEglFSDeviceIntegration::screenInit()
{
// Nothing to do here. Called only when usesDefaultScreen is false.
}
-void QEGLDeviceIntegration::screenDestroy()
+void QEglFSDeviceIntegration::screenDestroy()
{
QGuiApplication *app = qGuiApp;
QEglFSIntegration *platformIntegration = static_cast<QEglFSIntegration *>(
@@ -198,17 +214,17 @@ void QEGLDeviceIntegration::screenDestroy()
platformIntegration->removeScreen(app->screens().last()->handle());
}
-QSizeF QEGLDeviceIntegration::physicalScreenSize() const
+QSizeF QEglFSDeviceIntegration::physicalScreenSize() const
{
return q_physicalScreenSizeFromFb(framebuffer, screenSize());
}
-QSize QEGLDeviceIntegration::screenSize() const
+QSize QEglFSDeviceIntegration::screenSize() const
{
return q_screenSizeFromFb(framebuffer);
}
-QDpi QEGLDeviceIntegration::logicalDpi() const
+QDpi QEglFSDeviceIntegration::logicalDpi() const
{
const QSizeF ps = physicalScreenSize();
const QSize s = screenSize();
@@ -220,42 +236,42 @@ QDpi QEGLDeviceIntegration::logicalDpi() const
return QDpi(100, 100);
}
-qreal QEGLDeviceIntegration::pixelDensity() const
+qreal QEglFSDeviceIntegration::pixelDensity() const
{
return qRound(logicalDpi().first / qreal(100));
}
-Qt::ScreenOrientation QEGLDeviceIntegration::nativeOrientation() const
+Qt::ScreenOrientation QEglFSDeviceIntegration::nativeOrientation() const
{
return Qt::PrimaryOrientation;
}
-Qt::ScreenOrientation QEGLDeviceIntegration::orientation() const
+Qt::ScreenOrientation QEglFSDeviceIntegration::orientation() const
{
return Qt::PrimaryOrientation;
}
-int QEGLDeviceIntegration::screenDepth() const
+int QEglFSDeviceIntegration::screenDepth() const
{
return q_screenDepthFromFb(framebuffer);
}
-QImage::Format QEGLDeviceIntegration::screenFormat() const
+QImage::Format QEglFSDeviceIntegration::screenFormat() const
{
return screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
}
-qreal QEGLDeviceIntegration::refreshRate() const
+qreal QEglFSDeviceIntegration::refreshRate() const
{
return q_refreshRateFromFb(framebuffer);
}
-EGLint QEGLDeviceIntegration::surfaceType() const
+EGLint QEglFSDeviceIntegration::surfaceType() const
{
return EGL_WINDOW_BIT;
}
-QSurfaceFormat QEGLDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
+QSurfaceFormat QEglFSDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
{
QSurfaceFormat format = inputFormat;
@@ -269,17 +285,17 @@ QSurfaceFormat QEGLDeviceIntegration::surfaceFormatFor(const QSurfaceFormat &inp
return format;
}
-bool QEGLDeviceIntegration::filterConfig(EGLDisplay, EGLConfig) const
+bool QEglFSDeviceIntegration::filterConfig(EGLDisplay, EGLConfig) const
{
return true;
}
-QEglFSWindow *QEGLDeviceIntegration::createWindow(QWindow *window) const
+QEglFSWindow *QEglFSDeviceIntegration::createWindow(QWindow *window) const
{
return new QEglFSWindow(window);
}
-EGLNativeWindowType QEGLDeviceIntegration::createNativeWindow(QPlatformWindow *platformWindow,
+EGLNativeWindowType QEglFSDeviceIntegration::createNativeWindow(QPlatformWindow *platformWindow,
const QSize &size,
const QSurfaceFormat &format)
{
@@ -289,29 +305,29 @@ EGLNativeWindowType QEGLDeviceIntegration::createNativeWindow(QPlatformWindow *p
return 0;
}
-EGLNativeWindowType QEGLDeviceIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format)
+EGLNativeWindowType QEglFSDeviceIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format)
{
Q_UNUSED(format);
return 0;
}
-void QEGLDeviceIntegration::destroyNativeWindow(EGLNativeWindowType window)
+void QEglFSDeviceIntegration::destroyNativeWindow(EGLNativeWindowType window)
{
Q_UNUSED(window);
}
-bool QEGLDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap) const
+bool QEglFSDeviceIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
Q_UNUSED(cap);
return false;
}
-QPlatformCursor *QEGLDeviceIntegration::createCursor(QPlatformScreen *screen) const
+QPlatformCursor *QEglFSDeviceIntegration::createCursor(QPlatformScreen *screen) const
{
return new QEglFSCursor(screen);
}
-void QEGLDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
+void QEglFSDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
{
Q_UNUSED(surface);
@@ -325,24 +341,42 @@ void QEGLDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
#endif
}
-void QEGLDeviceIntegration::presentBuffer(QPlatformSurface *surface)
+void QEglFSDeviceIntegration::presentBuffer(QPlatformSurface *surface)
{
Q_UNUSED(surface);
}
-bool QEGLDeviceIntegration::supportsPBuffers() const
+bool QEglFSDeviceIntegration::supportsPBuffers() const
{
return true;
}
-bool QEGLDeviceIntegration::supportsSurfacelessContexts() const
+bool QEglFSDeviceIntegration::supportsSurfacelessContexts() const
{
return true;
}
-void *QEGLDeviceIntegration::wlDisplay() const
+void *QEglFSDeviceIntegration::wlDisplay() const
{
return Q_NULLPTR;
}
+EGLConfig QEglFSDeviceIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
+{
+ class Chooser : public QEglConfigChooser {
+ public:
+ Chooser(EGLDisplay display)
+ : QEglConfigChooser(display) { }
+ bool filterConfig(EGLConfig config) const Q_DECL_OVERRIDE {
+ return qt_egl_device_integration()->filterConfig(display(), config)
+ && QEglConfigChooser::filterConfig(config);
+ }
+ };
+
+ Chooser chooser(display);
+ chooser.setSurfaceType(qt_egl_device_integration()->surfaceType());
+ chooser.setSurfaceFormat(format);
+ return chooser.chooseConfig();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
index f1a5bde331..819e4818ab 100644
--- a/src/plugins/platforms/eglfs/qeglfsdeviceintegration.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
@@ -63,12 +63,12 @@ QT_BEGIN_NAMESPACE
class QPlatformSurface;
class QEglFSWindow;
-#define QEGLDeviceIntegrationFactoryInterface_iid "org.qt-project.qt.qpa.egl.QEGLDeviceIntegrationFactoryInterface.5.5"
+#define QEglFSDeviceIntegrationFactoryInterface_iid "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5"
-class Q_EGLFS_EXPORT QEGLDeviceIntegration
+class Q_EGLFS_EXPORT QEglFSDeviceIntegration
{
public:
- virtual ~QEGLDeviceIntegration() { }
+ virtual ~QEglFSDeviceIntegration() { }
virtual void platformInit();
virtual void platformDestroy();
@@ -105,25 +105,27 @@ public:
virtual bool supportsSurfacelessContexts() const;
virtual void *wlDisplay() const;
+
+ static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format);
};
-class Q_EGLFS_EXPORT QEGLDeviceIntegrationPlugin : public QObject
+class Q_EGLFS_EXPORT QEglFSDeviceIntegrationPlugin : public QObject
{
Q_OBJECT
public:
- virtual QEGLDeviceIntegration *create() = 0;
+ virtual QEglFSDeviceIntegration *create() = 0;
// the pattern expected by qLoadPlugin calls for a QString argument.
// we don't need it, so don't bother subclasses with it:
- QEGLDeviceIntegration *create(const QString &) { return create(); }
+ QEglFSDeviceIntegration *create(const QString &) { return create(); }
};
-class Q_EGLFS_EXPORT QEGLDeviceIntegrationFactory
+class Q_EGLFS_EXPORT QEglFSDeviceIntegrationFactory
{
public:
static QStringList keys(const QString &pluginPath = QString());
- static QEGLDeviceIntegration *create(const QString &name, const QString &platformPluginPath = QString());
+ static QEglFSDeviceIntegration *create(const QString &name, const QString &platformPluginPath = QString());
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsglobal.h b/src/plugins/platforms/eglfs/api/qeglfsglobal.h
index d6aba565ce..2b5effc2f1 100644
--- a/src/plugins/platforms/eglfs/qeglfsglobal.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsglobal.h
@@ -40,7 +40,11 @@
#ifndef QEGLFSGLOBAL_H
#define QEGLFSGLOBAL_H
-#include <qglobal.h>
+#include <QtCore/qglobal.h>
+
+#include <EGL/egl.h>
+
+QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_EGL_DEVICE_LIB
#define Q_EGLFS_EXPORT Q_DECL_EXPORT
@@ -48,7 +52,6 @@
#define Q_EGLFS_EXPORT Q_DECL_IMPORT
#endif
-#include <EGL/egl.h>
#undef Status
#undef None
#undef Bool
@@ -61,4 +64,6 @@
#undef Expose
#undef Unsorted
+QT_END_NAMESPACE
+
#endif
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.cpp b/src/plugins/platforms/eglfs/api/qeglfshooks.cpp
index 87285428df..b67d8fab54 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfshooks.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "qeglfshooks.h"
+#include "qeglfshooks_p.h"
#include <QLoggingCategory>
QT_BEGIN_NAMESPACE
@@ -46,7 +46,7 @@ Q_DECLARE_LOGGING_CATEGORY(qLcEglDevDebug)
#ifdef EGLFS_PLATFORM_HOOKS
-QEGLDeviceIntegration *qt_egl_device_integration()
+QEglFSDeviceIntegration *qt_egl_device_integration()
{
extern QEglFSHooks *platformHooks;
return platformHooks;
@@ -59,16 +59,16 @@ class DeviceIntegration
public:
DeviceIntegration();
~DeviceIntegration() { delete m_integration; }
- QEGLDeviceIntegration *integration() { return m_integration; }
+ QEglFSDeviceIntegration *integration() { return m_integration; }
private:
- QEGLDeviceIntegration *m_integration;
+ QEglFSDeviceIntegration *m_integration;
};
Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration)
DeviceIntegration::DeviceIntegration() : m_integration(0)
{
- QStringList pluginKeys = QEGLDeviceIntegrationFactory::keys();
+ QStringList pluginKeys = QEglFSDeviceIntegrationFactory::keys();
if (!pluginKeys.isEmpty()) {
// Some built-in logic: Prioritize either X11 or KMS/DRM.
if (qEnvironmentVariableIsSet("DISPLAY")) {
@@ -113,7 +113,7 @@ DeviceIntegration::DeviceIntegration() : m_integration(0)
while (!m_integration && !pluginKeys.isEmpty()) {
QString key = pluginKeys.takeFirst();
qCDebug(qLcEglDevDebug) << "Trying to load device EGL integration" << key;
- m_integration = QEGLDeviceIntegrationFactory::create(key);
+ m_integration = QEglFSDeviceIntegrationFactory::create(key);
}
}
}
@@ -122,11 +122,11 @@ DeviceIntegration::DeviceIntegration() : m_integration(0)
// Use a default, non-specialized device integration when no plugin is available.
// For some systems this is sufficient.
qCDebug(qLcEglDevDebug) << "Using base device integration";
- m_integration = new QEGLDeviceIntegration;
+ m_integration = new QEglFSDeviceIntegration;
}
}
-QEGLDeviceIntegration *qt_egl_device_integration()
+QEglFSDeviceIntegration *qt_egl_device_integration()
{
return deviceIntegration()->integration();
}
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
index cc6c325b58..e379f7a76d 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h
@@ -40,16 +40,27 @@
#ifndef QEGLFSHOOKS_H
#define QEGLFSHOOKS_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 "qeglfsglobal.h"
-#include "qeglfsdeviceintegration.h"
+#include "qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE
-class QEglFSHooks : public QEGLDeviceIntegration
+class QEglFSHooks : public QEglFSDeviceIntegration
{
};
-Q_EGLFS_EXPORT QEGLDeviceIntegration *qt_egl_device_integration();
+Q_EGLFS_EXPORT QEglFSDeviceIntegration *qt_egl_device_integration();
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
index a1ab854db1..d636a783ec 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
@@ -43,9 +43,9 @@
#include <qpa/qplatformcursor.h>
#include <QtPlatformSupport/private/qopenglcompositor_p.h>
-#include "qeglfsscreen.h"
-#include "qeglfswindow.h"
-#include "qeglfshooks.h"
+#include "qeglfsscreen_p.h"
+#include "qeglfswindow_p.h"
+#include "qeglfshooks_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
index 57d68ca572..092d853ffd 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
@@ -40,9 +40,22 @@
#ifndef QEGLFSSCREEN_H
#define QEGLFSSCREEN_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 "qeglfsglobal.h"
#include <QtCore/QPointer>
+#include <qpa/qplatformscreen.h>
+
QT_BEGIN_NAMESPACE
class QEglFSWindow;
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
index 556d3942cd..f602c1b976 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
@@ -46,9 +46,10 @@
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qopenglcompositorbackingstore_p.h>
-#include "qeglfswindow.h"
-#include "qeglfscursor.h"
-#include "qeglfshooks.h"
+#include "qeglfswindow_p.h"
+#include "qeglfscursor_p.h"
+#include "qeglfshooks_p.h"
+#include "qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE
@@ -186,7 +187,7 @@ void QEglFSWindow::resetSurface()
EGLDisplay display = screen()->display();
QSurfaceFormat platformFormat = qt_egl_device_integration()->surfaceFormatFor(window()->requestedFormat());
- m_config = QEglFSIntegration::chooseConfig(display, platformFormat);
+ m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
m_format = q_glFormatFromConfig(display, m_config, platformFormat);
m_window = qt_egl_device_integration()->createNativeWindow(this, screen()->geometry().size(), m_format);
m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL);
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index d607c8bd62..aea4ed4806 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
@@ -40,9 +40,20 @@
#ifndef QEGLFSWINDOW_H
#define QEGLFSWINDOW_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 "qeglfsglobal.h"
#include "qeglfsintegration.h"
-#include "qeglfsscreen.h"
+#include "qeglfsscreen_p.h"
#include <qpa/qplatformwindow.h>
#include <QtPlatformSupport/private/qopenglcompositor_p.h>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
index e2ebf9f7ee..cd97c2c5a3 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs-brcm-integration
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
CONFIG += egl
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h
index 8f78b51190..5af628dedd 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h
@@ -40,11 +40,11 @@
#ifndef QEGLFSBRCMINTEGRATION_H
#define QEGLFSBRCMINTEGRATION_H
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE
-class QEglFSBrcmIntegration : public QEGLDeviceIntegration
+class QEglFSBrcmIntegration : public QEglFSDeviceIntegration
{
public:
void platformInit() Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp
index 0bd54ba239..80d7631931 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp
@@ -37,18 +37,18 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsbrcmintegration.h"
QT_BEGIN_NAMESPACE
-class QEglFSBrcmIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSBrcmIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_brcm.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_brcm.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSBrcmIntegration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSBrcmIntegration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
index 979bfe3ea9..b0d631a9d1 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
@@ -4,7 +4,7 @@ PLUGIN_TYPE = egldeviceintegrations
PLUGIN_CLASS_NAME = QEglFSKmsGbmIntegrationPlugin
load(qt_plugin)
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private eglfs_kms_support-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private
INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
index 1c0a8e1b5f..a5ab73cca4 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
@@ -43,7 +43,7 @@
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmscreen.h"
#include "qeglfskmsgbmcursor.h"
-#include "qeglfscursor.h"
+#include "private/qeglfscursor_p.h"
#include <QtPlatformSupport/private/qdevicediscovery_p.h>
#include <QtCore/QLoggingCategory>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp
index 8e8779ca10..f34e4859c6 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp
@@ -38,18 +38,18 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfskmsgbmintegration.h"
QT_BEGIN_NAMESPACE
-class QEglFSKmsGbmIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSKmsGbmIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSKmsGbmIntegration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSKmsGbmIntegration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
index 3a380b7525..8eabd2d4b7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs-kms-egldevice-integration
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private eglfs_kms_support-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private
INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support
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 838569d5c6..28967d71ff 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -40,7 +40,7 @@
#include "qeglfskmsegldeviceintegration.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
-#include "qeglfswindow.h"
+#include "private/qeglfswindow_p.h"
#include "qeglfskmsegldevice.h"
#include "qeglfskmsscreen.h"
#include <QLoggingCategory>
@@ -189,7 +189,7 @@ void QEglJetsonTK1Window::resetSurface()
if (!m_integration->m_funcs->stream_consumer_output(display, m_egl_stream, layer))
qWarning("resetSurface: Unable to connect stream");
- m_config = QEglFSIntegration::chooseConfig(display, m_integration->surfaceFormatFor(window()->requestedFormat()));
+ m_config = QEglFSDeviceIntegration::chooseConfig(display, m_integration->surfaceFormatFor(window()->requestedFormat()));
m_format = q_glFormatFromConfig(display, m_config);
qCDebug(qLcEglfsKmsDebug) << "Stream producer format is" << m_format;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp
index 63571f796f..42fec073f1 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp
@@ -41,13 +41,13 @@
QT_BEGIN_NAMESPACE
-class QEglFSKmsEglDeviceIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSKmsEglDeviceIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms_egldevice.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_kms_egldevice.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSKmsEglDeviceIntegration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSKmsEglDeviceIntegration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
index 6355fe6abd..6dd857a4e4 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro
@@ -2,7 +2,7 @@ TARGET = QtEglFsKmsSupport
CONFIG += no_module_headers internal_module
load(qt_module)
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
index 07ea7d4439..7389050efc 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
@@ -42,8 +42,8 @@
#include "qeglfskmsintegration.h"
#include "qeglfskmsdevice.h"
#include "qeglfskmsscreen.h"
-#include "qeglfswindow.h"
-#include "qeglfscursor.h"
+#include "private/qeglfswindow_p.h"
+#include "private/qeglfscursor_p.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtCore/QJsonDocument>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
index 34ac5385a5..81386881ff 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
@@ -42,7 +42,7 @@
#ifndef QEGLFSKMSINTEGRATION_H
#define QEGLFSKMSINTEGRATION_H
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include <QtCore/QMap>
#include <QtCore/QVariant>
#include <QtCore/QLoggingCategory>
@@ -53,7 +53,7 @@ class QEglFSKmsDevice;
Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
-class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEGLDeviceIntegration
+class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration
{
public:
QEglFSKmsIntegration();
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 aa698e1b5d..9679f70260 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
@@ -43,7 +43,7 @@
#define QEGLFSKMSSCREEN_H
#include "qeglfskmsintegration.h"
-#include "qeglfsscreen.h"
+#include "private/qeglfsscreen_p.h"
#include <QtCore/QList>
#include <QtCore/QMutex>
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
index 7fc4568ae3..1e58b5fdcd 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs-mali-integration
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
# Avoid X11 header collision
DEFINES += MESA_EGL_NO_X11_HEADERS
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp
index ffdb7a686b..cd468c989f 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp
@@ -56,7 +56,7 @@ struct fbdev_window {
void QEglFSMaliIntegration::platformInit()
{
// Keep the non-overridden base class functions based on fb0 working.
- QEGLDeviceIntegration::platformInit();
+ QEglFSDeviceIntegration::platformInit();
int fd = qt_safe_open("/dev/fb0", O_RDWR, 0);
if (fd == -1)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h
index 35a2c64951..56883a3676 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h
@@ -40,11 +40,11 @@
#ifndef QEGLFSMALIINTEGRATION_H
#define QEGLFSMALIINTEGRATION_H
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE
-class QEglFSMaliIntegration : public QEGLDeviceIntegration
+class QEglFSMaliIntegration : public QEglFSDeviceIntegration
{
public:
void platformInit() Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp
index 0754e1af5b..a3c804f54d 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp
@@ -37,18 +37,18 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsmaliintegration.h"
QT_BEGIN_NAMESPACE
-class QEglFSMaliIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSMaliIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_mali.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_mali.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSMaliIntegration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSMaliIntegration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
index 6fac2f529a..a53aac2041 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs-viv-integration
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
CONFIG += egl
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp
index ca97f6c8f9..f2fcc0d3ff 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
void QEglFSVivIntegration::platformInit()
{
- QEGLDeviceIntegration::platformInit();
+ QEglFSDeviceIntegration::platformInit();
int width, height;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h
index 4a8cd5c385..2e98c2b4b1 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h
@@ -40,11 +40,11 @@
#ifndef QEGLFSVIVINTEGRATION_H
#define QEGLFSVIVINTEGRATION_H
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
QT_BEGIN_NAMESPACE
-class QEglFSVivIntegration : public QEGLDeviceIntegration
+class QEglFSVivIntegration : public QEglFSDeviceIntegration
{
public:
void platformInit() Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp
index d1c9fb4086..ebe2091b1e 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp
@@ -37,18 +37,18 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsvivintegration.h"
QT_BEGIN_NAMESPACE
-class QEglFSVivIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSVivIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_viv.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_viv.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSVivIntegration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSVivIntegration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
index 44f75c40e0..38259f4a5d 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs-viv-wl-integration
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
INCLUDEPATH += $$PWD/../..
CONFIG += egl
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp
index 5c113456e4..61e2f17766 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
void QEglFSVivWaylandIntegration::platformInit()
{
- QEGLDeviceIntegration::platformInit();
+ QEglFSDeviceIntegration::platformInit();
int width, height;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h
index 40eacc8f2f..9abbe817a6 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h
@@ -40,12 +40,12 @@
#ifndef QEGLFSVIVINTEGRATION_H
#define QEGLFSVIVINTEGRATION_H
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
struct wl_display;
QT_BEGIN_NAMESPACE
-class QEglFSVivWaylandIntegration : public QEGLDeviceIntegration
+class QEglFSVivWaylandIntegration : public QEglFSDeviceIntegration
{
public:
void platformInit() Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp
index 02ef9c566c..3b26feda07 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp
@@ -37,18 +37,18 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsvivwlintegration.h"
QT_BEGIN_NAMESPACE
-class QEglFSVivWaylandIntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSVivWaylandIntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_viv_wl.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_viv_wl.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSVivWaylandIntegration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSVivWaylandIntegration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
index 83f0c74910..21af6eb736 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs-x11-integration
-QT += core-private gui-private platformsupport-private eglfs_device_lib-private
+QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private
# Avoid X11 header collision
DEFINES += MESA_EGL_NO_X11_HEADERS
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h
index a3d0b01baf..c0f0ee5f22 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h
@@ -40,7 +40,7 @@
#ifndef QEGLFSX11INTEGRATION_H
#define QEGLFSX11INTEGRATION_H
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformwindow.h>
@@ -64,7 +64,7 @@ namespace Atoms {
class EventReader;
-class QEglFSX11Integration : public QEGLDeviceIntegration
+class QEglFSX11Integration : public QEglFSDeviceIntegration
{
public:
QEglFSX11Integration() : m_connection(0), m_window(0), m_eventReader(0) {}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp
index 314a85694b..c15e05b657 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp
@@ -37,18 +37,18 @@
**
****************************************************************************/
-#include "qeglfsdeviceintegration.h"
+#include "private/qeglfsdeviceintegration_p.h"
#include "qeglfsx11integration.h"
QT_BEGIN_NAMESPACE
-class QEglFSX11IntegrationPlugin : public QEGLDeviceIntegrationPlugin
+class QEglFSX11IntegrationPlugin : public QEglFSDeviceIntegrationPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QEGLDeviceIntegrationFactoryInterface_iid FILE "eglfs_x11.json")
+ Q_PLUGIN_METADATA(IID QEglFSDeviceIntegrationFactoryInterface_iid FILE "eglfs_x11.json")
public:
- QEGLDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSX11Integration; }
+ QEglFSDeviceIntegration *create() Q_DECL_OVERRIDE { return new QEglFSX11Integration; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro
index a628cdccd9..90b8a9fb32 100644
--- a/src/plugins/platforms/eglfs/eglfs-plugin.pro
+++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro
@@ -1,6 +1,6 @@
TARGET = qeglfs
-QT += platformsupport-private eglfs_device_lib-private
+QT += platformsupport-private eglfsdeviceintegration-private
SOURCES += $$PWD/qeglfsmain.cpp
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index 03c96ca1d9..d91ffd60a1 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS += eglfs_device_lib.pro
+SUBDIRS += eglfsdeviceintegration.pro
SUBDIRS += eglfs-plugin.pro
SUBDIRS += deviceintegration
diff --git a/src/plugins/platforms/eglfs/eglfs_device_lib.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
index f784020fb6..05f4196728 100644
--- a/src/plugins/platforms/eglfs/eglfs_device_lib.pro
+++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro
@@ -3,8 +3,9 @@
# have to keep the QObject magic like qobject_cast working.
# Hence this header-less, private-only module.
-TARGET = QtEglDeviceIntegration
-CONFIG += no_module_headers internal_module
+TARGET = QtEglFSDeviceIntegration
+CONFIG += internal_module
+MODULE = eglfsdeviceintegration
QT += core-private gui-private platformsupport-private
LIBS += $$QMAKE_LIBS_DYNLOAD
@@ -15,22 +16,14 @@ DEFINES += MESA_EGL_NO_X11_HEADERS
DEFINES += QT_BUILD_EGL_DEVICE_LIB
SOURCES += $$PWD/qeglfsintegration.cpp \
- $$PWD/qeglfswindow.cpp \
- $$PWD/qeglfsscreen.cpp \
- $$PWD/qeglfscursor.cpp \
- $$PWD/qeglfshooks.cpp \
$$PWD/qeglfscontext.cpp \
$$PWD/qeglfsoffscreenwindow.cpp \
- $$PWD/qeglfsdeviceintegration.cpp
HEADERS += $$PWD/qeglfsintegration.h \
- $$PWD/qeglfswindow.h \
- $$PWD/qeglfsscreen.h \
- $$PWD/qeglfscursor.h \
- $$PWD/qeglfshooks.h \
$$PWD/qeglfscontext.h \
$$PWD/qeglfsoffscreenwindow.h \
- $$PWD/qeglfsdeviceintegration.h
+
+include($$PWD/api/api.pri)
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp
index 6acb362bf0..8d479873cf 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp
@@ -43,9 +43,9 @@
#include <QtPlatformSupport/private/qeglpbuffer_p.h>
#include "qeglfscontext.h"
-#include "qeglfswindow.h"
-#include "qeglfshooks.h"
-#include "qeglfscursor.h"
+#include "qeglfswindow_p.h"
+#include "qeglfshooks_p.h"
+#include "qeglfscursor_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index 6f38a96f45..8c8ef99bc2 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -52,11 +52,11 @@
#include <private/qgenericunixthemes_p.h>
#include "qeglfsintegration.h"
-#include "qeglfswindow.h"
-#include "qeglfshooks.h"
+#include "qeglfswindow_p.h"
+#include "qeglfshooks_p.h"
#include "qeglfscontext.h"
#include "qeglfsoffscreenwindow.h"
-#include "qeglfscursor.h"
+#include "qeglfscursor_p.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
@@ -205,7 +205,7 @@ QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLCo
QEglFSContext *ctx;
QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(context->format());
if (nativeHandle.isNull()) {
- EGLConfig config = QEglFSIntegration::chooseConfig(dpy, adjustedFormat);
+ EGLConfig config = QEglFSDeviceIntegration::chooseConfig(dpy, adjustedFormat);
ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant());
} else {
ctx = new QEglFSContext(adjustedFormat, share, dpy, 0, nativeHandle);
@@ -436,22 +436,4 @@ EGLNativeDisplayType QEglFSIntegration::nativeDisplay() const
return qt_egl_device_integration()->platformDisplay();
}
-EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
-{
- class Chooser : public QEglConfigChooser {
- public:
- Chooser(EGLDisplay display)
- : QEglConfigChooser(display) { }
- bool filterConfig(EGLConfig config) const Q_DECL_OVERRIDE {
- return qt_egl_device_integration()->filterConfig(display(), config)
- && QEglConfigChooser::filterConfig(config);
- }
- };
-
- Chooser chooser(display);
- chooser.setSurfaceType(qt_egl_device_integration()->surfaceType());
- chooser.setSurfaceFormat(format);
- return chooser.chooseConfig();
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h
index 678452a8db..9c5439a22f 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.h
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.h
@@ -92,8 +92,6 @@ public:
void addScreen(QPlatformScreen *screen);
void removeScreen(QPlatformScreen *screen);
- static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format);
-
private:
EGLNativeDisplayType nativeDisplay() const;
void createInputHandlers();
diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp
index 11b101970b..0334ac9785 100644
--- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qeglfsoffscreenwindow.h"
-#include "qeglfshooks.h"
+#include "qeglfshooks_p.h"
#include <QtGui/QOffscreenSurface>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro
index 7b0a573ffa..2c85a68f0b 100644
--- a/src/plugins/platforms/ios/ios.pro
+++ b/src/plugins/platforms/ios/ios.pro
@@ -1,7 +1,7 @@
TARGET = qios
QT += core-private gui-private platformsupport-private
-LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AssetsLibrary -framework AudioToolbox
+LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox
OBJECTIVE_SOURCES = \
plugin.mm \
@@ -19,15 +19,9 @@ OBJECTIVE_SOURCES = \
qiosglobal.mm \
qiosservices.mm \
quiview.mm \
- qiosclipboard.mm \
quiaccessibilityelement.mm \
qiosplatformaccessibility.mm \
- qiostextresponder.mm \
- qiosmenu.mm \
- qiosfileengineassetslibrary.mm \
- qiosfiledialog.mm \
- qiosmessagedialog.mm \
- qiostextinputoverlay.mm
+ qiostextresponder.mm
HEADERS = \
qiosintegration.h \
@@ -44,16 +38,28 @@ HEADERS = \
qiosglobal.h \
qiosservices.h \
quiview.h \
- qiosclipboard.h \
quiaccessibilityelement.h \
qiosplatformaccessibility.h \
qiostextresponder.h \
- qiosmenu.h \
- qiosfileenginefactory.h \
- qiosfileengineassetslibrary.h \
- qiosfiledialog.h \
- qiosmessagedialog.h \
- qiostextinputoverlay.h
+ qiosfileenginefactory.h
+
+!tvos {
+ LIBS += -framework AssetsLibrary
+ OBJECTIVE_SOURCES += \
+ qiosclipboard.mm \
+ qiosmenu.mm \
+ qiosfileengineassetslibrary.mm \
+ qiosfiledialog.mm \
+ qiosmessagedialog.mm \
+ qiostextinputoverlay.mm
+ HEADERS += \
+ qiosclipboard.h \
+ qiosmenu.h \
+ qiosfileengineassetslibrary.h \
+ qiosfiledialog.h \
+ qiosmessagedialog.h \
+ qiostextinputoverlay.h
+}
OTHER_FILES = \
quiview_textinput.mm \
diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm
index b854dfdaa0..83760f2f39 100644
--- a/src/plugins/platforms/ios/plugin.mm
+++ b/src/plugins/platforms/ios/plugin.mm
@@ -54,8 +54,10 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin
QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
Q_UNUSED(paramList);
- if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive))
+ if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive)
+ || !system.compare(QLatin1String("tvos"), Qt::CaseInsensitive)) {
return new QIOSIntegration;
+ }
return 0;
}
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm
index 8d82364cc0..f49f81912e 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.mm
+++ b/src/plugins/platforms/ios/qioseventdispatcher.mm
@@ -493,7 +493,7 @@ void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity)
Q_UNUSED(activity);
Q_ASSERT(activity == kCFRunLoopExit);
- if (m_processEventLevel == 1 && !QThreadData::current()->eventLoops.top()->isRunning()) {
+ if (m_processEventLevel == 1 && !currentEventLoop()->isRunning()) {
qEventDispatcherDebug() << "Root runloop level exited";
interruptEventLoopExec();
}
diff --git a/src/plugins/platforms/ios/qiosfileenginefactory.h b/src/plugins/platforms/ios/qiosfileenginefactory.h
index b71fa64460..87665ac603 100644
--- a/src/plugins/platforms/ios/qiosfileenginefactory.h
+++ b/src/plugins/platforms/ios/qiosfileenginefactory.h
@@ -51,8 +51,12 @@ public:
{
static QLatin1String assetsScheme("assets-library:");
+#ifndef Q_OS_TVOS
if (fileName.toLower().startsWith(assetsScheme))
return new QIOSFileEngineAssetsLibrary(fileName);
+#else
+ Q_UNUSED(fileName);
+#endif
return 0;
}
diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h
index 0fe81ceb91..50bedd7b28 100644
--- a/src/plugins/platforms/ios/qiosglobal.h
+++ b/src/plugins/platforms/ios/qiosglobal.h
@@ -61,13 +61,10 @@ class QPlatformScreen;
bool isQtApplication();
-CGRect toCGRect(const QRectF &rect);
-QRectF fromCGRect(const CGRect &rect);
-CGPoint toCGPoint(const QPointF &point);
-QPointF fromCGPoint(const CGPoint &point);
-
+#ifndef Q_OS_TVOS
Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation);
UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation);
+#endif
int infoPlistValue(NSString* key, int defaultValue);
diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm
index c2f3d6b9e1..7ca3c66971 100644
--- a/src/plugins/platforms/ios/qiosglobal.mm
+++ b/src/plugins/platforms/ios/qiosglobal.mm
@@ -58,26 +58,7 @@ bool isQtApplication()
return isQt;
}
-CGRect toCGRect(const QRectF &rect)
-{
- return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
-}
-
-QRectF fromCGRect(const CGRect &rect)
-{
- return QRectF(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
-}
-
-CGPoint toCGPoint(const QPointF &point)
-{
- return CGPointMake(point.x(), point.y());
-}
-
-QPointF fromCGPoint(const CGPoint &point)
-{
- return QPointF(point.x, point.y);
-}
-
+#ifndef Q_OS_TVOS
Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation)
{
Qt::ScreenOrientation qtOrientation;
@@ -124,6 +105,7 @@ UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation)
}
return uiOrientation;
}
+#endif
int infoPlistValue(NSString* key, int defaultValue)
{
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index ef93d68cf0..c6cbb9b101 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -117,6 +117,7 @@ static QUIView *focusView()
self.cancelsTouchesInView = NO;
self.delaysTouchesEnded = NO;
+#ifndef Q_OS_TVOS
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
@@ -134,6 +135,7 @@ static QUIView *focusView()
[notificationCenter addObserver:self
selector:@selector(keyboardDidChangeFrame:)
name:UIKeyboardDidChangeFrameNotification object:nil];
+#endif
}
return self;
@@ -377,6 +379,9 @@ void QIOSInputContext::clearCurrentFocusObject()
void QIOSInputContext::updateKeyboardState(NSNotification *notification)
{
+#ifdef Q_OS_TVOS
+ Q_UNUSED(notification);
+#else
static CGRect currentKeyboardRect = CGRectZero;
KeyboardState previousState = m_keyboardState;
@@ -412,7 +417,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification)
m_keyboardState.animationDuration = [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
m_keyboardState.keyboardAnimating = m_keyboardState.animationDuration > 0 && !atEndOfKeyboardTransition;
- qImDebug() << qPrintable(QString::fromNSString(notification.name)) << "from" << fromCGRect(frameBegin) << "to" << fromCGRect(frameEnd)
+ qImDebug() << qPrintable(QString::fromNSString(notification.name)) << "from" << QRectF::fromCGRect(frameBegin) << "to" << QRectF::fromCGRect(frameEnd)
<< "(curve =" << m_keyboardState.animationCurve << "duration =" << m_keyboardState.animationDuration << "s)";
} else {
qImDebug("No notification to update keyboard state based on, just updating keyboard rect");
@@ -421,7 +426,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification)
if (!focusView() || CGRectIsEmpty(currentKeyboardRect))
m_keyboardState.keyboardRect = QRectF();
else // QInputmethod::keyboardRectangle() is documented to be in window coordinates.
- m_keyboardState.keyboardRect = fromCGRect([focusView() convertRect:currentKeyboardRect fromView:nil]);
+ m_keyboardState.keyboardRect = QRectF::fromCGRect([focusView() convertRect:currentKeyboardRect fromView:nil]);
// Emit for all changed properties
if (m_keyboardState.keyboardVisible != previousState.keyboardVisible)
@@ -430,6 +435,7 @@ void QIOSInputContext::updateKeyboardState(NSNotification *notification)
emitAnimatingChanged();
if (m_keyboardState.keyboardRect != previousState.keyboardRect)
emitKeyboardRectChanged();
+#endif
}
bool QIOSInputContext::isInputPanelVisible() const
@@ -549,7 +555,11 @@ void QIOSInputContext::scroll(int y)
if (keyboardScrollIsActive && !originalWindowLevels.contains(window))
originalWindowLevels.insert(window, window.windowLevel);
+#ifndef Q_OS_TVOS
UIWindowLevel windowLevelAdjustment = keyboardScrollIsActive ? UIWindowLevelStatusBar : 0;
+#else
+ UIWindowLevel windowLevelAdjustment = 0;
+#endif
window.windowLevel = originalWindowLevels.value(window) + windowLevelAdjustment;
if (!keyboardScrollIsActive)
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index a50d9aa571..36c3bbf6f1 100644
--- a/src/plugins/platforms/ios/qiosintegration.h
+++ b/src/plugins/platforms/ios/qiosintegration.h
@@ -46,7 +46,9 @@
#include "qiosapplicationstate.h"
#include "qiosfileenginefactory.h"
+#ifndef Q_OS_TVOS
#include "qiostextinputoverlay.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -102,14 +104,18 @@ public:
private:
QPlatformFontDatabase *m_fontDatabase;
+#ifndef Q_OS_TVOS
QPlatformClipboard *m_clipboard;
+#endif
QPlatformInputContext *m_inputContext;
QTouchDevice *m_touchDevice;
QIOSApplicationState m_applicationState;
QIOSServices *m_platformServices;
mutable QPlatformAccessibility *m_accessibility;
QIOSFileEngineFactory m_fileEngineFactory;
+#ifndef Q_OS_TVOS
QIOSTextInputOverlay m_textInputOverlay;
+#endif
bool m_debugWindowManagement;
};
@@ -117,4 +123,3 @@ private:
QT_END_NAMESPACE
#endif
-
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index fa12d54b28..297b549ec2 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -45,7 +45,9 @@
#include "qiosscreen.h"
#include "qiosplatformaccessibility.h"
#include "qioscontext.h"
+#ifndef Q_OS_TVOS
#include "qiosclipboard.h"
+#endif
#include "qiosinputcontext.h"
#include "qiostheme.h"
#include "qiosservices.h"
@@ -72,7 +74,9 @@ QIOSIntegration *QIOSIntegration::instance()
QIOSIntegration::QIOSIntegration()
: m_fontDatabase(new QCoreTextFontDatabase)
+#ifndef Q_OS_TVOS
, m_clipboard(new QIOSClipboard)
+#endif
, m_inputContext(0)
, m_platformServices(new QIOSServices)
, m_accessibility(0)
@@ -127,8 +131,10 @@ QIOSIntegration::~QIOSIntegration()
delete m_fontDatabase;
m_fontDatabase = 0;
+#ifndef Q_OS_TVOS
delete m_clipboard;
m_clipboard = 0;
+#endif
QMacInternalPasteboardMime::destroyMimeTypes();
delete m_inputContext;
@@ -217,7 +223,11 @@ QPlatformFontDatabase * QIOSIntegration::fontDatabase() const
QPlatformClipboard *QIOSIntegration::clipboard() const
{
+#ifndef Q_OS_TVOS
return m_clipboard;
+#else
+ return 0;
+#endif
}
QPlatformInputContext *QIOSIntegration::inputContext() const
diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm
index db1b5b8cc8..d5211cdd8a 100644
--- a/src/plugins/platforms/ios/qiosmenu.mm
+++ b/src/plugins/platforms/ios/qiosmenu.mm
@@ -570,7 +570,7 @@ void QIOSMenu::repositionMenu()
switch (m_effectiveMenuType) {
case EditMenu: {
UIView *view = reinterpret_cast<UIView *>(m_parentWindow->winId());
- [[UIMenuController sharedMenuController] setTargetRect:toCGRect(m_targetRect) inView:view];
+ [[UIMenuController sharedMenuController] setTargetRect:m_targetRect.toCGRect() inView:view];
[[UIMenuController sharedMenuController] setMenuVisible:YES animated:YES];
break; }
default:
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index bfd22abaa4..246f04b8dc 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -120,21 +120,25 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
self = [super init];
if (self) {
m_screen = screen;
+#ifndef Q_OS_TVOS
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(orientationChanged:)
name:@"UIDeviceOrientationDidChangeNotification" object:nil];
+#endif
}
return self;
}
- (void)dealloc
{
+#ifndef Q_OS_TVOS
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:@"UIDeviceOrientationDidChangeNotification" object:nil];
+#endif
[super dealloc];
}
@@ -227,9 +231,11 @@ void QIOSScreen::updateProperties()
QRect previousGeometry = m_geometry;
QRect previousAvailableGeometry = m_availableGeometry;
- m_geometry = fromCGRect(m_uiScreen.bounds).toRect();
- m_availableGeometry = fromCGRect(m_uiScreen.applicationFrame).toRect();
+ m_geometry = QRectF::fromCGRect(m_uiScreen.bounds).toRect();
+ m_availableGeometry = QSysInfo::MacintoshVersion & QSysInfo::MV_IOS ?
+ QRectF::fromCGRect(m_uiScreen.applicationFrame).toRect() : m_geometry;
+#ifndef Q_OS_TVOS
if (m_uiScreen == [UIScreen mainScreen]) {
Qt::ScreenOrientation statusBarOrientation = toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation));
@@ -257,6 +263,7 @@ void QIOSScreen::updateProperties()
m_availableGeometry = transform.mapRect(m_availableGeometry);
}
}
+#endif
if (m_geometry != previousGeometry) {
QRectF physicalGeometry;
@@ -269,7 +276,7 @@ void QIOSScreen::updateProperties()
// before being output on the physical display. We have to take this into account when
// computing the physical size. Note that unlike the native bounds, the physical size
// follows the primary orientation of the screen.
- physicalGeometry = mapBetween(nativeOrientation(), primaryOrientation, fromCGRect(m_uiScreen.nativeBounds).toRect());
+ physicalGeometry = mapBetween(nativeOrientation(), primaryOrientation, QRectF::fromCGRect(m_uiScreen.nativeBounds).toRect());
} else {
physicalGeometry = QRectF(0, 0, m_geometry.width() * devicePixelRatio(), m_geometry.height() * devicePixelRatio());
}
@@ -335,7 +342,7 @@ qreal QIOSScreen::devicePixelRatio() const
Qt::ScreenOrientation QIOSScreen::nativeOrientation() const
{
CGRect nativeBounds =
-#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
+#if !defined(Q_OS_TVOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0 ? m_uiScreen.nativeBounds :
#endif
m_uiScreen.bounds;
@@ -348,6 +355,9 @@ Qt::ScreenOrientation QIOSScreen::nativeOrientation() const
Qt::ScreenOrientation QIOSScreen::orientation() const
{
+#ifdef Q_OS_TVOS
+ return Qt::PrimaryOrientation;
+#else
// Auxiliary screens are always the same orientation as their primary orientation
if (m_uiScreen != [UIScreen mainScreen])
return Qt::PrimaryOrientation;
@@ -372,6 +382,7 @@ Qt::ScreenOrientation QIOSScreen::orientation() const
}
return toQtScreenOrientation(deviceOrientation);
+#endif
}
void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask)
diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm
index 733367f3be..ff260d02dc 100644
--- a/src/plugins/platforms/ios/qiostextinputoverlay.mm
+++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm
@@ -136,7 +136,7 @@ static void executeBlockWithoutAnimation(Block block)
// first responder, which is normally QIOSTextResponder.
QRectF cr = qApp->inputMethod()->cursorRectangle();
QRectF ar = qApp->inputMethod()->anchorRectangle();
- CGRect targetRect = toCGRect(cr.united(ar));
+ CGRect targetRect = cr.united(ar).toCGRect();
UIView *focusView = reinterpret_cast<UIView *>(qApp->focusWindow()->winId());
[[UIMenuController sharedMenuController] setTargetRect:targetRect inView:focusView];
[[UIMenuController sharedMenuController] setMenuVisible:YES animated:YES];
@@ -496,12 +496,12 @@ static void executeBlockWithoutAnimation(Block block)
QGuiApplication::styleHints()->setCursorFlashTime(0);
if (!_loupeLayer)
[self createLoupe];
- [self updateFocalPoint:fromCGPoint(_lastTouchPoint)];
+ [self updateFocalPoint:QPointF::fromCGPoint(_lastTouchPoint)];
_loupeLayer.visible = YES;
break;
case UIGestureRecognizerStateChanged:
// Tell the sub class to move the loupe to the correct position
- [self updateFocalPoint:fromCGPoint(_lastTouchPoint)];
+ [self updateFocalPoint:QPointF::fromCGPoint(_lastTouchPoint)];
break;
case UIGestureRecognizerStateEnded:
// Restore cursor blinking, and hide the loupe
@@ -526,12 +526,12 @@ static void executeBlockWithoutAnimation(Block block)
- (QPointF)focalPoint
{
- return fromCGPoint([_loupeLayer.targetView convertPoint:_loupeLayer.focalPoint toView:_focusView]);
+ return QPointF::fromCGPoint([_loupeLayer.targetView convertPoint:_loupeLayer.focalPoint toView:_focusView]);
}
- (void)setFocalPoint:(QPointF)point
{
- _loupeLayer.focalPoint = [_loupeLayer.targetView convertPoint:toCGPoint(point) fromView:_focusView];
+ _loupeLayer.focalPoint = [_loupeLayer.targetView convertPoint:point.toCGPoint() fromView:_focusView];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
@@ -548,7 +548,7 @@ static void executeBlockWithoutAnimation(Block block)
// If the touch point is accepted by the sub class (e.g touch on cursor), we start a
// press'n'hold timer that eventually will move the state to UIGestureRecognizerStateBegan.
- if ([self acceptTouchesBegan:fromCGPoint(_firstTouchPoint)])
+ if ([self acceptTouchesBegan:QPointF::fromCGPoint(_firstTouchPoint)])
_triggerStateBeganTimer.start();
else
self.state = UIGestureRecognizerStateFailed;
@@ -856,8 +856,8 @@ static void executeBlockWithoutAnimation(Block block)
// Adjust handles and input rect to match the new selection
QRectF inputRect = QGuiApplication::inputMethod()->inputItemClipRectangle();
- CGRect cursorRect = toCGRect(QGuiApplication::inputMethod()->cursorRectangle());
- CGRect anchorRect = toCGRect(QGuiApplication::inputMethod()->anchorRectangle());
+ CGRect cursorRect = QGuiApplication::inputMethod()->cursorRectangle().toCGRect();
+ CGRect anchorRect = QGuiApplication::inputMethod()->anchorRectangle().toCGRect();
if (!_multiLine) {
// Resize the layer a bit bigger to ensure that the handles are
@@ -866,7 +866,7 @@ static void executeBlockWithoutAnimation(Block block)
inputRect.adjust(-margin / 2, -margin, margin / 2, margin);
}
- executeBlockWithoutAnimation(^{ _clipRectLayer.frame = toCGRect(inputRect); });
+ executeBlockWithoutAnimation(^{ _clipRectLayer.frame = inputRect.toCGRect(); });
_cursorLayer.cursorRectangle = [self.focusView.layer convertRect:cursorRect toLayer:_clipRectLayer];
_anchorLayer.cursorRectangle = [self.focusView.layer convertRect:anchorRect toLayer:_clipRectLayer];
_cursorLayer.visible = YES;
@@ -934,7 +934,7 @@ static void executeBlockWithoutAnimation(Block block)
}
QRectF inputRect = QGuiApplication::inputMethod()->inputItemClipRectangle();
- QPointF touchPos = fromCGPoint([static_cast<UITouch *>([touches anyObject]) locationInView:_focusView]);
+ QPointF touchPos = QPointF::fromCGPoint([static_cast<UITouch *>([touches anyObject]) locationInView:_focusView]);
if (!inputRect.contains(touchPos))
self.state = UIGestureRecognizerStateFailed;
@@ -943,7 +943,7 @@ static void executeBlockWithoutAnimation(Block block)
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
- QPointF touchPos = fromCGPoint([static_cast<UITouch *>([touches anyObject]) locationInView:_focusView]);
+ QPointF touchPos = QPointF::fromCGPoint([static_cast<UITouch *>([touches anyObject]) locationInView:_focusView]);
const QTransform mapToLocal = QGuiApplication::inputMethod()->inputItemTransform().inverted();
int cursorPosOnRelease = QInputMethod::queryFocusObject(Qt::ImCursorPosition, touchPos * mapToLocal).toInt();
diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm
index 37d5557794..5ec05ec8ce 100644
--- a/src/plugins/platforms/ios/qiostextresponder.mm
+++ b/src/plugins/platforms/ios/qiostextresponder.mm
@@ -680,11 +680,7 @@
if (markedTextFormat.isEmpty()) {
// There seems to be no way to query how the preedit text
// should be drawn. So we need to hard-code the color.
- QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion;
- if (iosVersion < QSysInfo::MV_IOS_7_0)
- markedTextFormat.setBackground(QColor(235, 239, 247));
- else
- markedTextFormat.setBackground(QColor(206, 221, 238));
+ markedTextFormat.setBackground(QColor(206, 221, 238));
}
QList<QInputMethodEvent::Attribute> attrs;
@@ -812,7 +808,7 @@
[self sendEventToFocusObject:e];
}
- return toCGRect(startRect.united(endRect));
+ return startRect.united(endRect).toCGRect();
}
- (NSArray *)selectionRectsForRange:(UITextRange *)range
@@ -830,7 +826,7 @@
// Assume for now that position is always the same as
// cursor index until a better API is in place:
QRectF cursorRect = qApp->inputMethod()->cursorRectangle();
- return toCGRect(cursorRect);
+ return cursorRect.toCGRect();
}
- (void)replaceRange:(UITextRange *)range withText:(NSString *)text
@@ -897,6 +893,7 @@
// text instead of just guessing...
}
+#ifndef Q_OS_TVOS
- (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction
{
Q_UNUSED(position);
@@ -916,6 +913,7 @@
return [NSDictionary dictionary];
return [NSDictionary dictionaryWithObject:uifont forKey:UITextInputTextFontKey];
}
+#endif
- (NSDictionary *)markedTextStyle
{
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index 486c146af9..83a8176478 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -51,9 +51,11 @@
#include <UIKit/UIFont.h>
#include <UIKit/UIInterface.h>
+#ifndef Q_OS_TVOS
#include "qiosmenu.h"
#include "qiosfiledialog.h"
#include "qiosmessagedialog.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -80,12 +82,20 @@ const QPalette *QIOSTheme::palette(QPlatformTheme::Palette type) const
QPlatformMenuItem* QIOSTheme::createPlatformMenuItem() const
{
+#ifdef Q_OS_TVOS
+ return 0;
+#else
return new QIOSMenuItem();
+#endif
}
QPlatformMenu* QIOSTheme::createPlatformMenu() const
{
+#ifdef Q_OS_TVOS
+ return 0;
+#else
return new QIOSMenu();
+#endif
}
bool QIOSTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
@@ -102,12 +112,14 @@ bool QIOSTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
QPlatformDialogHelper *QIOSTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const
{
switch (type) {
+#ifndef Q_OS_TVOS
case FileDialog:
return new QIOSFileDialog();
break;
case MessageDialog:
return new QIOSMessageDialog();
break;
+#endif
default:
return 0;
}
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.h b/src/plugins/platforms/ios/qiosviewcontroller.h
index e97aeb32ed..92c4e59d1a 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.h
+++ b/src/plugins/platforms/ios/qiosviewcontroller.h
@@ -46,12 +46,16 @@ class QIOSScreen;
- (id)initWithQIOSScreen:(QIOSScreen *)screen;
- (void)updateProperties;
+#ifndef Q_OS_TVOS
@property (nonatomic, assign) UIInterfaceOrientation lockedOrientation;
+#endif
// UIViewController
@property (nonatomic, assign) BOOL prefersStatusBarHidden;
+#ifndef Q_OS_TVOS
@property (nonatomic, assign) UIStatusBarAnimation preferredStatusBarUpdateAnimation;
@property (nonatomic, assign) UIStatusBarStyle preferredStatusBarStyle;
+#endif
@end
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm
index 2acb247572..c8c07bd298 100644
--- a/src/plugins/platforms/ios/qiosviewcontroller.mm
+++ b/src/plugins/platforms/ios/qiosviewcontroller.mm
@@ -37,6 +37,7 @@
**
****************************************************************************/
+#include "qiosglobal.h"
#import "qiosviewcontroller.h"
#include <QtCore/qscopedvaluerollback.h>
@@ -233,33 +234,16 @@
if (self = [self init]) {
m_screen = screen;
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_7_0)
- QSysInfo::MacVersion iosVersion = QSysInfo::MacintoshVersion;
-
- // We prefer to keep the root viewcontroller in fullscreen layout, so that
- // we don't have to compensate for the viewcontroller position. This also
- // gives us the same behavior on iOS 5/6 as on iOS 7, where full screen layout
- // is the only way.
- if (iosVersion < QSysInfo::MV_IOS_7_0)
- self.wantsFullScreenLayout = YES;
-
- // Use translucent statusbar by default on iOS6 iPhones (unless the user changed
- // the default in the Info.plist), so that windows placed under the stausbar are
- // still visible, just like on iOS7.
- if (screen->uiScreen() == [UIScreen mainScreen]
- && iosVersion >= QSysInfo::MV_IOS_6_0 && iosVersion < QSysInfo::MV_IOS_7_0
- && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone
- && [UIApplication sharedApplication].statusBarStyle == UIStatusBarStyleDefault)
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
-#endif
- self.lockedOrientation = UIInterfaceOrientationUnknown;
self.changingOrientation = NO;
+#ifndef Q_OS_TVOS
+ self.lockedOrientation = UIInterfaceOrientationUnknown;
// Status bar may be initially hidden at startup through Info.plist
self.prefersStatusBarHidden = infoPlistValue(@"UIStatusBarHidden", false);
self.preferredStatusBarUpdateAnimation = UIStatusBarAnimationNone;
self.preferredStatusBarStyle = UIStatusBarStyle(infoPlistValue(@"UIStatusBarStyle", UIStatusBarStyleDefault));
+#endif
m_focusWindowChangeConnection = QObject::connect(qApp, &QGuiApplication::focusWindowChanged, [self]() {
[self updateProperties];
@@ -284,6 +268,7 @@
{
[super viewDidLoad];
+#ifndef Q_OS_TVOS
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(willChangeStatusBarFrame:)
name:UIApplicationWillChangeStatusBarFrameNotification
@@ -292,6 +277,7 @@
[center addObserver:self selector:@selector(didChangeStatusBarOrientation:)
name:UIApplicationDidChangeStatusBarOrientationNotification
object:[UIApplication sharedApplication]];
+#endif
}
- (void)viewDidUnload
@@ -304,10 +290,13 @@
- (BOOL)shouldAutorotate
{
+#ifndef Q_OS_TVOS
return m_screen && m_screen->uiScreen() == [UIScreen mainScreen] && !self.lockedOrientation;
+#else
+ return NO;
+#endif
}
-#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_6_0)
- (NSUInteger)supportedInterfaceOrientations
{
// As documented by Apple in the iOS 6.0 release notes, setStatusBarOrientation:animated:
@@ -318,15 +307,6 @@
// supportedInterfaceOrientations says, which states that the method should not return 0.
return [self shouldAutorotate] ? UIInterfaceOrientationMaskAll : 0;
}
-#endif
-
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- Q_UNUSED(interfaceOrientation);
- return [self shouldAutorotate];
-}
-#endif
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
{
@@ -435,6 +415,7 @@
// All decisions are based on the the top level window
focusWindow = qt_window_private(focusWindow)->topLevelWindow();
+#ifndef Q_OS_TVOS
UIApplication *uiApplication = [UIApplication sharedApplication];
// -------------- Status bar style and visbility ---------------
@@ -443,30 +424,16 @@
if (focusWindow->flags() & Qt::MaximizeUsingFullscreenGeometryHint)
self.preferredStatusBarStyle = UIStatusBarStyleDefault;
else
- self.preferredStatusBarStyle = QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0 ?
- UIStatusBarStyleLightContent : UIStatusBarStyleBlackTranslucent;
-
- if (self.preferredStatusBarStyle != oldStatusBarStyle) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0)
- [self setNeedsStatusBarAppearanceUpdate];
- else
- [uiApplication setStatusBarStyle:self.preferredStatusBarStyle];
- }
+ self.preferredStatusBarStyle = UIStatusBarStyleLightContent;
+
+ if (self.preferredStatusBarStyle != oldStatusBarStyle)
+ [self setNeedsStatusBarAppearanceUpdate];
bool currentStatusBarVisibility = self.prefersStatusBarHidden;
self.prefersStatusBarHidden = focusWindow->windowState() == Qt::WindowFullScreen;
if (self.prefersStatusBarHidden != currentStatusBarVisibility) {
-#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) {
- [self setNeedsStatusBarAppearanceUpdate];
- } else
-#endif
- {
- [uiApplication setStatusBarHidden:self.prefersStatusBarHidden
- withAnimation:self.preferredStatusBarUpdateAnimation];
- }
-
+ [self setNeedsStatusBarAppearanceUpdate];
[self.view setNeedsLayout];
}
@@ -512,6 +479,7 @@
[UIViewController attemptRotationToDeviceOrientation];
}
}
+#endif
}
@end
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 481d4a06ab..37b8c4a1cb 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -211,7 +211,7 @@ void QIOSWindow::applyGeometry(const QRect &rect)
// The baseclass takes care of persisting this for us.
QPlatformWindow::setGeometry(rect);
- m_view.frame = toCGRect(rect);
+ m_view.frame = rect.toCGRect();
// iOS will automatically trigger -[layoutSubviews:] for resize,
// but not for move, so we force it just in case.
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index e38be68343..bf929667a6 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -44,7 +44,9 @@
#include "qiosviewcontroller.h"
#include "qiostextresponder.h"
#include "qioswindow.h"
+#ifndef Q_OS_TVOS
#include "qiosmenu.h"
+#endif
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qwindow_p.h>
@@ -58,7 +60,7 @@
- (id)initWithQIOSWindow:(QIOSWindow *)window
{
- if (self = [self initWithFrame:toCGRect(window->geometry())])
+ if (self = [self initWithFrame:window->geometry().toCGRect()])
m_qioswindow = window;
m_accessibleElements = [[NSMutableArray alloc] init];
@@ -78,7 +80,9 @@
if (isQtApplication())
self.hidden = YES;
+#ifndef Q_OS_TVOS
self.multipleTouchEnabled = YES;
+#endif
if (QIOSIntegration::instance()->debugWindowManagement()) {
static CGFloat hue = 0.0;
@@ -149,7 +153,7 @@
// from what we end up with after applying window constraints.
QRect requestedGeometry = m_qioswindow->geometry();
- QRect actualGeometry = fromCGRect(self.frame).toRect();
+ QRect actualGeometry = QRectF::fromCGRect(self.frame).toRect();
// Persist the actual/new geometry so that QWindow::geometry() can
// be queried on the resize event.
@@ -184,7 +188,7 @@
QRegion region;
if (m_qioswindow->isExposed()) {
- QSize bounds = fromCGRect(self.layer.bounds).toRect().size();
+ QSize bounds = QRectF::fromCGRect(self.layer.bounds).toRect().size();
Q_ASSERT(m_qioswindow->geometry().size() == bounds);
Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible());
@@ -324,7 +328,8 @@
// Touch positions are expected to be in QScreen global coordinates, and
// as we already have the QWindow positioned at the right place, we can
// just map from the local view position to global coordinates.
- QPoint localViewPosition = fromCGPoint([uiTouch locationInView:self]).toPoint();
+ // tvOS: all touches start at the center of the screen and move from there.
+ QPoint localViewPosition = QPointF::fromCGPoint([uiTouch locationInView:self]).toPoint();
QPoint globalScreenPosition = m_qioswindow->mapToGlobal(localViewPosition);
touchPoint.area = QRectF(globalScreenPosition, QSize(0, 0));
@@ -439,14 +444,24 @@
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
+#ifndef Q_OS_TVOS
// Check first if QIOSMenu should handle the action before continuing up the responder chain
return [QIOSMenu::menuActionTarget() targetForAction:action withSender:sender] != 0;
+#else
+ Q_UNUSED(action)
+ Q_UNUSED(sender)
+ return false;
+#endif
}
- (id)forwardingTargetForSelector:(SEL)selector
{
Q_UNUSED(selector)
+#ifndef Q_OS_TVOS
return QIOSMenu::menuActionTarget();
+#else
+ return nil;
+#endif
}
@end
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
index 1fd2b84e37..6ca651fdf7 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
@@ -412,11 +412,9 @@ QRegion QLinuxFbScreen::doRedraw()
if (!mBlitter)
mBlitter = new QPainter(&mFbScreenImage);
- const QVector<QRect> rects = touched.rects();
mBlitter->setCompositionMode(QPainter::CompositionMode_Source);
-
- for (int i = 0; i < rects.size(); ++i)
- mBlitter->drawImage(rects[i], *mScreenImage, rects[i]);
+ for (const QRect &rect : touched)
+ mBlitter->drawImage(rect, *mScreenImage, rect);
return touched;
}
diff --git a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp
index 465ad355b9..f80d85842a 100644
--- a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp
+++ b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp
@@ -100,7 +100,7 @@ void QMirClientBackingStore::updateTexture()
QRegion fixed;
QRect imageRect = mImage.rect();
- Q_FOREACH (const QRect &rect, mDirty.rects()) {
+ for (const QRect &rect : mDirty) {
// intersect with image rect to be sure
QRect r = imageRect & rect;
@@ -113,7 +113,7 @@ void QMirClientBackingStore::updateTexture()
fixed |= r;
}
- Q_FOREACH (const QRect &rect, fixed.rects()) {
+ for (const QRect &rect : fixed) {
// if the sub-rect is full-width we can pass the image data directly to
// OpenGL instead of copying, since there is no gap between scanlines
if (rect.width() == imageRect.width()) {
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index ed1a81c2b3..a63aacdbfe 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -179,9 +179,8 @@ bool QOffscreenBackingStore::scroll(const QRegion &area, int dx, int dy)
if (m_image.isNull())
return false;
- const QVector<QRect> rects = area.rects();
- for (int i = 0; i < rects.size(); ++i)
- qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy));
+ for (const QRect &rect : area)
+ qt_scrollRectInImage(m_image, rect, QPoint(dx, dy));
return true;
}
diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro
index a5b64636af..454d7f43bd 100644
--- a/src/plugins/platforms/platforms.pro
+++ b/src/plugins/platforms/platforms.pro
@@ -10,10 +10,8 @@ contains(QT_CONFIG, xcb) {
SUBDIRS += xcb
}
-mac {
- ios: SUBDIRS += ios
- else: SUBDIRS += cocoa
-}
+uikit: SUBDIRS += ios
+osx: SUBDIRS += cocoa
win32:!winrt: SUBDIRS += windows
winrt: SUBDIRS += winrt
@@ -37,6 +35,10 @@ contains(QT_CONFIG, directfb) {
contains(QT_CONFIG, linuxfb): SUBDIRS += linuxfb
+freebsd {
+ SUBDIRS += bsdfb
+}
+
haiku {
SUBDIRS += haiku
}
diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
index a08ac2b839..90a09d3087 100644
--- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
+++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp
@@ -97,7 +97,7 @@ void QQnxButtonEventNotifier::start()
m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read);
QObject::connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(updateButtonStates()));
- qButtonDebug() << "successfully connected to Navigator. fd =" << m_fd;
+ qButtonDebug("successfully connected to Navigator. fd = %d", m_fd);
}
void QQnxButtonEventNotifier::updateButtonStates()
@@ -121,7 +121,7 @@ void QQnxButtonEventNotifier::updateButtonStates()
// Ensure data is null terminated
buffer[bytes] = '\0';
- qButtonDebug() << "received PPS message:\n" << buffer;
+ qButtonDebug("received PPS message:\n%s", buffer);
// Process received message
QByteArray ppsData = QByteArray::fromRawData(buffer, bytes);
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index 79ff74b113..ce3a445d7c 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -721,7 +721,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries)
initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED, sizeof(caretEvent));
caretEvent.old_pos = lastCaret;
caretEvent.new_pos = m_caretPosition;
- qInputContextDebug() << "ictrl_dispatch_event caret changed" << lastCaret << m_caretPosition;
+ qInputContextDebug("ictrl_dispatch_event caret changed %d %d", lastCaret, m_caretPosition);
p_ictrl_dispatch_event(&caretEvent.event);
}
}
@@ -914,7 +914,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan
navigation_event_t navEvent;
initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key, sizeof(navEvent));
navEvent.magnitude = 1;
- qInputContextDebug() << "ictrl_dispatch_even navigation" << key;
+ qInputContextDebug("ictrl_dispatch_even navigation %d", key);
p_ictrl_dispatch_event(&navEvent.event);
}
} else {
@@ -927,7 +927,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan
keyEvent.sequence_id = sequenceId;
p_ictrl_dispatch_event(&keyEvent.event);
- qInputContextDebug() << "ictrl_dispatch_even key" << key;
+ qInputContextDebug("ictrl_dispatch_even key %d", key);
}
return true;
@@ -943,7 +943,7 @@ void QQnxInputContext::updateCursorPosition()
QCoreApplication::sendEvent(input, &query);
m_caretPosition = query.value(Qt::ImCursorPosition).toInt();
- qInputContextDebug() << m_caretPosition;
+ qInputContextDebug("%d", m_caretPosition);
}
void QQnxInputContext::endComposition()
@@ -1116,7 +1116,7 @@ int32_t QQnxInputContext::processEvent(event_t *event)
int flags = KEY_SYM_VALID | KEY_CAP_VALID;
if (event->event_id == IMF_KEY_DOWN)
flags |= KEY_DOWN;
- qInputContextDebug() << "EVENT_KEY" << flags << keySym;
+ qInputContextDebug("EVENT_KEY %d %d", flags, keySym);
QQnxScreenEventHandler::injectKeyboardEvent(flags, keySym, modifiers, 0, keyCap);
result = 0;
break;
@@ -1156,7 +1156,7 @@ int32_t QQnxInputContext::onCommitText(spannable_string_t *text, int32_t new_cur
int32_t QQnxInputContext::onDeleteSurroundingText(int32_t left_length, int32_t right_length)
{
- qInputContextDebug() << "L:" << left_length << " R:" << right_length;
+ qInputContextDebug("L: %d R: %d", int(left_length), int(right_length));
QObject *input = qGuiApp->focusObject();
if (!input)
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index 3a0e97af6e..9d38742d6f 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -453,11 +453,11 @@ void QQnxIntegration::createDisplays()
Q_SCREEN_CHECKERROR(result, "Failed to query display attachment");
if (!isAttached) {
- qIntegrationDebug() << "Skipping non-attached display" << i;
+ qIntegrationDebug("Skipping non-attached display %d", i);
continue;
}
- qIntegrationDebug() << "Creating screen for display" << i;
+ qIntegrationDebug("Creating screen for display %d", i);
createDisplay(displays[i], /*isPrimary=*/false);
} // of displays iteration
}
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp
index 4955938a3a..0e16764b79 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp
@@ -63,14 +63,14 @@ bool QQnxNavigatorEventHandler::handleOrientationCheck(int angle)
{
// reply to navigator that (any) orientation is acceptable
// TODO: check if top window flags prohibit orientation change
- qNavigatorEventHandlerDebug() << "angle=" << angle;
+ qNavigatorEventHandlerDebug("angle=%d", angle);
return true;
}
void QQnxNavigatorEventHandler::handleOrientationChange(int angle)
{
// update screen geometry and reply to navigator that we're ready
- qNavigatorEventHandlerDebug() << "angle=" << angle;
+ qNavigatorEventHandlerDebug("angle=%d", angle);
emit rotationChanged(angle);
}
diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp
index 9ccda2d94a..1f630863b7 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp
@@ -91,8 +91,7 @@ void QQnxNavigatorEventNotifier::start()
errno = 0;
m_fd = open(navigatorControlPath, O_RDWR);
if (m_fd == -1) {
- qNavigatorEventNotifierDebug() << "failed to open navigator pps:"
- << strerror(errno);
+ qNavigatorEventNotifierDebug("failed to open navigator pps: %s", strerror(errno));
return;
}
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
index fd1bbc4a85..d5234ca92f 100644
--- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
@@ -79,7 +79,7 @@ bool QQnxNavigatorPps::openPpsConnection()
return false;
}
- qNavigatorDebug() << "successfully connected to Navigator. fd=" << m_fd;
+ qNavigatorDebug("successfully connected to Navigator. fd=%d", m_fd);
return true;
}
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index c9a89def41..a758bdf7f4 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -139,7 +139,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
platformWindow()->adjustBufferSize();
if (window()->requestedFormat().alphaBufferSize() > 0) {
- foreach (const QRect &r, region.rects()) {
+ for (const QRect &r : region) {
// Clear transparent regions
const int bg[] = {
SCREEN_BLIT_COLOR, 0x00000000,
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
index 0fe80d856d..b075690e3d 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
@@ -208,10 +208,9 @@ void QQnxRasterWindow::blitPreviousToCurrent(const QRegion &region, int dx, int
QQnxBuffer &previousBuffer = m_buffers[m_previousBufferIndex];
// Break down region into non-overlapping rectangles
- const QVector<QRect> rects = region.rects();
- for (int i = rects.size() - 1; i >= 0; i--) {
+ for (auto rit = region.rbegin(), rend = region.rend(); rit != rend; ++rit) {
// Clip rectangle to bounds of target
- const QRect rect = rects[i].intersected(currentBuffer.rect());
+ const QRect rect = rit->intersected(currentBuffer.rect());
if (rect.isEmpty())
continue;
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 16ddcd784b..678e83cd57 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -340,11 +340,12 @@ qreal QQnxScreen::refreshRate() const
qWarning("QQnxScreen: Failed to query screen mode. Using default value of 60Hz");
return 60.0;
}
- qScreenDebug() << "screen mode:" << endl
- << " width =" << displayMode.width << endl
- << " height =" << displayMode.height << endl
- << " refresh =" << displayMode.refresh << endl
- << " interlaced =" << displayMode.interlaced;
+ qScreenDebug("screen mode:\n"
+ " width = %u\n"
+ " height = %u\n"
+ " refresh = %u\n"
+ " interlaced = %u",
+ uint(displayMode.width), uint(displayMode.height), uint(displayMode.refresh), uint(displayMode.interlaced));
return static_cast<qreal>(displayMode.refresh);
}
@@ -404,7 +405,7 @@ static bool isOrthogonal(int angle1, int angle2)
void QQnxScreen::setRotation(int rotation)
{
- qScreenDebug() << "orientation =" << rotation;
+ qScreenDebug("orientation = %d", rotation);
// Check if rotation changed
// We only want to rotate if we are the primary screen
if (m_currentRotation != rotation && isPrimaryScreen()) {
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 599d43a8c8..42651732c2 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -147,7 +147,7 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType)
default:
// event ignored
- qScreenEventDebug() << "unknown event" << qnxType;
+ qScreenEventDebug("unknown event %d", qnxType);
return false;
}
diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
index 1174dc6ab3..025c03c058 100644
--- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
+++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp
@@ -164,7 +164,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady()
{
ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1);
- qVirtualKeyboardDebug() << "keyboardMessage size: " << nread;
+ qVirtualKeyboardDebug("keyboardMessage size: %zd", nread);
if (nread < 0){
connect(); // reconnect
return;
@@ -230,7 +230,7 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage()
}
setHeight(newHeight);
- qVirtualKeyboardDebug() << "size=" << newHeight;
+ qVirtualKeyboardDebug("size=%d", newHeight);
}
bool QQnxVirtualKeyboardPps::showKeyboard()
diff --git a/src/plugins/platforms/windows/accessible/accessible.pri b/src/plugins/platforms/windows/accessible/accessible.pri
index 0774d907f2..0e3aacc558 100644
--- a/src/plugins/platforms/windows/accessible/accessible.pri
+++ b/src/plugins/platforms/windows/accessible/accessible.pri
@@ -6,15 +6,13 @@ HEADERS += \
$$PWD/qwindowsaccessibility.h \
$$PWD/comutils.h
-!wince: {
- SOURCES += $$PWD/qwindowsmsaaaccessible.cpp
- HEADERS += $$PWD/qwindowsmsaaaccessible.h
+SOURCES += $$PWD/qwindowsmsaaaccessible.cpp
+HEADERS += $$PWD/qwindowsmsaaaccessible.h
- !mingw: {
- SOURCES += $$PWD/iaccessible2.cpp
- HEADERS += $$PWD/iaccessible2.h
- include(../../../../3rdparty/iaccessible2/iaccessible2.pri)
- }
+!mingw: {
+ SOURCES += $$PWD/iaccessible2.cpp
+ HEADERS += $$PWD/iaccessible2.h
+ include(../../../../3rdparty/iaccessible2/iaccessible2.pri)
}
mingw: LIBS *= -luuid
diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp
index 7655bdf622..1c072c5e2c 100644
--- a/src/plugins/platforms/windows/accessible/comutils.cpp
+++ b/src/plugins/platforms/windows/accessible/comutils.cpp
@@ -170,7 +170,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN
case QVariant::LongLong:
if (out && arg.vt == (VT_CY|VT_BYREF)) {
arg.pcyVal->int64 = qvar.toLongLong();
-#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400
} else if (out && arg.vt == (VT_I8|VT_BYREF)) {
*arg.pllVal = qvar.toLongLong();
} else {
@@ -181,22 +180,11 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN
arg.vt |= VT_BYREF;
}
}
-#else
- } else {
- arg.vt = VT_CY;
- arg.cyVal.int64 = qvar.toLongLong();
- if (out) {
- arg.pcyVal = new CY(arg.cyVal);
- arg.vt |= VT_BYREF;
- }
- }
-#endif
break;
case QVariant::ULongLong:
if (out && arg.vt == (VT_CY|VT_BYREF)) {
arg.pcyVal->int64 = qvar.toULongLong();
-#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400
} else if (out && arg.vt == (VT_UI8|VT_BYREF)) {
*arg.pullVal = qvar.toULongLong();
} else {
@@ -207,18 +195,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN
arg.vt |= VT_BYREF;
}
}
-#else
- } else {
- arg.vt = VT_CY;
- arg.cyVal.int64 = qvar.toULongLong();
- if (out) {
- arg.pcyVal = new CY(arg.cyVal);
- arg.vt |= VT_BYREF;
- }
- }
-
-#endif
-
break;
case QVariant::Bool:
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
index 4a3f0ccb2b..7cf24421f8 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
@@ -56,12 +56,10 @@
#include <QtGui/qguiapplication.h>
#include "qwindowsaccessibility.h"
-#if !defined(Q_OS_WINCE)
-# ifdef Q_CC_MINGW
-# include "qwindowsmsaaaccessible.h"
-# else
-# include "iaccessible2.h"
-# endif
+#ifdef Q_CC_MINGW
+# include "qwindowsmsaaaccessible.h"
+#else
+# include "iaccessible2.h"
#endif
#include "comutils.h"
@@ -74,11 +72,7 @@
#include <winuser.h>
#if !defined(WINABLEAPI)
-# if defined(Q_OS_WINCE)
-# include <bldver.h>
-# else
-# include <winable.h>
-# endif
+# include <winable.h>
#endif
#include <servprov.h>
@@ -86,7 +80,7 @@
#include <comdef.h>
#endif
-#include "../qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -153,10 +147,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
}
}
-#if defined(Q_OS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0
- // There is no user32.lib nor NotifyWinEvent for CE
- return;
-#else
// An event has to be associated with a window,
// so find the first parent that is a widget and that has a WId
QAccessibleInterface *iface = event->accessibleInterface();
@@ -179,7 +169,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
event->type() != QAccessible::ObjectDestroyed) {
::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface));
}
-#endif // Q_OS_WINCE
}
QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface)
@@ -202,11 +191,6 @@ QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface)
*/
IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
{
-#if defined(Q_OS_WINCE)
- Q_UNUSED(acc);
-
- return 0;
-#else
if (!acc)
return 0;
@@ -222,12 +206,10 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
IAccessible *iacc = 0;
wacc->QueryInterface(IID_IAccessible, reinterpret_cast<void **>(&iacc));
return iacc;
-#endif // defined(Q_OS_WINCE)
}
bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{
-#if !defined(Q_OS_WINCE)
if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) {
/* For UI Automation */
} else if (DWORD(lParam) == DWORD(OBJID_CLIENT)) {
@@ -263,12 +245,6 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W
}
}
}
-#else
- Q_UNUSED(hwnd);
- Q_UNUSED(wParam);
- Q_UNUSED(lParam);
- Q_UNUSED(lResult);
-#endif // !defined(Q_OS_WINCE)
return false;
}
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 0e2165cdcb..ff115a2249 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -67,7 +67,7 @@
#endif
-#include "../qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
index 2f8602e320..fd00f8ac8b 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
@@ -43,7 +43,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include <QtCore/qglobal.h>
-#include "../qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/qsharedpointer.h>
#include <QtGui/qaccessible.h>
#ifndef Q_CC_MINGW
diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h
deleted file mode 100644
index 309191537a..0000000000
--- a/src/plugins/platforms/windows/qplatformfunctions_wince.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMFUNCTIONS_WCE_H
-#define QPLATFORMFUNCTIONS_WCE_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is part of the QPA API and is not meant to be used
-// in applications. Usage of this API may make your code
-// source and binary incompatible with future versions of Qt.
-//
-
-#ifdef Q_OS_WINCE
-#include <QtCore/qfunctions_wince.h>
-#define UNDER_NT
-#include <wingdi.h>
-#include <objidl.h>
-
-#ifndef WM_MOUSELEAVE
-# define WM_MOUSELEAVE 0x02A3
-#endif
-
-#ifndef WM_TOUCH
-# define WM_TOUCH 0x0240
-#endif
-
-#ifndef WM_GETOBJECT
-#define WM_GETOBJECT 0x003D
-#endif
-
-#define GetWindowLongPtr GetWindowLong
-#define SetWindowLongPtr SetWindowLong
-#define GWLP_USERDATA GWL_USERDATA
-
-#ifndef CWP_SKIPINVISIBLE
-#define CWP_SKIPINVISIBLE 0x0001
-#define CWP_SKIPTRANSPARENT 0x0004
-#endif
-
-#ifndef CS_OWNDC
-#define CS_OWNDC 0x0020
-#endif
-
-#ifndef HWND_MESSAGE
-#define HWND_MESSAGE 0
-#endif
-
-// Real Value would be 0x40000000, but if we pass this to Windows Embedded Compact
-// he blits it wrongly, so lets not do any harm and define it to 0
-#ifndef CAPTUREBLT
-#define CAPTUREBLT (DWORD)0x0
-#endif
-
-#define SW_SHOWMINIMIZED SW_MINIMIZE
-#define SW_SHOWMINNOACTIVE SW_MINIMIZE
-
-#ifndef CF_DIBV5
-#define CF_DIBV5 17
-#endif
-
-#ifndef WM_MOUSEACTIVATE
-#define WM_MOUSEACTIVATE 0x0021
-#endif
-
-#ifndef WM_CHILDACTIVATE
-#define WM_CHILDACTIVATE 0x0022
-#endif
-
-#ifndef WM_PARENTNOTIFY
-#define WM_PARENTNOTIFY 0x0210
-#endif
-
-#ifndef WM_ENTERIDLE
-#define WM_ENTERIDLE 0x0121
-#endif
-
-#ifndef WM_GETMINMAXINFO
-#define WM_GETMINMAXINFO 0x0024
-#endif
-
-#ifndef WM_WINDOWPOSCHANGING
-#define WM_WINDOWPOSCHANGING 0x0046
-#endif
-
-#ifndef WM_NCMOUSEMOVE
-#define WM_NCMOUSEMOVE 0x00A0
-#endif
-
-#ifndef WM_NCMBUTTONDBLCLK
-#define WM_NCMBUTTONDBLCLK 0x00A
-#endif
-
-#ifndef WM_NCCREATE
-#define WM_NCCREATE 0x0081
-#endif
-
-#ifndef WM_NCCALCSIZE
-#define WM_NCCALCSIZE 0x0083
-#endif
-
-#ifndef WM_NCACTIVATE
-#define WM_NCACTIVATE 0x0086
-#endif
-
-#ifndef WM_NCMOUSELEAVE
-#define WM_NCMOUSELEAVE 0x02A2
-#endif
-
-#ifndef WM_NCLBUTTONDOWN
-#define WM_NCLBUTTONDOWN 0x00A1
-#endif
-
-#ifndef WM_NCLBUTTONUP
-#define WM_NCLBUTTONUP 0x00A2
-#endif
-
-#ifndef WM_NCPAINT
-#define WM_NCPAINT 0x0085
-#endif
-
-#ifndef WM_NCHITTEST
-#define WM_NCHITTEST 0x0084
-#endif
-
-#ifndef WM_THEMECHANGED
-#define WM_THEMECHANGED 0x031A
-#endif
-
-#ifndef WM_DISPLAYCHANGE
-#define WM_DISPLAYCHANGE 0x007E
-#endif
-
-#ifndef VREFRESH
-#define VREFRESH 116
-#endif
-
-#ifndef SM_SWAPBUTTON
-#define SM_SWAPBUTTON 23
-#endif
-
-// application defines
-#define SPI_SETNONCLIENTMETRICS 72
-#define SPI_SETICONTITLELOGFONT 0x0022
-#define WM_ACTIVATEAPP 0x001c
-#define SW_PARENTCLOSING 1
-#define SW_OTHERMAXIMIZED 2
-#define SW_PARENTOPENING 3
-#define SW_OTHERRESTORED 4
-#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam))
-
-// drag n drop
-#ifndef CFSTR_PERFORMEDDROPEFFECT
-#define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect")
-#endif
-
-// QWidget
-#define SW_SHOWMINIMIZED SW_MINIMIZE
-
-// QRegion
-#define ALTERNATE 0
-#define WINDING 1
-
-// QFontEngine
-typedef struct _FIXED {
- WORD fract;
- short value;
-} FIXED;
-
-typedef struct tagPOINTFX {
- FIXED x;
- FIXED y;
-} POINTFX;
-
-typedef struct _MAT2 {
- FIXED eM11;
- FIXED eM12;
- FIXED eM21;
- FIXED eM22;
-} MAT2;
-
-typedef struct _GLYPHMETRICS {
- UINT gmBlackBoxX;
- UINT gmBlackBoxY;
- POINT gmptGlyphOrigin;
- short gmCellIncX;
- short gmCellIncY;
-} GLYPHMETRICS;
-
-typedef struct tagTTPOLYGONHEADER
-{
- DWORD cb;
- DWORD dwType;
- POINTFX pfxStart;
-} TTPOLYGONHEADER;
-
-typedef struct tagTTPOLYCURVE
-{
- WORD wType;
- WORD cpfx;
- POINTFX apfx[1];
-} TTPOLYCURVE;
-
-#define GGO_NATIVE 2
-#define GGO_GLYPH_INDEX 0x0080
-#define TT_PRIM_LINE 1
-#define TT_PRIM_QSPLINE 2
-#define TT_PRIM_CSPLINE 3
-#define ANSI_VAR_FONT 12
-
-#ifndef OleInitialize
-#define OleInitialize(a) 0
-#endif
-
-#ifndef SPI_GETSNAPTODEFBUTTON
-#define SPI_GETSNAPTODEFBUTTON 95
-#endif
-
-#ifndef WS_EX_LAYERED
-#define WS_EX_LAYERED 0x00080000
-#endif
-
-// Clipboard --------------------------------------------------------
-#ifndef WM_CHANGECBCHAIN
-#define WM_CHANGECBCHAIN 0x030D
-#endif
-
-#ifndef WM_DRAWCLIPBOARD
-#define WM_DRAWCLIPBOARD 0x0308
-#endif
-
-#include <QFileInfo>
-
-inline bool IsIconic( HWND /*hWnd*/ )
-{
- return false;
-}
-
-inline int AddFontResourceExW( LPCWSTR name, DWORD /*fl*/, PVOID /*res*/)
-{
- QString fName = QString::fromWCharArray(name);
- QFileInfo fileinfo(fName);
- fName = fileinfo.absoluteFilePath();
- return AddFontResource((LPCWSTR)fName.utf16());
-}
-
-inline bool RemoveFontResourceExW( LPCWSTR /*name*/, DWORD /*fl*/, PVOID /*pdv*/)
-{
- return 0;
-}
-
-inline void OleUninitialize()
-{
-}
-
-inline DWORD GetGlyphOutline( HDC /*hdc*/, UINT /*uChar*/, INT /*fuFormat*/, GLYPHMETRICS * /*lpgm*/,
- DWORD /*cjBuffer*/, LPVOID /*pvBuffer*/, CONST MAT2 * /*lpmat2*/ )
-{
- qFatal("GetGlyphOutline() not supported under Windows CE. Please try using freetype font-rendering, by "
- "passing the command line argument -platform windows:fontengine=freetype to the application.");
- return GDI_ERROR;
-}
-
-inline HWND GetAncestor(HWND hWnd, UINT /*gaFlags*/)
-{
- return GetParent(hWnd);
-}
-
-#ifndef GA_PARENT
-# define GA_PARENT 1
-#endif
-
-#ifndef SPI_SETFONTSMOOTHINGTYPE
-# define SPI_SETFONTSMOOTHINGTYPE 0x200B
-#endif
-#ifndef SPI_GETFONTSMOOTHINGTYPE
-# define SPI_GETFONTSMOOTHINGTYPE 0x200A
-#endif
-#ifndef FE_FONTSMOOTHINGCLEARTYPE
-# define FE_FONTSMOOTHINGCLEARTYPE 0x0002
-#endif
-
-#ifndef DEVICE_FONTTYPE
-#define DEVICE_FONTTYPE 0x0002
-#endif
-
-#ifndef RASTER_FONTTYPE
-#define RASTER_FONTTYPE 0x0001
-#endif
-
-#ifndef WM_DISPLAYCHANGE
-#define WM_DISPLAYCHANGE 0x007E
-#endif
-
-BOOL qt_wince_ChangeClipboardChain(
- HWND hWndRemove, // handle to window to remove
- HWND hWndNewNext // handle to next window
-);
-#define ChangeClipboardChain(a,b) qt_wince_ChangeClipboardChain(a,b);
-
-HWND qt_wince_SetClipboardViewer(
- HWND hWndNewViewer // handle to clipboard viewer window
-);
-#define SetClipboardViewer(a) qt_wince_SetClipboardViewer(a)
-
-/* Shell stock icon IDs
- SHGetStockIconInfo() is not available on CE, but we're using these
- constants in code that is built on CE as well */
- enum
- {
- SIID_INVALID = -1,
- SIID_DOCNOASSOC = 0,
- SIID_FOLDER = 3,
- SIID_FOLDEROPEN = 4,
- SIID_DRIVE35 = 6,
- SIID_DRIVEFIXED = 8,
- SIID_DRIVENET = 9,
- SIID_DRIVECD = 11,
- SIID_HELP = 23,
- SIID_RECYCLER = 31,
- SIID_DRIVEDVD = 59,
- SIID_SHIELD = 77,
- SIID_WARNING = 78,
- SIID_INFO = 79,
- SIID_ERROR = 80
-};
-
-#ifndef SHGSI_LINKOVERLAY
-// Value is wrong, but doesn't matter, not used at runtime
-#define SHGSI_LINKOVERLAY 0
-#endif
-
-#endif // Q_OS_WINCE
-#endif // QPLATFORMFUNCTIONS_WCE_H
diff --git a/src/plugins/platforms/windows/qtwindows_additional.h b/src/plugins/platforms/windows/qtwindows_additional.h
deleted file mode 100644
index 898a09fba7..0000000000
--- a/src/plugins/platforms/windows/qtwindows_additional.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTWINDOWS_ADDITIONAL_H
-#define QTWINDOWS_ADDITIONAL_H
-
-#include <QtCore/QtGlobal> // get compiler define
-#include <QtCore/qt_windows.h>
-
-#ifndef WM_THEMECHANGED
-# define WM_THEMECHANGED 0x031A
-#endif
-
-#ifndef WM_DWMCOMPOSITIONCHANGED
-# define WM_DWMCOMPOSITIONCHANGED 0x31E
-#endif
-
-#ifndef GWL_HWNDPARENT
-# define GWL_HWNDPARENT (-8)
-#endif
-
-/* Complement the definitions and declarations missing
- * when using MinGW or older Windows SDKs. */
-
-#if defined(Q_CC_MINGW)
-# if !defined(ULW_ALPHA)
-# define ULW_ALPHA 0x00000002
-# define LWA_ALPHA 0x00000002
-# endif // !defined(ULW_ALPHA)
-# define SPI_GETFONTSMOOTHINGTYPE 0x200A
-# define FE_FONTSMOOTHINGCLEARTYPE 0x0002
-# define CLEARTYPE_QUALITY 5
-# define SPI_GETDROPSHADOW 0x1024
-# define COLOR_MENUHILIGHT 29
-# define COLOR_MENUBAR 30
-# define CF_DIBV5 17
-
-#if !defined(CO_E_NOT_SUPPORTED)
-#define CO_E_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80004021L)
-#endif
-
-#define IFMETHOD HRESULT STDMETHODCALLTYPE
-#define IFACEMETHODIMP STDMETHODIMP
-#define IFACEMETHODIMP_(type) STDMETHODIMP_(type)
-
-// For accessibility:
-#ifdef __cplusplus
- #define EXTERN_C extern "C"
-#else
- #define EXTERN_C extern
-#endif
-
-#define CHILDID_SELF 0
-#define WM_GETOBJECT 0x003D
-
-#ifndef SHGFI_ADDOVERLAYS // Shell structures for icons.
-typedef struct _SHSTOCKICONINFO
-{
- DWORD cbSize;
- HICON hIcon;
- int iSysImageIndex;
- int iIcon;
- WCHAR szPath[MAX_PATH];
-} SHSTOCKICONINFO;
-
-# define SIID_SHIELD 77
-# define SHGFI_ADDOVERLAYS 0x20
-# define SHGFI_OVERLAYINDEX 0x40
-#endif // SIID_SHIELD
-
-#if !defined(__MINGW64_VERSION_MAJOR)
-
-#define STATE_SYSTEM_HASPOPUP 0x40000000
-#define STATE_SYSTEM_PROTECTED 0x20000000
-
-typedef struct tagUPDATELAYEREDWINDOWINFO {
- DWORD cbSize;
- HDC hdcDst;
- const POINT *pptDst;
- const SIZE *psize;
- HDC hdcSrc;
- const POINT *pptSrc;
- COLORREF crKey;
- const BLENDFUNCTION *pblend;
- DWORD dwFlags;
- const RECT *prcDirty;
-} UPDATELAYEREDWINDOWINFO, *PUPDATELAYEREDWINDOWINFO;
-
-#endif // if !defined(__MINGW64_VERSION_MAJOR)
-
-// OpenGL Pixelformat flags.
-#define PFD_SUPPORT_DIRECTDRAW 0x00002000
-#define PFD_DIRECT3D_ACCELERATED 0x00004000
-#define PFD_SUPPORT_COMPOSITION 0x00008000
-
-// IME.
-#define IMR_CONFIRMRECONVERTSTRING 0x0005
-
-#ifndef MAPVK_VK_TO_CHAR
-# define MAPVK_VK_TO_CHAR 2
-#endif
-
-#endif // if defined(Q_CC_MINGW)
-
-/* Touch is supported from Windows 7 onwards and data structures
- * are present in the Windows SDK's, but not in older MSVC Express
- * versions. */
-
-#if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE)
-
-#define WM_TOUCH 0x0240
-
-typedef struct tagTOUCHINPUT {
- LONG x;
- LONG y;
- HANDLE hSource;
- DWORD dwID;
- DWORD dwFlags;
- DWORD dwMask;
- DWORD dwTime;
- ULONG_PTR dwExtraInfo;
- DWORD cxContact;
- DWORD cyContact;
-} TOUCHINPUT, *PTOUCHINPUT;
-typedef TOUCHINPUT const * PCTOUCHINPUT;
-
-# define TOUCHEVENTF_MOVE 0x0001
-# define TOUCHEVENTF_DOWN 0x0002
-# define TOUCHEVENTF_UP 0x0004
-# define TOUCHEVENTF_INRANGE 0x0008
-# define TOUCHEVENTF_PRIMARY 0x0010
-# define TOUCHEVENTF_NOCOALESCE 0x0020
-# define TOUCHEVENTF_PALM 0x0080
-# define TOUCHINPUTMASKF_CONTACTAREA 0x0004
-# define TOUCHINPUTMASKF_EXTRAINFO 0x0002
-
-#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE)
-
-#ifndef WM_GESTURE
-# define WM_GESTURE 0x0119
-#endif
-
-#endif // QTWINDOWS_ADDITIONAL_H
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index 90008663e7..ec6a8f62ae 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -41,10 +41,19 @@
#ifndef QTWINDOWSGLOBAL_H
#define QTWINDOWSGLOBAL_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/qnamespace.h>
-#ifdef Q_OS_WINCE
-# include "qplatformfunctions_wince.h"
+
+#ifndef WM_DWMCOMPOSITIONCHANGED // MinGW.
+# define WM_DWMCOMPOSITIONCHANGED 0x31E
+#endif
+
+#ifndef WM_TOUCH
+# define WM_TOUCH 0x0240
+#endif
+
+#ifndef WM_GESTURE
+# define WM_GESTURE 0x0119
#endif
QT_BEGIN_NAMESPACE
@@ -158,10 +167,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
return QtWindows::MouseWheelEvent;
-#ifndef Q_OS_WINCE
case WM_WINDOWPOSCHANGING:
return QtWindows::GeometryChangingEvent;
-#endif
case WM_MOVE:
return QtWindows::MoveEvent;
case WM_SHOWWINDOW:
@@ -172,10 +179,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
return QtWindows::ResizeEvent;
case WM_NCCALCSIZE:
return QtWindows::CalculateSize;
-#ifndef Q_OS_WINCE
case WM_NCHITTEST:
return QtWindows::NonClientHitTest;
-#endif // !Q_OS_WINCE
case WM_GETMINMAXINFO:
return QtWindows::QuerySizeHints;
case WM_KEYDOWN: // keyboard event
@@ -243,12 +248,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
return QtWindows::ContextMenu;
#endif
case WM_SYSCOMMAND:
-#ifndef Q_OS_WINCE
if ((wParamIn & 0xfff0) == SC_CONTEXTHELP)
return QtWindows::WhatsThisEvent;
-#endif
break;
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
case WM_QUERYENDSESSION:
return QtWindows::QueryEndSessionApplicationEvent;
case WM_ENDSESSION:
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index 7123ed826d..3b7374dc92 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -87,7 +87,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
QWindowsWindow *rw = QWindowsWindow::windowsWindowOf(window);
Q_ASSERT(rw);
-#ifndef Q_OS_WINCE
const bool hasAlpha = rw->format().hasAlpha();
const Qt::WindowFlags flags = window->flags();
if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) {
@@ -101,21 +100,16 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
POINT ptDst = {r.x(), r.y()};
POINT ptSrc = {0, 0};
BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA};
- if (QWindowsContext::user32dll.updateLayeredWindowIndirect) {
- RECT dirty = {dirtyRect.x(), dirtyRect.y(),
- dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
- UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
- const BOOL result = QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info);
- if (!result)
- qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d),"
- " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(),
- r.width(), r.height(), dirtyRect.width(), dirtyRect.height(),
- dirtyRect.x(), dirtyRect.y());
- } else {
- QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA);
- }
+ RECT dirty = {dirtyRect.x(), dirtyRect.y(),
+ dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
+ UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
+ const BOOL result = UpdateLayeredWindowIndirect(rw->handle(), &info);
+ if (!result)
+ qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d),"
+ " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(),
+ r.width(), r.height(), dirtyRect.width(), dirtyRect.height(),
+ dirtyRect.x(), dirtyRect.y());
} else {
-#endif
const HDC dc = rw->getDC();
if (!dc) {
qErrnoWarning("%s: GetDC failed", __FUNCTION__);
@@ -129,9 +123,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
qErrnoWarning(int(lastError), "%s: BitBlt failed", __FUNCTION__);
}
rw->releaseDC();
-#ifndef Q_OS_WINCE
}
-#endif
// Write image for debug purposes.
if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) {
@@ -175,7 +167,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion &region)
staticRegion &= QRect(0, 0, newimg.width(), newimg.height());
QPainter painter(&newimg);
painter.setCompositionMode(QPainter::CompositionMode_Source);
- foreach (const QRect &rect, staticRegion.rects())
+ for (const QRect &rect : staticRegion)
painter.drawImage(rect, oldimg, rect);
}
@@ -190,10 +182,9 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy)
if (m_image.isNull() || m_image->image().isNull())
return false;
- const QVector<QRect> rects = area.rects();
const QPoint offset(dx, dy);
- for (int i = 0; i < rects.size(); ++i)
- qt_scrollRectInImage(m_image->image(), rects.at(i), offset);
+ for (const QRect &rect : area)
+ qt_scrollRectInImage(m_image->image(), rect, offset);
return true;
}
@@ -207,7 +198,7 @@ void QWindowsBackingStore::beginPaint(const QRegion &region)
QPainter p(&m_image->image());
p.setCompositionMode(QPainter::CompositionMode_Source);
const QColor blank = Qt::transparent;
- foreach (const QRect &r, region.rects())
+ for (const QRect &r : region)
p.fillRect(r, blank);
}
}
@@ -219,8 +210,6 @@ HDC QWindowsBackingStore::getDC() const
return 0;
}
-#ifndef QT_NO_OPENGL
-
QImage QWindowsBackingStore::toImage() const
{
if (m_image.isNull()) {
@@ -230,6 +219,4 @@ QImage QWindowsBackingStore::toImage() const
return m_image.data()->image();
}
-#endif // !QT_NO_OPENGL
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h
index 26c79348a9..46a7fcc676 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.h
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSBACKINGSTORE_H
#define QWINDOWSBACKINGSTORE_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <qpa/qplatformbackingstore.h>
#include <QtCore/QScopedPointer>
@@ -65,9 +65,7 @@ public:
HDC getDC() const;
-#ifndef QT_NO_OPENGL
QImage toImage() const Q_DECL_OVERRIDE;
-#endif
private:
QScopedPointer<QWindowsNativeImage> m_image;
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index d527e07308..21bc9d7377 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -237,8 +237,7 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L
return;
// In rare cases, a clipboard viewer can hang (application crashed,
// suspended by a shell prompt 'Select' or debugger).
- if (QWindowsContext::user32dll.isHungAppWindow
- && QWindowsContext::user32dll.isHungAppWindow(m_nextClipboardViewer)) {
+ if (IsHungAppWindow(m_nextClipboardViewer)) {
qWarning("Cowardly refusing to send clipboard message to hung application...");
return;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index efeb1f5f05..ef0962c2ff 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -51,7 +51,7 @@
#ifndef QT_NO_ACCESSIBILITY
# include "accessible/qwindowsaccessibility.h"
#endif
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
# include <private/qsessionmanager_p.h>
# include "qwindowssessionmanager.h"
#endif
@@ -76,9 +76,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <windowsx.h>
-#ifndef Q_OS_WINCE
-# include <comdef.h>
-#endif
+#include <comdef.h>
QT_BEGIN_NAMESPACE
@@ -99,45 +97,29 @@ int QWindowsContext::verbose = 0;
# define LANG_SYRIAC 0x5a
#endif
-static inline bool useRTL_Extensions(QSysInfo::WinVersion ver)
+static inline bool useRTL_Extensions()
{
- // This is SDK dependent on CE so out of scope for now
- if (QSysInfo::windowsVersion() & QSysInfo::WV_CE_based)
- return false;
- if ((ver & QSysInfo::WV_NT_based) && (ver >= QSysInfo::WV_VISTA)) {
- // Since the IsValidLanguageGroup/IsValidLocale functions always return true on
- // Vista, check the Keyboard Layouts for enabling RTL.
- if (const int nLayouts = GetKeyboardLayoutList(0, 0)) {
- QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]);
- GetKeyboardLayoutList(nLayouts, lpList.data());
- for (int i = 0; i < nLayouts; ++i) {
- switch (PRIMARYLANGID((quintptr)lpList[i])) {
- case LANG_ARABIC:
- case LANG_HEBREW:
- case LANG_FARSI:
- case LANG_SYRIAC:
- return true;
- default:
- break;
- }
+ // Since the IsValidLanguageGroup/IsValidLocale functions always return true on
+ // Vista, check the Keyboard Layouts for enabling RTL.
+ if (const int nLayouts = GetKeyboardLayoutList(0, 0)) {
+ QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]);
+ GetKeyboardLayoutList(nLayouts, lpList.data());
+ for (int i = 0; i < nLayouts; ++i) {
+ switch (PRIMARYLANGID((quintptr)lpList[i])) {
+ case LANG_ARABIC:
+ case LANG_HEBREW:
+ case LANG_FARSI:
+ case LANG_SYRIAC:
+ return true;
+ default:
+ break;
}
}
- return false;
- } // NT/Vista
-#ifndef Q_OS_WINCE
- // Pre-NT: figure out whether a RTL language is installed
- return IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED)
- || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED)
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED)
- || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED);
-#else
+ }
return false;
-#endif
}
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
static inline QWindowsSessionManager *platformSessionManager() {
QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp));
QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager));
@@ -160,13 +142,8 @@ static inline QWindowsSessionManager *platformSessionManager() {
\internal
\ingroup qt-lighthouse-win
*/
-
-#ifndef Q_OS_WINCE
-
QWindowsUser32DLL::QWindowsUser32DLL() :
- setLayeredWindowAttributes(0), updateLayeredWindow(0),
- updateLayeredWindowIndirect(0),
- isHungAppWindow(0), isTouchWindow(0),
+ isTouchWindow(0),
registerTouchWindow(0), unregisterTouchWindow(0),
getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0),
addClipboardFormatListener(0), removeClipboardFormatListener(0),
@@ -177,20 +154,11 @@ QWindowsUser32DLL::QWindowsUser32DLL() :
void QWindowsUser32DLL::init()
{
QSystemLibrary library(QStringLiteral("user32"));
- // MinGW (g++ 3.4.5) accepts only C casts.
- setLayeredWindowAttributes = (SetLayeredWindowAttributes)(library.resolve("SetLayeredWindowAttributes"));
- updateLayeredWindow = (UpdateLayeredWindow)(library.resolve("UpdateLayeredWindow"));
- if (Q_UNLIKELY(!setLayeredWindowAttributes || !updateLayeredWindow))
- qFatal("This version of Windows is not supported (User32.dll is missing the symbols 'SetLayeredWindowAttributes', 'UpdateLayeredWindow').");
-
- updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect"));
- isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow");
setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware");
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
- addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener");
- removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener");
- }
+ addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener");
+ removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener");
+
getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences");
setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences");
}
@@ -208,38 +176,6 @@ bool QWindowsUser32DLL::initTouch()
return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle;
}
-/*!
- \class QWindowsShell32DLL
- \brief Struct that contains dynamically resolved symbols of Shell32.dll.
-
- The stub libraries shipped with the MinGW compiler miss some of the
- functions. They need to be retrieved dynamically.
-
- \sa QWindowsUser32DLL
-
- \internal
- \ingroup qt-lighthouse-win
-*/
-
-QWindowsShell32DLL::QWindowsShell32DLL()
- : sHCreateItemFromParsingName(0)
- , sHGetKnownFolderIDList(0)
- , sHGetStockIconInfo(0)
- , sHGetImageList(0)
- , sHCreateItemFromIDList(0)
-{
-}
-
-void QWindowsShell32DLL::init()
-{
- QSystemLibrary library(QStringLiteral("shell32"));
- sHCreateItemFromParsingName = (SHCreateItemFromParsingName)(library.resolve("SHCreateItemFromParsingName"));
- sHGetKnownFolderIDList = (SHGetKnownFolderIDList)(library.resolve("SHGetKnownFolderIDList"));
- sHGetStockIconInfo = (SHGetStockIconInfo)library.resolve("SHGetStockIconInfo");
- sHGetImageList = (SHGetImageList)library.resolve("SHGetImageList");
- sHCreateItemFromIDList = (SHCreateItemFromIDList)library.resolve("SHCreateItemFromIDList");
-}
-
QWindowsShcoreDLL::QWindowsShcoreDLL()
: getProcessDpiAwareness(0)
, setProcessDpiAwareness(0)
@@ -258,11 +194,8 @@ void QWindowsShcoreDLL::init()
}
QWindowsUser32DLL QWindowsContext::user32dll;
-QWindowsShell32DLL QWindowsContext::shell32dll;
QWindowsShcoreDLL QWindowsContext::shcoredll;
-#endif // !Q_OS_WINCE
-
QWindowsContext *QWindowsContext::m_instance = 0;
/*!
@@ -291,7 +224,7 @@ struct QWindowsContextPrivate {
QWindowsMimeConverter m_mimeConverter;
QWindowsScreenManager m_screenManager;
QSharedPointer<QWindowCreationContext> m_creationContext;
-#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_TABLETEVENT)
QScopedPointer<QWindowsTabletSupport> m_tabletSupport;
#endif
const HRESULT m_oleInitializeResult;
@@ -306,18 +239,14 @@ QWindowsContextPrivate::QWindowsContextPrivate()
, m_eventType(QByteArrayLiteral("windows_generic_MSG"))
, m_lastActiveWindow(0), m_asyncExpose(0)
{
- const QSysInfo::WinVersion ver = QSysInfo::windowsVersion();
-#ifndef Q_OS_WINCE
QWindowsContext::user32dll.init();
- QWindowsContext::shell32dll.init();
QWindowsContext::shcoredll.init();
if (m_mouseHandler.touchDevice() && QWindowsContext::user32dll.initTouch())
m_systemInfo |= QWindowsContext::SI_SupportsTouch;
-#endif // !Q_OS_WINCE
m_displayContext = GetDC(0);
m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY);
- if (useRTL_Extensions(ver)) {
+ if (useRTL_Extensions()) {
m_systemInfo |= QWindowsContext::SI_RTL_Extensions;
m_keyMapper.setUseRTLExtensions(true);
}
@@ -338,7 +267,7 @@ QWindowsContext::QWindowsContext() :
const QByteArray bv = qgetenv("QT_QPA_VERBOSE");
if (!bv.isEmpty())
QLoggingCategory::setFilterRules(QString::fromLocal8Bit(bv));
-#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_TABLETEVENT)
d->m_tabletSupport.reset(QWindowsTabletSupport::create());
qCDebug(lcQpaTablet) << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description());
#endif
@@ -346,7 +275,7 @@ QWindowsContext::QWindowsContext() :
QWindowsContext::~QWindowsContext()
{
-#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_TABLETEVENT)
d->m_tabletSupport.reset(); // Destroy internal window before unregistering classes.
#endif
unregisterWindowClasses();
@@ -371,12 +300,10 @@ bool QWindowsContext::initTouch(unsigned integrationOptions)
if (!touchDevice)
return false;
-#ifndef Q_OS_WINCE
if (!QWindowsContext::user32dll.initTouch()) {
delete touchDevice;
return false;
}
-#endif // !Q_OS_WINCE
if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch))
touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation);
@@ -389,7 +316,7 @@ bool QWindowsContext::initTouch(unsigned integrationOptions)
void QWindowsContext::setTabletAbsoluteRange(int a)
{
-#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_TABLETEVENT)
if (!d->m_tabletSupport.isNull())
d->m_tabletSupport->setAbsoluteRange(a);
#else
@@ -399,19 +326,16 @@ void QWindowsContext::setTabletAbsoluteRange(int a)
int QWindowsContext::processDpiAwareness()
{
-#ifndef Q_OS_WINCE
int result;
if (QWindowsContext::shcoredll.getProcessDpiAwareness
&& SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(NULL, &result))) {
return result;
}
-#endif // !Q_OS_WINCE
return -1;
}
void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness)
{
-#ifndef Q_OS_WINCE
qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness;
if (QWindowsContext::shcoredll.isValid()) {
const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness);
@@ -426,9 +350,6 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA
qErrnoWarning("SetProcessDPIAware() failed");
}
}
-#else // !Q_OS_WINCE
- Q_UNUSED(dpiAwareness)
-#endif
}
QWindowsContext *QWindowsContext::instance()
@@ -559,19 +480,14 @@ QString QWindowsContext::registerWindowClass(QString cname,
if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our list
return cname;
-#ifndef Q_OS_WINCE
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
-#else
- WNDCLASS wc;
-#endif
wc.style = style;
wc.lpfnWndProc = proc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = appInstance;
wc.hCursor = 0;
-#ifndef Q_OS_WINCE
wc.hbrBackground = brush;
if (icon) {
wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
@@ -587,22 +503,10 @@ QString QWindowsContext::registerWindowClass(QString cname,
wc.hIcon = 0;
wc.hIconSm = 0;
}
-#else
- if (icon) {
- wc.hIcon = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
- } else {
- wc.hIcon = 0;
- }
-#endif
wc.lpszMenuName = 0;
wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16());
-#ifndef Q_OS_WINCE
ATOM atom = RegisterClassEx(&wc);
-#else
- ATOM atom = RegisterClass(&wc);
-#endif
-
if (!atom)
qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.",
qPrintable(cname));
@@ -720,28 +624,14 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c
POINT point = screenPoint;
ScreenToClient(*hwnd, &point);
// Returns parent if inside & none matched.
-#ifndef Q_OS_WINCE
const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags);
-#else
-// Under Windows CE we don't use ChildWindowFromPointEx as it's not available
-// and ChildWindowFromPoint does not work properly.
- Q_UNUSED(cwexFlags)
- const HWND child = WindowFromPoint(point);
-#endif
if (!child || child == *hwnd)
return false;
if (QWindowsWindow *window = context->findPlatformWindow(child)) {
*result = window;
*hwnd = child;
-#ifndef Q_OS_WINCE
return true;
-#else
-// WindowFromPoint does not return same handle in two sequential calls, which leads
-// to an endless loop, but calling WindowFromPoint once is good enough.
- return false;
-#endif
}
-#ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT .
// QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible
// full screen windows of other applications that have WS_EX_TRANSPARENT set
// (for example created by screen sharing applications). In that case, try to
@@ -757,7 +647,6 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c
return true;
}
}
-#endif // !Q_OS_WINCE
*hwnd = child;
return true;
}
@@ -784,7 +673,7 @@ QWindowsScreenManager &QWindowsContext::screenManager()
QWindowsTabletSupport *QWindowsContext::tabletSupport() const
{
-#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_TABLETEVENT)
return d->m_tabletSupport.data();
#else
return 0;
@@ -810,7 +699,6 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
HWND_MESSAGE, NULL, static_cast<HINSTANCE>(GetModuleHandle(0)), NULL);
}
-#ifndef Q_OS_WINCE
// Re-engineered from the inline function _com_error::ErrorMessage().
// We cannot use it directly since it uses swprintf_s(), which is not
// present in the MSVCRT.DLL found on Windows XP (QTBUG-35617).
@@ -829,7 +717,6 @@ static inline QString errorMessageFromComError(const _com_error &comError)
return QStringLiteral("IDispatch error #") + QString::number(wCode);
return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16);
}
-#endif // !Q_OS_WINCE
/*!
\brief Common COM error strings.
@@ -894,12 +781,10 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr)
default:
break;
}
-#ifndef Q_OS_WINCE
_com_error error(hr);
result += QByteArrayLiteral(" (");
result += errorMessageFromComError(error);
result += ')';
-#endif // !Q_OS_WINCE
return result;
}
@@ -935,9 +820,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
ClientToScreen(msg.hwnd, &msg.pt);
}
} else {
-#ifndef Q_OS_WINCE
GetCursorPos(&msg.pt);
-#endif
}
// Run the native event filters.
@@ -980,7 +863,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
switch (et) {
case QtWindows::GestureEvent:
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
@@ -1019,11 +902,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
// Pass on to current creation context
if (!platformWindow && !d->m_creationContext.isNull()) {
switch (et) {
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
case QtWindows::QuerySizeHints:
d->m_creationContext->applyToMinMaxInfo(reinterpret_cast<MINMAXINFO *>(lParam));
return true;
-#endif
case QtWindows::ResizeEvent:
d->m_creationContext->obtainedGeometry.setSize(QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
return true;
@@ -1061,7 +942,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::InputMethodKeyEvent:
case QtWindows::InputMethodKeyDownEvent:
case QtWindows::AppCommandEvent:
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
#else
return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result);
@@ -1072,7 +953,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::ResizeEvent:
platformWindow->handleResized(static_cast<int>(wParam));
return true;
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
case QtWindows::QuerySizeHints:
platformWindow->getSizeHints(reinterpret_cast<MINMAXINFO *>(lParam));
return true;// maybe available on some SDKs revisit WM_NCCALCSIZE
@@ -1082,30 +962,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return platformWindow->handleNonClientHitTest(QPoint(msg.pt.x, msg.pt.y), result);
case QtWindows::GeometryChangingEvent:
return platformWindow->QWindowsWindow::handleGeometryChanging(&msg);
-#endif // !Q_OS_WINCE
case QtWindows::ExposeEvent:
return platformWindow->handleWmPaint(hwnd, message, wParam, lParam);
case QtWindows::NonClientMouseEvent:
if (platformWindow->frameStrutEventsEnabled())
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
break;
-/* the mouse tracking on windows already handles the reset of the cursor
- * and does not like somebody else handling it.
- * on WINCE its necessary to handle this event to get the correct cursor
- */
-#ifdef Q_OS_WINCE
- case QtWindows::CursorEvent:
- {
- QWindowsWindow::baseWindowOf(platformWindow->window())->applyCursor();
- return true;
- }
-#endif
case QtWindows::ScrollEvent:
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
#else
return d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result);
@@ -1113,13 +981,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::MouseWheelEvent:
case QtWindows::MouseEvent:
case QtWindows::LeaveEvent:
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
case QtWindows::TouchEvent:
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
@@ -1152,7 +1020,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::CompositionSettingsChanged:
platformWindow->handleCompositionSettingsChanged();
return true;
-#ifndef Q_OS_WINCE
case QtWindows::ActivateWindowEvent:
if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) {
*result = LRESULT(MA_NOACTIVATE);
@@ -1175,7 +1042,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return true;
}
break;
-#endif
#ifndef QT_NO_CONTEXTMENU
case QtWindows::ContextMenu:
return handleContextMenuEvent(platformWindow->window(), msg);
@@ -1186,7 +1052,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return true;
#endif
} break;
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
case QtWindows::QueryEndSessionApplicationEvent: {
QWindowsSessionManager *sessionManager = platformSessionManager();
if (sessionManager->isActive()) { // bogus message from windows
@@ -1226,7 +1092,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
}
return true;
}
-#endif // !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#endif // !defined(QT_NO_SESSIONMANAGER)
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 3559335747..843f7e2ad6 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -41,7 +41,7 @@
#define QWINDOWSCONTEXT_H
#include "qtwindowsglobal.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QScopedPointer>
#include <QtCore/QSharedPointer>
@@ -79,38 +79,23 @@ class QPoint;
class QKeyEvent;
class QTouchDevice;
-#ifndef Q_OS_WINCE
struct QWindowsUser32DLL
{
QWindowsUser32DLL();
inline void init();
inline bool initTouch();
- typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG);
+ typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); // Windows 7
typedef BOOL (WINAPI *RegisterTouchWindow)(HWND, ULONG);
typedef BOOL (WINAPI *UnregisterTouchWindow)(HWND);
typedef BOOL (WINAPI *GetTouchInputInfo)(HANDLE, UINT, PVOID, int);
typedef BOOL (WINAPI *CloseTouchInputHandle)(HANDLE);
- typedef BOOL (WINAPI *SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD);
- typedef BOOL (WINAPI *UpdateLayeredWindow)(HWND, HDC , const POINT *,
- const SIZE *, HDC, const POINT *, COLORREF,
- const BLENDFUNCTION *, DWORD);
- typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *);
- typedef BOOL (WINAPI *IsHungAppWindow)(HWND);
typedef BOOL (WINAPI *SetProcessDPIAware)();
typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND);
typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND);
typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *);
typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD);
- // Functions missing in Q_CC_GNU stub libraries.
- SetLayeredWindowAttributes setLayeredWindowAttributes;
- UpdateLayeredWindow updateLayeredWindow;
-
- // Functions missing in older versions of Windows
- UpdateLayeredWindowIndirect updateLayeredWindowIndirect;
- IsHungAppWindow isHungAppWindow;
-
// Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC).
IsTouchWindow isTouchWindow;
RegisterTouchWindow registerTouchWindow;
@@ -121,7 +106,8 @@ struct QWindowsUser32DLL
// Windows Vista onwards
SetProcessDPIAware setProcessDPIAware;
- // Clipboard listeners, Windows Vista onwards
+ // Clipboard listeners are present on Windows Vista onwards
+ // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5.
AddClipboardFormatListener addClipboardFormatListener;
RemoveClipboardFormatListener removeClipboardFormatListener;
@@ -130,24 +116,6 @@ struct QWindowsUser32DLL
SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences;
};
-struct QWindowsShell32DLL
-{
- QWindowsShell32DLL();
- inline void init();
-
- typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **);
- typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *);
- typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *);
- typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **);
- typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **);
-
- SHCreateItemFromParsingName sHCreateItemFromParsingName;
- SHGetKnownFolderIDList sHGetKnownFolderIDList;
- SHGetStockIconInfo sHGetStockIconInfo;
- SHGetImageList sHGetImageList;
- SHCreateItemFromIDList sHCreateItemFromIDList;
-};
-
// Shell scaling library (Windows 8.1 onwards)
struct QWindowsShcoreDLL {
QWindowsShcoreDLL();
@@ -163,8 +131,6 @@ struct QWindowsShcoreDLL {
GetDpiForMonitor getDpiForMonitor;
};
-#endif // Q_OS_WINCE
-
class QWindowsContext
{
Q_DISABLE_COPY(QWindowsContext)
@@ -236,11 +202,9 @@ public:
QWindowsMimeConverter &mimeConverter() const;
QWindowsScreenManager &screenManager();
QWindowsTabletSupport *tabletSupport() const;
-#ifndef Q_OS_WINCE
+
static QWindowsUser32DLL user32dll;
- static QWindowsShell32DLL shell32dll;
static QWindowsShcoreDLL shcoredll;
-#endif
static QByteArray comErrorString(HRESULT hr);
bool asyncExpose() const;
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index d02648fade..1bebe88df7 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -56,7 +56,7 @@
static bool initResources()
{
-#if !defined (Q_OS_WINCE) && !defined (QT_NO_IMAGEFORMAT_PNG)
+#if !defined (QT_NO_IMAGEFORMAT_PNG)
Q_INIT_RESOURCE(cursors);
#endif
return true;
@@ -143,7 +143,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits,
if (hotSpot.y() < 0)
hotSpot.setY(height / 2);
const int n = qMax(1, width / 8);
-#if !defined(Q_OS_WINCE)
QScopedArrayPointer<uchar> xBits(new uchar[height * n]);
QScopedArrayPointer<uchar> xMask(new uchar[height * n]);
int x = 0;
@@ -164,54 +163,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits,
}
return CreateCursor(GetModuleHandle(0), hotSpot.x(), hotSpot.y(), width, height,
xBits.data(), xMask.data());
-#elif defined(GWES_ICONCURS) // Q_OS_WINCE
- // Windows CE only supports fixed cursor size.
- int sysW = GetSystemMetrics(SM_CXCURSOR);
- int sysH = GetSystemMetrics(SM_CYCURSOR);
- int sysN = qMax(1, sysW / 8);
- uchar* xBits = new uchar[sysH * sysN];
- uchar* xMask = new uchar[sysH * sysN];
- int x = 0;
- for (int i = 0; i < sysH; ++i) {
- if (i >= height) {
- memset(&xBits[x] , 255, sysN);
- memset(&xMask[x] , 0, sysN);
- x += sysN;
- } else {
- int fillWidth = n > sysN ? sysN : n;
- const uchar *bits = bbits.constScanLine(i);
- const uchar *mask = mbits.constScanLine(i);
- for (int j = 0; j < fillWidth; ++j) {
- uchar b = bits[j];
- uchar m = mask[j];
- if (invb)
- b ^= 0xFF;
- if (invm)
- m ^= 0xFF;
- xBits[x] = ~m;
- xMask[x] = b ^ m;
- ++x;
- }
- for (int j = fillWidth; j < sysN; ++j ) {
- xBits[x] = 255;
- xMask[x] = 0;
- ++x;
- }
- }
- }
-
- HCURSOR hcurs = CreateCursor(qWinAppInst(), hotSpot.x(), hotSpot.y(), sysW, sysH,
- xBits, xMask);
- delete [] xBits;
- delete [] xMask;
- return hcurs;
-#else
- Q_UNUSED(n);
- Q_UNUSED(invm);
- Q_UNUSED(invb);
- Q_UNUSED(mbits);
- return 0;
-#endif
}
// Create a cursor from image and mask of the format QImage::Format_Mono.
@@ -252,7 +203,7 @@ static QSize systemCursorSize(const QPlatformScreen *screen = Q_NULLPTR)
return primaryScreenCursorSize;
}
-#if defined (Q_OS_WINCE) || defined (QT_NO_IMAGEFORMAT_PNG)
+#if defined (QT_NO_IMAGEFORMAT_PNG)
static inline QSize standardCursorSize() { return QSize(32, 32); }
@@ -468,7 +419,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor
return QWindowsCursor::PixmapCursor();
}
-#else // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG
+#else // QT_NO_IMAGEFORMAT_PNG
struct QWindowsCustomPngCursor {
Qt::CursorShape shape;
int size;
@@ -526,7 +477,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor
QString::fromLatin1(bestFit->fileName));
return PixmapCursor(rawImage, QPoint(bestFit->hotSpotX, bestFit->hotSpotY));
}
-#endif // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG
+#endif // !QT_NO_IMAGEFORMAT_PNG
struct QWindowsStandardCursorMapping {
Qt::CursorShape shape;
@@ -575,13 +526,8 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const
// Load available standard cursors from resources
const QWindowsStandardCursorMapping *sEnd = standardCursors + sizeof(standardCursors) / sizeof(standardCursors[0]);
for (const QWindowsStandardCursorMapping *s = standardCursors; s < sEnd; ++s) {
- if (s->shape == cursorShape) {
-#ifndef Q_OS_WINCE
+ if (s->shape == cursorShape)
return static_cast<HCURSOR>(LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
-#else
- return LoadCursor(0, s->resource);
-#endif
- }
}
qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cursorShape);
@@ -677,7 +623,6 @@ QPoint QWindowsCursor::mousePosition()
QWindowsCursor::CursorState QWindowsCursor::cursorState()
{
-#ifndef Q_OS_WINCE
enum { cursorShowing = 0x1, cursorSuppressed = 0x2 }; // Windows 8: CURSOR_SUPPRESSED
CURSORINFO cursorInfo;
cursorInfo.cbSize = sizeof(CURSORINFO);
@@ -687,7 +632,6 @@ QWindowsCursor::CursorState QWindowsCursor::cursorState()
if (cursorInfo.flags & cursorSuppressed)
return CursorSuppressed;
}
-#endif // !Q_OS_WINCE
return CursorHidden;
}
@@ -758,7 +702,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const
"...............XXXX....."};
if (m_ignoreDragCursor.isNull()) {
-#if !defined (Q_OS_WINCE)
HCURSOR cursor = LoadCursor(NULL, IDC_NO);
ICONINFO iconInfo = {0, 0, 0, 0, 0};
GetIconInfo(cursor, &iconInfo);
@@ -782,9 +725,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const
DeleteObject(iconInfo.hbmMask);
DeleteObject(iconInfo.hbmColor);
DestroyCursor(cursor);
-#else // !Q_OS_WINCE
- m_ignoreDragCursor = QPixmap(ignoreDragCursorXpmC);
-#endif // !Q_OS_WINCE
}
return m_ignoreDragCursor;
}
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index c0f9235c30..6fff5f9ab1 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSCURSOR_H
#define QWINDOWSCURSOR_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <qpa/qplatformcursor.h>
#include <QtCore/QSharedPointer>
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index d5e5f87e5c..a7106c972b 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -70,300 +70,10 @@
#include <algorithm>
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
// #define USE_NATIVE_COLOR_DIALOG /* Testing purposes only */
-#ifdef Q_CC_MINGW /* Add missing declarations for MinGW */
-
-#ifndef __IShellLibrary_FWD_DEFINED__
-
-/* Constants obtained by running the below stream operator for
- * CLSID, IID on the constants in the Windows SDK libraries. */
-
-static const IID IID_IFileOpenDialog = {0xd57c7288, 0xd4ad, 0x4768, {0xbe, 0x02, 0x9d, 0x96, 0x95, 0x32, 0xd9, 0x60}};
-static const IID IID_IFileSaveDialog = {0x84bccd23, 0x5fde, 0x4cdb,{0xae, 0xa4, 0xaf, 0x64, 0xb8, 0x3d, 0x78, 0xab}};
-#ifdef __MINGW64_VERSION_MAJOR
-static const IID q_IID_IShellItem = {0x43826d1e, 0xe718, 0x42ee, {0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe}};
-#define IID_IShellItem q_IID_IShellItem
-#else
-static const IID IID_IShellItem = {0x43826d1e, 0xe718, 0x42ee, {0xbc, 0x55, 0xa1, 0xe2, 0x61, 0xc3, 0x7b, 0xfe}};
-static const IID IID_IShellItemArray = {0xb63ea76d, 0x1f85, 0x456f, {0xa1, 0x9c, 0x48, 0x15, 0x9e, 0xfa, 0x85, 0x8b}};
-# define LFF_FORCEFILESYSTEM 1
-#endif
-static const IID IID_IFileDialogEvents = {0x973510db, 0x7d7f, 0x452b,{0x89, 0x75, 0x74, 0xa8, 0x58, 0x28, 0xd3, 0x54}};
-static const CLSID CLSID_FileOpenDialog = {0xdc1c5a9c, 0xe88a, 0x4dde, {0xa5, 0xa1, 0x60, 0xf8, 0x2a, 0x20, 0xae, 0xf7}};
-static const CLSID CLSID_FileSaveDialog = {0xc0b4e2f3, 0xba21, 0x4773,{0x8d, 0xba, 0x33, 0x5e, 0xc9, 0x46, 0xeb, 0x8b}};
-
-typedef struct _COMDLG_FILTERSPEC
-{
- LPCWSTR pszName;
- LPCWSTR pszSpec;
-} COMDLG_FILTERSPEC;
-
-
-#define FOS_OVERWRITEPROMPT 0x2
-#define FOS_STRICTFILETYPES 0x4
-#define FOS_NOCHANGEDIR 0x8
-#define FOS_PICKFOLDERS 0x20
-#define FOS_FORCEFILESYSTEM 0x40
-#define FOS_ALLNONSTORAGEITEMS 0x80
-#define FOS_NOVALIDATE 0x100
-#define FOS_ALLOWMULTISELECT 0x200
-#define FOS_PATHMUSTEXIST 0x800
-#define FOS_FILEMUSTEXIST 0x1000
-#define FOS_CREATEPROMPT 0x2000
-#define FOS_SHAREAWARE 0x4000
-#define FOS_NOREADONLYRETURN 0x8000
-#define FOS_NOTESTFILECREATE 0x10000
-#define FOS_HIDEMRUPLACES 0x20000
-#define FOS_HIDEPINNEDPLACES 0x40000
-#define FOS_NODEREFERENCELINKS 0x100000
-#define FOS_DONTADDTORECENT 0x2000000
-#define FOS_FORCESHOWHIDDEN 0x10000000
-#define FOS_DEFAULTNOMINIMODE 0x20000000
-#define FOS_FORCEPREVIEWPANEON 0x40000000
-
-#if __MINGW64_VERSION_MAJOR < 2
-typedef int GETPROPERTYSTOREFLAGS;
-#define GPS_DEFAULT 0x00000000
-#define GPS_HANDLERPROPERTIESONLY 0x00000001
-#define GPS_READWRITE 0x00000002
-#define GPS_TEMPORARY 0x00000004
-#define GPS_FASTPROPERTIESONLY 0x00000008
-#define GPS_OPENSLOWITEM 0x00000010
-#define GPS_DELAYCREATION 0x00000020
-#define GPS_BESTEFFORT 0x00000040
-#define GPS_MASK_VALID 0x0000007F
-#endif
-
-typedef int (QT_WIN_CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
-// message from browser
-#define BFFM_INITIALIZED 1
-#define BFFM_SELCHANGED 2
-#define BFFM_ENABLEOK (WM_USER + 101)
-// Browsing for directory.
-#define BIF_NONEWFOLDERBUTTON 0x0200
-#define BIF_NOTRANSLATETARGETS 0x0400
-#define BIF_BROWSEFORCOMPUTER 0x1000
-#define BIF_BROWSEFORPRINTER 0x2000
-#define BIF_BROWSEINCLUDEFILES 0x4000
-#define BIF_SHAREABLE 0x8000
-
-//the enums
-typedef enum {
- SIATTRIBFLAGS_AND = 0x1,
- SIATTRIBFLAGS_OR = 0x2,
- SIATTRIBFLAGS_APPCOMPAT = 0x3,
- SIATTRIBFLAGS_MASK = 0x3
-} SIATTRIBFLAGS;
-#ifndef __MINGW64_VERSION_MAJOR
-typedef enum {
- SIGDN_NORMALDISPLAY = 0x00000000,
- SIGDN_PARENTRELATIVEPARSING = 0x80018001,
- SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8001c001,
- SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000,
- SIGDN_PARENTRELATIVEEDITING = 0x80031001,
- SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000,
- SIGDN_FILESYSPATH = 0x80058000,
- SIGDN_URL = 0x80068000
-} SIGDN;
-#endif
-typedef enum {
- FDAP_BOTTOM = 0x00000000,
- FDAP_TOP = 0x00000001
-} FDAP;
-typedef enum {
- FDESVR_DEFAULT = 0x00000000,
- FDESVR_ACCEPT = 0x00000001,
- FDESVR_REFUSE = 0x00000002
-} FDE_SHAREVIOLATION_RESPONSE;
-typedef FDE_SHAREVIOLATION_RESPONSE FDE_OVERWRITE_RESPONSE;
-
-//the structs
-typedef struct {
- LPCWSTR pszName;
- LPCWSTR pszSpec;
-} qt_COMDLG_FILTERSPEC;
-typedef struct {
- GUID fmtid;
- DWORD pid;
-} qt_PROPERTYKEY;
-
-typedef struct {
- USHORT cb;
- BYTE abID[1];
-} qt_SHITEMID, *qt_LPSHITEMID;
-typedef struct {
- qt_SHITEMID mkid;
-} qt_ITEMIDLIST, *qt_LPITEMIDLIST;
-typedef const qt_ITEMIDLIST *qt_LPCITEMIDLIST;
-typedef struct {
- HWND hwndOwner;
- qt_LPCITEMIDLIST pidlRoot;
- LPWSTR pszDisplayName;
- LPCWSTR lpszTitle;
- UINT ulFlags;
- BFFCALLBACK lpfn;
- LPARAM lParam;
- int iImage;
-} qt_BROWSEINFO;
-
-#endif // __IShellLibrary_FWD_DEFINED__
-
-#ifndef __IFileDialogEvents_FWD_DEFINED__
-DECLARE_INTERFACE(IFileDialogEvents);
-#endif
-
-#ifndef __IShellItem_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IShellItem, IUnknown)
-{
- STDMETHOD(BindToHandler)(THIS_ IBindCtx *pbc, REFGUID bhid, REFIID riid, void **ppv) PURE;
- STDMETHOD(GetParent)(THIS_ IShellItem **ppsi) PURE;
- STDMETHOD(GetDisplayName)(THIS_ SIGDN sigdnName, LPWSTR *ppszName) PURE;
- STDMETHOD(GetAttributes)(THIS_ ULONG sfgaoMask, ULONG *psfgaoAttribs) PURE;
- STDMETHOD(Compare)(THIS_ IShellItem *psi, DWORD hint, int *piOrder) PURE;
-};
-#endif
-
-#ifndef __IShellItemFilter_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IShellItemFilter, IUnknown)
-{
- STDMETHOD(IncludeItem)(THIS_ IShellItem *psi) PURE;
- STDMETHOD(GetEnumFlagsForItem)(THIS_ IShellItem *psi, DWORD *pgrfFlags) PURE;
-};
-#endif
-
-#ifndef __IEnumShellItems_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IEnumShellItems, IUnknown)
-{
- STDMETHOD(Next)(THIS_ ULONG celt, IShellItem **rgelt, ULONG *pceltFetched) PURE;
- STDMETHOD(Skip)(THIS_ ULONG celt) PURE;
- STDMETHOD(Reset)(THIS_) PURE;
- STDMETHOD(Clone)(THIS_ IEnumShellItems **ppenum) PURE;
-};
-#endif
-
-#ifndef __IShellItemArray_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IShellItemArray, IUnknown)
-{
- STDMETHOD(BindToHandler)(THIS_ IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) PURE;
- STDMETHOD(GetPropertyStore)(THIS_ GETPROPERTYSTOREFLAGS flags, REFIID riid, void **ppv) PURE;
- STDMETHOD(GetPropertyDescriptionList)(THIS_ const qt_PROPERTYKEY *keyType, REFIID riid, void **ppv) PURE;
- STDMETHOD(GetAttributes)(THIS_ SIATTRIBFLAGS dwAttribFlags, ULONG sfgaoMask, ULONG *psfgaoAttribs) PURE;
- STDMETHOD(GetCount)(THIS_ DWORD *pdwNumItems) PURE;
- STDMETHOD(GetItemAt)(THIS_ DWORD dwIndex, IShellItem **ppsi) PURE;
- STDMETHOD(EnumItems)(THIS_ IEnumShellItems **ppenumShellItems) PURE;
-};
-#endif
-
-#ifndef __IShellLibrary_INTERFACE_DEFINED__
-
-enum LIBRARYOPTIONFLAGS {};
-enum DEFAULTSAVEFOLDERTYPE { DSFT_DETECT = 1 };
-enum LIBRARYSAVEFLAGS {};
-
-DECLARE_INTERFACE_(IShellLibrary, IUnknown)
-{
- STDMETHOD(LoadLibraryFromItem)(THIS_ IShellItem *psiLibrary, DWORD grfMode) PURE;
- STDMETHOD(LoadLibraryFromKnownFolder)(THIS_ const GUID &kfidLibrary, DWORD grfMode) PURE;
- STDMETHOD(AddFolder)(THIS_ IShellItem *psiLocation) PURE;
- STDMETHOD(RemoveFolder)(THIS_ IShellItem *psiLocation) PURE;
- STDMETHOD(GetFolders)(THIS_ int lff, REFIID riid, void **ppv) PURE;
- STDMETHOD(ResolveFolder)(THIS_ IShellItem *psiFolderToResolve, DWORD dwTimeout, REFIID riid, void **ppv) PURE;
- STDMETHOD(GetDefaultSaveFolder)(THIS_ DEFAULTSAVEFOLDERTYPE dsft, REFIID riid, void **ppv) PURE;
- STDMETHOD(SetDefaultSaveFolder)(THIS_ DEFAULTSAVEFOLDERTYPE dsft, IShellItem *psi) PURE;
- STDMETHOD(GetOptions)(THIS_ LIBRARYOPTIONFLAGS *plofOptions) PURE;
- STDMETHOD(SetOptions)(THIS_ LIBRARYOPTIONFLAGS lofMask, LIBRARYOPTIONFLAGS lofOptions) PURE;
- STDMETHOD(GetFolderType)(THIS_ GUID *pftid) PURE;
- STDMETHOD(SetFolderType)(THIS_ const GUID &ftid) PURE;
- STDMETHOD(GetIcon)(THIS_ LPWSTR *ppszIcon) PURE;
- STDMETHOD(SetIcon)(THIS_ LPCWSTR pszIcon) PURE;
- STDMETHOD(Commit)(THIS_) PURE;
- STDMETHOD(Save)(THIS_ IShellItem *psiFolderToSaveIn, LPCWSTR pszLibraryName, LIBRARYSAVEFLAGS lsf, IShellItem **ppsiSavedTo) PURE;
- STDMETHOD(SaveInKnownFolder)(THIS_ const GUID &kfidToSaveIn, LPCWSTR pszLibraryName, LIBRARYSAVEFLAGS lsf,IShellItem **ppsiSavedTo) PURE;
-};
-#endif
-
-#ifndef __IModalWindow_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IModalWindow, IUnknown)
-{
- STDMETHOD(Show)(THIS_ HWND hwndParent) PURE;
-};
-#endif
-
-#ifndef __IFileDialog_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IFileDialog, IModalWindow)
-{
- STDMETHOD(SetFileTypes)(THIS_ UINT cFileTypes, const COMDLG_FILTERSPEC *rgFilterSpec) PURE;
- STDMETHOD(SetFileTypeIndex)(THIS_ UINT iFileType) PURE;
- STDMETHOD(GetFileTypeIndex)(THIS_ UINT *piFileType) PURE;
- STDMETHOD(Advise)(THIS_ IFileDialogEvents *pfde, DWORD *pdwCookie) PURE;
- STDMETHOD(Unadvise)(THIS_ DWORD dwCookie) PURE;
- STDMETHOD(SetOptions)(THIS_ DWORD fos) PURE;
- STDMETHOD(GetOptions)(THIS_ DWORD *pfos) PURE;
- STDMETHOD(SetDefaultFolder)(THIS_ IShellItem *psi) PURE;
- STDMETHOD(SetFolder)(THIS_ IShellItem *psi) PURE;
- STDMETHOD(GetFolder)(THIS_ IShellItem **ppsi) PURE;
- STDMETHOD(GetCurrentSelection)(THIS_ IShellItem **ppsi) PURE;
- STDMETHOD(SetFileName)(THIS_ LPCWSTR pszName) PURE;
- STDMETHOD(GetFileName)(THIS_ LPWSTR *pszName) PURE;
- STDMETHOD(SetTitle)(THIS_ LPCWSTR pszTitle) PURE;
- STDMETHOD(SetOkButtonLabel)(THIS_ LPCWSTR pszText) PURE;
- STDMETHOD(SetFileNameLabel)(THIS_ LPCWSTR pszLabel) PURE;
- STDMETHOD(GetResult)(THIS_ IShellItem **ppsi) PURE;
- STDMETHOD(AddPlace)(THIS_ IShellItem *psi, FDAP fdap) PURE;
- STDMETHOD(SetDefaultExtension)(THIS_ LPCWSTR pszDefaultExtension) PURE;
- STDMETHOD(Close)(THIS_ HRESULT hr) PURE;
- STDMETHOD(SetClientGuid)(THIS_ REFGUID guid) PURE;
- STDMETHOD(ClearClientData)(THIS_) PURE;
- STDMETHOD(SetFilter)(THIS_ IShellItemFilter *pFilter) PURE;
-};
-#endif
-
-#ifndef __IFileDialogEvents_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IFileDialogEvents, IUnknown)
-{
- STDMETHOD(OnFileOk)(THIS_ IFileDialog *pfd) PURE;
- STDMETHOD(OnFolderChanging)(THIS_ IFileDialog *pfd, IShellItem *psiFolder) PURE;
- STDMETHOD(OnFolderChange)(THIS_ IFileDialog *pfd) PURE;
- STDMETHOD(OnSelectionChange)(THIS_ IFileDialog *pfd) PURE;
- STDMETHOD(OnShareViolation)(THIS_ IFileDialog *pfd, IShellItem *psi, FDE_SHAREVIOLATION_RESPONSE *pResponse) PURE;
- STDMETHOD(OnTypeChange)(THIS_ IFileDialog *pfd) PURE;
- STDMETHOD(OnOverwrite)(THIS_ IFileDialog *pfd, IShellItem *psi, FDE_OVERWRITE_RESPONSE *pResponse) PURE;
-};
-#endif
-
-#ifndef __IFileOpenDialog_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IFileOpenDialog, IFileDialog)
-{
- STDMETHOD(GetResults)(THIS_ IShellItemArray **ppenum) PURE;
- STDMETHOD(GetSelectedItems)(THIS_ IShellItemArray **ppsai) PURE;
-};
-#endif
-
-#ifndef __IPropertyStore_FWD_DEFINED__
-typedef IUnknown IPropertyStore;
-#endif
-
-#ifndef __IFileOperationProgressSink_FWD_DEFINED__
-typedef IUnknown IFileOperationProgressSink;
-#endif
-
-#ifndef __IFileSaveDialog_INTERFACE_DEFINED__
-DECLARE_INTERFACE_(IFileSaveDialog, IFileDialog)
-{
-public:
- STDMETHOD(SetSaveAsItem)(THIS_ IShellItem *psi) PURE;
- STDMETHOD(SetProperties)(THIS_ IPropertyStore *pStore) PURE;
- STDMETHOD(SetCollectedProperties)(THIS_ IPropertyStore *pStore) PURE;
- STDMETHOD(GetProperties)(THIS_ IPropertyStore **ppStore) PURE;
- STDMETHOD(ApplyProperties)(THIS_ IShellItem *psi, IPropertyStore *pStore, HWND hwnd, IFileOperationProgressSink *pSink) PURE;
-};
-#endif
-
-#endif // Q_CC_MINGW
-
QT_BEGIN_NAMESPACE
#ifndef QT_NO_DEBUG_STREAM
@@ -637,7 +347,6 @@ void QWindowsDialogHelperBase<BaseClass>::stopTimer()
}
}
-#ifndef Q_OS_WINCE
// Find a file dialog window created by IFileDialog by process id, window
// title and class, which starts with a hash '#'.
@@ -673,7 +382,6 @@ static inline HWND findDialogWindow(const QString &title)
EnumWindows(findDialogEnumWindowsProc, reinterpret_cast<LPARAM>(&context));
return context.hwnd;
}
-#endif // !Q_OS_WINCE
template <class BaseClass>
void QWindowsDialogHelperBase<BaseClass>::hide()
@@ -989,24 +697,19 @@ void QWindowsNativeFileDialogBase::setWindowTitle(const QString &title)
IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
{
-#ifndef Q_OS_WINCE
if (url.isLocalFile()) {
- if (!QWindowsContext::shell32dll.sHCreateItemFromParsingName)
- return Q_NULLPTR;
IShellItem *result = Q_NULLPTR;
const QString native = QDir::toNativeSeparators(url.toLocalFile());
const HRESULT hr =
- QWindowsContext::shell32dll.sHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()),
- NULL, IID_IShellItem,
- reinterpret_cast<void **>(&result));
+ SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()),
+ NULL, IID_IShellItem,
+ reinterpret_cast<void **>(&result));
if (FAILED(hr)) {
qErrnoWarning("%s: SHCreateItemFromParsingName(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
return Q_NULLPTR;
}
return result;
} else if (url.scheme() == QLatin1String("clsid")) {
- if (!QWindowsContext::shell32dll.sHGetKnownFolderIDList || !QWindowsContext::shell32dll.sHCreateItemFromIDList)
- return Q_NULLPTR;
// Support for virtual folders via GUID
// (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx)
// specified as "clsid:<GUID>" (without '{', '}').
@@ -1017,12 +720,12 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
return Q_NULLPTR;
}
PIDLIST_ABSOLUTE idList;
- HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList);
+ HRESULT hr = SHGetKnownFolderIDList(uuid, 0, 0, &idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
return Q_NULLPTR;
}
- hr = QWindowsContext::shell32dll.sHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result));
+ hr = SHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result));
CoTaskMemFree(idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHCreateItemFromIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
@@ -1032,9 +735,6 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
} else {
qWarning() << __FUNCTION__ << ": Unhandled scheme: " << url.scheme();
}
-#else // !Q_OS_WINCE
- Q_UNUSED(url)
-#endif
return 0;
}
@@ -1050,11 +750,9 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory)
QString QWindowsNativeFileDialogBase::directory() const
{
-#ifndef Q_OS_WINCE
IShellItem *item = 0;
if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item)
return QWindowsNativeFileDialogBase::itemPath(item);
-#endif
return QString();
}
@@ -1106,7 +804,7 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode,
qErrnoWarning("%s: SetOptions() failed", __FUNCTION__);
}
-#if !defined(Q_OS_WINCE) && defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7
+#if defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7
// Helper for "Libraries": collections of folders appearing from Windows 7
// on, visible in the file dialogs.
@@ -1159,7 +857,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *i
return result;
}
-#else // !Q_OS_WINCE && __IShellLibrary_INTERFACE_DEFINED__
+#else // __IShellLibrary_INTERFACE_DEFINED__
QList<QUrl> QWindowsNativeFileDialogBase::libraryItemFolders(IShellItem *)
{
@@ -1171,7 +869,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *)
return QString();
}
-#endif // Q_OS_WINCE || !__IShellLibrary_INTERFACE_DEFINED__
+#endif // !__IShellLibrary_INTERFACE_DEFINED__
QString QWindowsNativeFileDialogBase::itemPath(IShellItem *item)
{
@@ -1417,14 +1115,12 @@ bool QWindowsNativeFileDialogBase::onFileOk()
void QWindowsNativeFileDialogBase::close()
{
m_fileDialog->Close(S_OK);
-#ifndef Q_OS_WINCE
// IFileDialog::Close() does not work unless invoked from a callback.
// Try to find the window and send it a WM_CLOSE in addition.
const HWND hwnd = findDialogWindow(m_title);
qCDebug(lcQpaDialogs) << __FUNCTION__ << "closing" << hwnd;
if (hwnd && IsWindowVisible(hwnd))
PostMessageW(hwnd, WM_CLOSE, 0, 0);
-#endif // !Q_OS_WINCE
}
HRESULT QWindowsNativeFileDialogEventHandler::OnFolderChanging(IFileDialog *, IShellItem *item)
@@ -1725,8 +1421,6 @@ QString QWindowsFileDialogHelper::selectedNameFilter() const
return m_data.selectedNameFilter();
}
-#ifndef Q_OS_WINCE
-
/*!
\class QWindowsXpNativeFileDialog
\brief Native Windows directory dialog for Windows XP using SHlib-functions.
@@ -2050,8 +1744,6 @@ QString QWindowsXpFileDialogHelper::selectedNameFilter() const
return m_data.selectedNameFilter();
}
-#endif // Q_OS_WINCE
-
/*!
\class QWindowsNativeColorDialog
\brief Native Windows color dialog.
@@ -2179,7 +1871,6 @@ namespace QWindowsDialogs {
// QWindowsDialogHelperBase creation functions
bool useHelper(QPlatformTheme::DialogType type)
{
-#if !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
return false;
switch (type) {
@@ -2198,28 +1889,20 @@ bool useHelper(QPlatformTheme::DialogType type)
break;
}
return false;
-#else
- return false;
-#endif // !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
}
QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
{
-#if !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
return 0;
switch (type) {
- case QPlatformTheme::FileDialog:
-#ifndef Q_OS_WINCE // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003).
+ case QPlatformTheme::FileDialog: // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003).
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs
|| QSysInfo::windowsVersion() <= QSysInfo::WV_2003) {
return new QWindowsXpFileDialogHelper();
}
if (QSysInfo::windowsVersion() > QSysInfo::WV_2003)
return new QWindowsFileDialogHelper();
-#else
- return new QWindowsFileDialogHelper();
-#endif // Q_OS_WINCE
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return new QWindowsColorDialogHelper();
@@ -2233,9 +1916,6 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
break;
}
return 0;
-#else
- return 0;
-#endif // !defined(_WIN32_WCE) || _WIN32_WCE < 0x800
}
} // namespace QWindowsDialogs
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
index b643d9a920..b3101a1419 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSDIALOGHELPER_H
#define QWINDOWSDIALOGHELPER_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <qpa/qplatformdialoghelper.h>
#include <qpa/qplatformtheme.h>
#include <QtCore/QStringList>
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 246f53ef2f..26a5131927 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -45,7 +45,7 @@
#endif
#include "qwindowsintegration.h"
#include "qwindowsole.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include "qwindowswindow.h"
#include "qwindowsmousehandler.h"
#include "qwindowscursor.h"
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index 0ce4e87e52..6124b004b6 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -95,13 +95,9 @@ static void *resolveFunc(HMODULE lib, const char *name)
return proc;
}
#else
-static void *resolveFunc(HMODULE lib, const char *name)
+static inline void *resolveFunc(HMODULE lib, const char *name)
{
-# ifndef Q_OS_WINCE
- return (void *) ::GetProcAddress(lib, name);
-# else
- return (void *) ::GetProcAddress(lib, (const wchar_t *) QString::fromLatin1(name).utf16());
-# endif // Q_OS_WINCE
+ return ::GetProcAddress(lib, name);
}
#endif // Q_CC_MINGW
@@ -121,7 +117,7 @@ void *QWindowsLibEGL::resolve(const char *name)
bool QWindowsLibEGL::init()
{
const char dllName[] = QT_STRINGIFY(LIBEGL_NAME)
-#if defined(QT_DEBUG) && !defined(Q_OS_WINCE)
+#if defined(QT_DEBUG)
"d"
#endif
"";
@@ -178,7 +174,7 @@ bool QWindowsLibGLESv2::init()
{
const char dllName[] = QT_STRINGIFY(LIBGLESV2_NAME)
-#if defined(QT_DEBUG) && !defined(Q_OS_WINCE)
+#if defined(QT_DEBUG)
"d"
#endif
"";
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index 68a8fc5390..0e00ee6910 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -42,7 +42,7 @@
#include "qwindowscontext.h"
#include "qwindowsfontengine.h"
#include "qwindowsfontenginedirectwrite.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtGui/QFont>
#include <QtGui/QGuiApplication>
@@ -57,10 +57,6 @@
#include <wchar.h>
-#ifdef Q_OS_WINCE
-# include "qplatformfunctions_wince.h"
-#endif
-
#if !defined(QT_NO_DIRECTWRITE)
# if defined(QT_USE_DIRECTWRITE2)
# include <dwrite_2.h>
@@ -947,17 +943,6 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet,
quint32 codePageRange[2] = {
signature->fsCsb[0], signature->fsCsb[1]
};
-#ifdef Q_OS_WINCE
- if (signature->fsUsb[0] == 0) {
- // If the unicode ranges bit mask is zero then
- // EnumFontFamiliesEx failed to determine it properly.
- // In this case we just pretend that the font supports all languages.
- unicodeRange[0] = 0xbfffffff; // second most significant bit must be zero
- unicodeRange[1] = 0xffffffff;
- unicodeRange[2] = 0xffffffff;
- unicodeRange[3] = 0xffffffff;
- }
-#endif
writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
// ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains
// the symbol for Baht, and Windows thus reports that it supports the Thai script.
@@ -1117,9 +1102,8 @@ QWindowsFontEngineDataPtr sharedFontData()
}
#endif // QT_NO_THREAD
-#ifndef Q_OS_WINCE
extern Q_GUI_EXPORT bool qt_needs_a8_gamma_correction;
-#endif
+
QWindowsFontDatabase::QWindowsFontDatabase()
{
// Properties accessed by QWin32PrintEngine (Qt Print Support)
@@ -1133,9 +1117,7 @@ QWindowsFontDatabase::QWindowsFontDatabase()
qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: "
<< data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma;
}
-#ifndef Q_OS_WINCE
qt_needs_a8_gamma_correction = true;
-#endif
}
QWindowsFontDatabase::~QWindowsFontDatabase()
@@ -1586,14 +1568,12 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
int strat = OUT_DEFAULT_PRECIS;
if (request.styleStrategy & QFont::PreferBitmap) {
strat = OUT_RASTER_PRECIS;
-#ifndef Q_OS_WINCE
} else if (request.styleStrategy & QFont::PreferDevice) {
strat = OUT_DEVICE_PRECIS;
} else if (request.styleStrategy & QFont::PreferOutline) {
strat = OUT_OUTLINE_PRECIS;
} else if (request.styleStrategy & QFont::ForceOutline) {
strat = OUT_TT_ONLY_PRECIS;
-#endif
}
lf.lfOutPrecision = strat;
@@ -1602,10 +1582,8 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
if (request.styleStrategy & QFont::PreferMatch)
qual = DRAFT_QUALITY;
-#ifndef Q_OS_WINCE
else if (request.styleStrategy & QFont::PreferQuality)
qual = PROOF_QUALITY;
-#endif
if (request.styleStrategy & QFont::PreferAntialias) {
if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) {
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h
index 574e20ef30..8b8c9c15f4 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h
@@ -42,7 +42,7 @@
#include <qpa/qplatformfontdatabase.h>
#include <QtCore/QSharedPointer>
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#if !defined(QT_NO_DIRECTWRITE)
struct IDWriteFactory;
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index fb75e75dcd..d782519c68 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -53,10 +53,6 @@
#include <QtGui/QFontDatabase>
#include <wchar.h>
-#ifdef Q_OS_WINCE
-#include <QtCore/QFile>
-#include <QtEndian>
-#endif
QT_BEGIN_NAMESPACE
@@ -108,8 +104,6 @@ static FontFile * createFontFile(const QString &fileName, int index)
extern bool localizedName(const QString &name);
extern QString getEnglishName(const QString &familyName);
-#ifndef Q_OS_WINCE
-
namespace {
struct FontKey
{
@@ -165,223 +159,6 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR)
return Q_NULLPTR;
}
-#else // Q_OS_WINCE
-
-typedef struct {
- quint16 majorVersion;
- quint16 minorVersion;
- quint16 numTables;
- quint16 searchRange;
- quint16 entrySelector;
- quint16 rangeShift;
-} OFFSET_TABLE;
-
-typedef struct {
- quint32 tag;
- quint32 checkSum;
- quint32 offset;
- quint32 length;
-} TABLE_DIRECTORY;
-
-typedef struct {
- quint16 fontSelector;
- quint16 nrCount;
- quint16 storageOffset;
-} NAME_TABLE_HEADER;
-
-typedef struct {
- quint16 platformID;
- quint16 encodingID;
- quint16 languageID;
- quint16 nameID;
- quint16 stringLength;
- quint16 stringOffset;
-} NAME_RECORD;
-
-typedef struct {
- quint32 tag;
- quint16 majorVersion;
- quint16 minorVersion;
- quint32 numFonts;
-} TTC_TABLE_HEADER;
-
-static QString fontNameFromTTFile(const QString &filename, int startPos = 0)
-{
- QFile f(filename);
- QString retVal;
- qint64 bytesRead;
- qint64 bytesToRead;
-
- if (f.open(QIODevice::ReadOnly)) {
- f.seek(startPos);
- OFFSET_TABLE ttOffsetTable;
- bytesToRead = sizeof(OFFSET_TABLE);
- bytesRead = f.read((char*)&ttOffsetTable, bytesToRead);
- if (bytesToRead != bytesRead)
- return retVal;
- ttOffsetTable.numTables = qFromBigEndian(ttOffsetTable.numTables);
- ttOffsetTable.majorVersion = qFromBigEndian(ttOffsetTable.majorVersion);
- ttOffsetTable.minorVersion = qFromBigEndian(ttOffsetTable.minorVersion);
-
- if (ttOffsetTable.majorVersion != 1 || ttOffsetTable.minorVersion != 0)
- return retVal;
-
- TABLE_DIRECTORY tblDir;
- bool found = false;
-
- for (int i = 0; i < ttOffsetTable.numTables; i++) {
- bytesToRead = sizeof(TABLE_DIRECTORY);
- bytesRead = f.read((char*)&tblDir, bytesToRead);
- if (bytesToRead != bytesRead)
- return retVal;
- if (qFromBigEndian(tblDir.tag) == MAKE_TAG('n', 'a', 'm', 'e')) {
- found = true;
- tblDir.length = qFromBigEndian(tblDir.length);
- tblDir.offset = qFromBigEndian(tblDir.offset);
- break;
- }
- }
-
- if (found) {
- f.seek(tblDir.offset);
- NAME_TABLE_HEADER ttNTHeader;
- bytesToRead = sizeof(NAME_TABLE_HEADER);
- bytesRead = f.read((char*)&ttNTHeader, bytesToRead);
- if (bytesToRead != bytesRead)
- return retVal;
- ttNTHeader.nrCount = qFromBigEndian(ttNTHeader.nrCount);
- ttNTHeader.storageOffset = qFromBigEndian(ttNTHeader.storageOffset);
- NAME_RECORD ttRecord;
- found = false;
-
- for (int i = 0; i < ttNTHeader.nrCount; i++) {
- bytesToRead = sizeof(NAME_RECORD);
- bytesRead = f.read((char*)&ttRecord, bytesToRead);
- if (bytesToRead != bytesRead)
- return retVal;
- ttRecord.nameID = qFromBigEndian(ttRecord.nameID);
- if (ttRecord.nameID == 1) {
- ttRecord.stringLength = qFromBigEndian(ttRecord.stringLength);
- ttRecord.stringOffset = qFromBigEndian(ttRecord.stringOffset);
- int nPos = f.pos();
- f.seek(tblDir.offset + ttRecord.stringOffset + ttNTHeader.storageOffset);
-
- QByteArray nameByteArray = f.read(ttRecord.stringLength);
- if (!nameByteArray.isEmpty()) {
- if (ttRecord.encodingID == 256 || ttRecord.encodingID == 768) {
- //This is UTF-16 in big endian
- int stringLength = ttRecord.stringLength / 2;
- retVal.resize(stringLength);
- QChar *data = retVal.data();
- const ushort *srcData = (const ushort *)nameByteArray.data();
- for (int i = 0; i < stringLength; ++i)
- data[i] = qFromBigEndian(srcData[i]);
- return retVal;
- } else if (ttRecord.encodingID == 0) {
- //This is Latin1
- retVal = QString::fromLatin1(nameByteArray);
- } else {
- qWarning("Could not retrieve Font name from file: %s", qPrintable(QDir::toNativeSeparators(filename)));
- }
- break;
- }
- f.seek(nPos);
- }
- }
- }
- f.close();
- }
- return retVal;
-}
-
-static QStringList fontNamesFromTTCFile(const QString &filename)
-{
- QFile f(filename);
- QStringList retVal;
- qint64 bytesRead;
- qint64 bytesToRead;
-
- if (f.open(QIODevice::ReadOnly)) {
- TTC_TABLE_HEADER ttcTableHeader;
- bytesToRead = sizeof(TTC_TABLE_HEADER);
- bytesRead = f.read((char*)&ttcTableHeader, bytesToRead);
- if (bytesToRead != bytesRead)
- return retVal;
- ttcTableHeader.majorVersion = qFromBigEndian(ttcTableHeader.majorVersion);
- ttcTableHeader.minorVersion = qFromBigEndian(ttcTableHeader.minorVersion);
- ttcTableHeader.numFonts = qFromBigEndian(ttcTableHeader.numFonts);
-
- if (ttcTableHeader.majorVersion < 1 || ttcTableHeader.majorVersion > 2)
- return retVal;
- QVarLengthArray<quint32> offsetTable(ttcTableHeader.numFonts);
- bytesToRead = sizeof(quint32) * ttcTableHeader.numFonts;
- bytesRead = f.read((char*)offsetTable.data(), bytesToRead);
- if (bytesToRead != bytesRead)
- return retVal;
- f.close();
- for (int i = 0; i < (int)ttcTableHeader.numFonts; ++i)
- retVal << fontNameFromTTFile(filename, qFromBigEndian(offsetTable[i]));
- }
- return retVal;
-}
-
-static inline QString fontSettingsOrganization() { return QStringLiteral("Qt-Project"); }
-static inline QString fontSettingsApplication() { return QStringLiteral("Qtbase"); }
-static inline QString fontSettingsGroup() { return QStringLiteral("CEFontCache"); }
-
-static QString findFontFile(const QString &faceName)
-{
- static QHash<QString, QString> fontCache;
-
- if (fontCache.isEmpty()) {
- QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication());
- settings.beginGroup(fontSettingsGroup());
- foreach (const QString &fontName, settings.allKeys())
- fontCache.insert(fontName, settings.value(fontName).toString());
- settings.endGroup();
- }
-
- QString value = fontCache.value(faceName);
-
- //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts
- if (value.isEmpty() || !QFile::exists(value)) {
- QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication());
- settings.beginGroup(fontSettingsGroup());
-
- //empty the cache first, as it seems that it is dirty
- settings.remove(QString());
-
- QDirIterator it(QStringLiteral("/Windows"), QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.ttc"), QDir::Files | QDir::Hidden | QDir::System);
- const QLatin1Char lowerF('f');
- const QLatin1Char upperF('F');
- while (it.hasNext()) {
- const QString fontFile = it.next();
- QStringList fontNames;
- const QChar c = fontFile[fontFile.size() - 1];
- if (c == lowerF || c == upperF)
- fontNames << fontNameFromTTFile(fontFile);
- else
- fontNames << fontNamesFromTTCFile(fontFile);
- foreach (const QString fontName, fontNames) {
- if (fontName.isEmpty())
- continue;
- fontCache.insert(fontName, fontFile);
- settings.setValue(fontName, fontFile);
-
- if (localizedName(fontName)) {
- QString englishFontName = getEnglishName(fontName);
- fontCache.insert(englishFontName, fontFile);
- settings.setValue(englishFontName, fontFile);
- }
- }
- }
- settings.endGroup();
- value = fontCache.value(faceName);
- }
- return value;
-}
-#endif // Q_OS_WINCE
-
static bool addFontToDatabase(const QString &faceName,
const QString &fullName,
uchar charSet,
@@ -453,7 +230,6 @@ static bool addFontToDatabase(const QString &faceName,
}
int index = 0;
-#ifndef Q_OS_WINCE
const FontKey *key = findFontKey(faceName, &index);
if (!key) {
key = findFontKey(fullName, &index);
@@ -465,19 +241,11 @@ static bool addFontToDatabase(const QString &faceName,
return false;
}
QString value = key->fileName;
-#else
- QString value = findFontFile(faceName);
-#endif
-
if (value.isEmpty())
return false;
if (!QDir::isAbsolutePath(value))
-#ifndef Q_OS_WINCE
value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\"));
-#else
- value.prepend(QFile::decodeName("/Windows/"));
-#endif
QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch,
antialias, scalable, size, fixed, writingSystems, createFontFile(value, index));
@@ -501,24 +269,6 @@ static bool addFontToDatabase(const QString &faceName,
return true;
}
-#ifdef Q_OS_WINCE
-static QByteArray getFntTable(HFONT hfont, uint tag)
-{
- HDC hdc = GetDC(0);
- HGDIOBJ oldFont = SelectObject(hdc, hfont);
- quint32 t = qFromBigEndian<quint32>(tag);
- QByteArray buffer;
-
- DWORD length = GetFontData(hdc, t, 0, NULL, 0);
- if (length != GDI_ERROR) {
- buffer.resize(length);
- GetFontData(hdc, t, 0, reinterpret_cast<uchar *>(buffer.data()), length);
- }
- SelectObject(hdc, oldFont);
- return buffer;
-}
-#endif
-
static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric,
DWORD type, LPARAM)
{
@@ -576,8 +326,6 @@ struct PopulateFamiliesContext
};
} // namespace
-#ifndef Q_OS_WINCE
-
// Delayed population of font families
static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric,
@@ -633,74 +381,6 @@ void QWindowsFontDatabaseFT::populateFontDatabase()
QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont);
}
-#else // !Q_OS_WINCE
-
-// Non-delayed population of fonts (Windows CE).
-
-static int QT_WIN_CALLBACK populateFontCe(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric,
- int type, LPARAM lparam)
-{
- // the "@family" fonts are just the same as "family". Ignore them.
- const wchar_t *faceNameW = f->elfLogFont.lfFaceName;
- if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) {
- const uchar charSet = f->elfLogFont.lfCharSet;
-
- FONTSIGNATURE signature;
- QByteArray table;
-
- if (type & TRUETYPE_FONTTYPE) {
- HFONT hfont = CreateFontIndirect(&f->elfLogFont);
- table = getFntTable(hfont, MAKE_TAG('O', 'S', '/', '2'));
- DeleteObject((HGDIOBJ)hfont);
- }
-
- if (table.length() >= 86) {
- // See also qfontdatabase_mac.cpp, offsets taken from OS/2 table in the TrueType spec
- uchar *tableData = reinterpret_cast<uchar *>(table.data());
-
- signature.fsUsb[0] = qFromBigEndian<quint32>(tableData + 42);
- signature.fsUsb[1] = qFromBigEndian<quint32>(tableData + 46);
- signature.fsUsb[2] = qFromBigEndian<quint32>(tableData + 50);
- signature.fsUsb[3] = qFromBigEndian<quint32>(tableData + 54);
-
- signature.fsCsb[0] = qFromBigEndian<quint32>(tableData + 78);
- signature.fsCsb[1] = qFromBigEndian<quint32>(tableData + 82);
- } else {
- memset(&signature, 0, sizeof(signature));
- }
-
- // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is
- // identical to a TEXTMETRIC except for the last four members, which we don't use
- // anyway
- const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName);
- if (addFontToDatabase(faceName, QString::fromWCharArray(f->elfFullName),
- charSet, (TEXTMETRIC *)textmetric, &signature, type, true)) {
- PopulateFamiliesContext *context = reinterpret_cast<PopulateFamiliesContext *>(lparam);
- if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont)
- context->seenSystemDefaultFont = true;
- }
- }
-
- // keep on enumerating
- return 1;
-}
-
-void QWindowsFontDatabaseFT::populateFontDatabase()
-{
- LOGFONT lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- HDC dummy = GetDC(0);
- lf.lfFaceName[0] = 0;
- lf.lfPitchAndFamily = 0;
- PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family());
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)populateFontCe, reinterpret_cast<LPARAM>(&context), 0);
- ReleaseDC(0, dummy);
- // Work around EnumFontFamiliesEx() not listing the system font, see below.
- if (!context.seenSystemDefaultFont)
- populateFamily(context.systemDefaultFont);
-}
-#endif // Q_OS_WINCE
-
QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, void *handle)
{
QFontEngine *fe = QBasicFontDatabase::fontEngine(fontDef, handle);
@@ -718,21 +398,8 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea
QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
QStringList result;
-
result.append(QWindowsFontDatabase::familyForStyleHint(styleHint));
-
-#ifdef Q_OS_WINCE
- QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\FontLink\\SystemLink"), QSettings::NativeFormat);
- const QStringList fontList = settings.value(family).toStringList();
- foreach (const QString &fallback, fontList) {
- const int sep = fallback.indexOf(QLatin1Char(','));
- if (sep > 0)
- result << fallback.mid(sep + 1);
- }
-#endif
-
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
-
result.append(QBasicFontDatabase::fallbacksForFamily(family, style, styleHint, script));
qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h
index 988b0012f7..fa8f777133 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.h
@@ -42,7 +42,7 @@
#include <QtPlatformSupport/private/qbasicfontdatabase_p.h>
#include <QtCore/QSharedPointer>
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 4f3df32f16..744d882bb2 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -42,7 +42,7 @@
#include "qwindowsnativeimage.h"
#include "qwindowscontext.h"
#include "qwindowsfontdatabase.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include "qwindowsfontenginedirectwrite.h"
#include <QtGui/private/qtextengine_p.h> // glyph_metrics_t
@@ -65,10 +65,6 @@
#include <limits.h>
-#ifdef Q_OS_WINCE
-# include "qplatformfunctions_wince.h"
-#endif
-
#if !defined(QT_NO_DIRECTWRITE)
# include <dwrite.h>
#endif
@@ -205,9 +201,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa
{
int glyph_pos = 0;
{
-#if defined(Q_OS_WINCE)
- {
-#else
if (symbol) {
QStringIterator it(str, str + numChars);
while (it.hasNext()) {
@@ -225,7 +218,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa
++glyph_pos;
}
} else {
-#endif
QStringIterator it(str, str + numChars);
while (it.hasNext()) {
const uint uc = it.next();
@@ -329,21 +321,16 @@ QWindowsFontEngine::~QWindowsFontEngine()
glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const
{
- glyph_t glyph;
+ glyph_t glyph = 0;
-#if !defined(Q_OS_WINCE)
if (symbol) {
glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
if (glyph == 0 && ucs4 < 0x100)
glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000);
} else if (ttf) {
glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4);
- } else
-#endif
- if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) {
+ } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) {
glyph = ucs4;
- } else {
- glyph = 0;
}
return glyph;
@@ -377,12 +364,8 @@ bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *g
inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width)
{
-#if defined(Q_OS_WINCE)
- GetCharWidth32(hdc, glyph, glyph, &width);
-#else
if (ptrGetCharWidthI)
ptrGetCharWidthI(hdc, glyph, 1, 0, &width);
-#endif
}
void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
@@ -467,7 +450,7 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(const QGlyphLayout &glyphs)
return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0);
}
-#ifndef Q_OS_WINCE
+
bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const
{
Q_ASSERT(metrics != 0);
@@ -520,11 +503,9 @@ bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, g
return false;
}
}
-#endif
glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform &t)
{
-#ifndef Q_OS_WINCE
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
@@ -542,34 +523,6 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform
}
return glyphMetrics;
-#else
- HDC hdc = m_fontEngineData->hdc;
- HGDIOBJ oldFont = SelectObject(hdc, hfont);
-
- ABC abc;
- int width;
- int advance;
-#ifdef GWES_MGTT // true type fonts
- if (GetCharABCWidths(hdc, glyph, glyph, &abc)) {
- width = qAbs(abc.abcA) + abc.abcB + qAbs(abc.abcC);
- advance = abc.abcA + abc.abcB + abc.abcC;
- }
- else
-#endif
-#if defined(GWES_MGRAST) || defined(GWES_MGRAST2) // raster fonts
- if (GetCharWidth32(hdc, glyph, glyph, &width)) {
- advance = width;
- }
- else
-#endif
- { // fallback
- width = tm.tmMaxCharWidth;
- advance = width;
- }
-
- SelectObject(hdc, oldFont);
- return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, advance, 0).transformed(t);
-#endif
}
QFixed QWindowsFontEngine::ascent() const
@@ -636,22 +589,16 @@ void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qre
HDC hdc = m_fontEngineData->hdc;
SelectObject(hdc, hfont);
-#ifndef Q_OS_WINCE
- if (ttf)
-#endif
- {
+ if (ttf) {
ABC abcWidths;
GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths);
if (leftBearing)
*leftBearing = abcWidths.abcA;
if (rightBearing)
*rightBearing = abcWidths.abcC;
- }
-#ifndef Q_OS_WINCE
- else {
+ } else {
QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing);
}
-#endif
}
#endif // Q_CC_MINGW
@@ -670,7 +617,6 @@ qreal QWindowsFontEngine::minLeftBearing() const
qreal QWindowsFontEngine::minRightBearing() const
{
-#ifndef Q_OS_WINCE
if (rbearing == SHRT_MIN) {
int ml = 0;
int mr = 0;
@@ -726,40 +672,6 @@ qreal QWindowsFontEngine::minRightBearing() const
}
return rbearing;
-#else // !Q_OS_WINCE
- if (rbearing == SHRT_MIN) {
- int ml = 0;
- int mr = 0;
- HDC hdc = m_fontEngineData->hdc;
- SelectObject(hdc, hfont);
- if (ttf) {
- ABC *abc = 0;
- int n = tm.tmLastChar - tm.tmFirstChar;
- if (n <= max_font_count) {
- abc = new ABC[n+1];
- GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc);
- } else {
- abc = new ABC[char_table_entries+1];
- for (int i = 0; i < char_table_entries; i++)
- GetCharABCWidths(hdc, char_table[i], char_table[i], abc+i);
- n = char_table_entries;
- }
- ml = abc[0].abcA;
- mr = abc[0].abcC;
- for (int i = 1; i < n; i++) {
- if (abc[i].abcA + abc[i].abcB + abc[i].abcC != 0) {
- ml = qMin(ml,abc[i].abcA);
- mr = qMin(mr,abc[i].abcC);
- }
- }
- delete [] abc;
- }
- lbearing = ml;
- rbearing = mr;
- }
-
- return rbearing;
-#endif // Q_OS_WINCE
}
static inline double qt_fixed_to_double(const FIXED &p) {
@@ -786,7 +698,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc,
GLYPHMETRICS gMetric;
memset(&gMetric, 0, sizeof(GLYPHMETRICS));
-#ifndef Q_OS_WINCE
if (metric) {
// If metrics requested, retrieve first using GGO_METRICS, because the returned
// values are incorrect for OpenType PS fonts if obtained at the same time as the
@@ -801,7 +712,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc,
int(gMetric.gmBlackBoxX), int(gMetric.gmBlackBoxY),
gMetric.gmCellIncX, gMetric.gmCellIncY);
}
-#endif
uint glyphFormat = GGO_NATIVE;
@@ -820,15 +730,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc,
return false;
}
-#ifdef Q_OS_WINCE
- if (metric) {
- // #### obey scale
- *metric = glyph_metrics_t(gMetric.gmptGlyphOrigin.x, -gMetric.gmptGlyphOrigin.y,
- (int)gMetric.gmBlackBoxX, (int)gMetric.gmBlackBoxY,
- gMetric.gmCellIncX, gMetric.gmCellIncY);
- }
-#endif
-
DWORD offset = 0;
DWORD headerOffset = 0;
@@ -1052,7 +953,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
bool has_transformation = t.type() > QTransform::TxTranslate;
-#ifndef Q_OS_WINCE
unsigned int options = ttf ? ETO_GLYPH_INDEX : 0;
XFORM xform;
@@ -1095,13 +995,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
xform.eDx -= tgm.gmptGlyphOrigin.x;
xform.eDy += tgm.gmptGlyphOrigin.y;
}
-#else // else wince
- unsigned int options = 0;
- if (has_transformation) {
- qWarning() << "QWindowsFontEngine is unable to apply transformations other than translations for fonts on Windows CE."
- << "If you need them anyway, start your application with -platform windows:fontengine=freetype.";
- }
-#endif // wince
// The padding here needs to be kept in sync with the values in alphaMapBoundingBox.
QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin,
@@ -1123,14 +1016,11 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
HGDIOBJ old_font = SelectObject(hdc, font);
-#ifndef Q_OS_WINCE
if (has_transformation) {
SetGraphicsMode(hdc, GM_ADVANCED);
SetWorldTransform(hdc, &xform);
ExtTextOut(hdc, 0, 0, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0);
- } else
-#endif // !Q_OS_WINCE
- {
+ } else {
ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0);
}
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h
index d4d98422a1..921351a4b0 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.h
+++ b/src/plugins/platforms/windows/qwindowsfontengine.h
@@ -57,7 +57,7 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QMetaType>
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index cc2f05b6d1..48439e9523 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -149,15 +149,9 @@ QT_BEGIN_NAMESPACE
QWindowsOpengl32DLL QOpenGLStaticContext::opengl32;
-void *QWindowsOpengl32DLL::resolve(const char *name)
+FARPROC QWindowsOpengl32DLL::resolve(const char *name)
{
-#ifndef Q_OS_WINCE
- void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, name) : 0;
-#else
- void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0;
-#endif
-
- return proc;
+ return m_lib ? ::GetProcAddress(m_lib, name) : nullptr;
}
bool QWindowsOpengl32DLL::init(bool softwareRendering)
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h
index e8c78860f2..4c804a612e 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.h
+++ b/src/plugins/platforms/windows/qwindowsglcontext.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSGLCONTEXT_H
#define QWINDOWSGLCONTEXT_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include "qwindowsopenglcontext.h"
#include <QtGui/QOpenGLContext>
@@ -122,7 +122,7 @@ struct QWindowsOpengl32DLL
void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params);
const GLubyte * (APIENTRY * glGetString)(GLenum name);
- void *resolve(const char *name);
+ FARPROC resolve(const char *name);
private:
HMODULE m_lib;
bool m_nonOpengl32;
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 501b956a68..8adbd494c4 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -190,11 +190,7 @@ bool QWindowsInputContext::hasCapability(Capability capability) const
{
switch (capability) {
case QPlatformInputContext::HiddenTextCapability:
-#ifndef Q_OS_WINCE
return false; // QTBUG-40691, do not show IME on desktop for password entry fields.
-#else
- break; // Windows CE: Show software keyboard.
-#endif
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h
index 4c08fa0ef2..a7fa2c4f94 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.h
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSINPUTCONTEXT_H
#define QWINDOWSINPUTCONTEXT_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QLocale>
#include <QtCore/QPointer>
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 6142aac92e..5b8cc7893a 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -64,7 +64,7 @@
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qwindowsysteminterface.h>
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#ifndef QT_NO_SESSIONMANAGER
# include "qwindowssessionmanager.h"
#endif
#include <QtGui/qtouchdevice.h>
@@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
It should compile with:
\list
- \li Microsoft Visual Studio 2008 or later (using the Microsoft Windows SDK,
+ \li Microsoft Visual Studio 2013 or later (using the Microsoft Windows SDK,
(\c Q_CC_MSVC).
\li Stock \l{http://mingw.org/}{MinGW} (\c Q_CC_MINGW).
This version ships with headers that are missing a lot of WinAPI.
@@ -112,15 +112,8 @@ QT_BEGIN_NAMESPACE
(\c Q_CC_MINGW and \c __MINGW64_VERSION_MAJOR indicating the version).
MinGW-w64 provides more complete headers (compared to stock MinGW from mingw.org),
including a considerable part of the Windows SDK.
- \li Visual Studio 2008 for Windows Embedded (\c Q_OS_WINCE).
\endlist
- The file \c qtwindows_additional.h contains defines and declarations that
- are missing in MinGW. When encountering missing declarations, it should
- be added there so that \c #ifdefs for MinGW can be avoided. Similarly,
- \c qplatformfunctions_wince.h contains defines and declarations for
- Windows Embedded.
-
When using a function from the WinAPI, the minimum supported Windows version
and Windows Embedded support should be checked. If the function is not supported
on Windows XP or is not present in the MinGW-headers, it should be dynamically
@@ -215,9 +208,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList &paramL
: m_options(0)
, m_fontDatabase(0)
{
-#ifndef Q_OS_WINCE
Q_INIT_RESOURCE(openglblacklists);
-#endif
static bool dpiAwarenessSet = false;
int tabletAbsoluteRange = -1;
@@ -474,46 +465,16 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext()
}
#endif // !QT_NO_OPENGL
-/* Workaround for QTBUG-24205: In 'Auto', pick the FreeType engine for
- * QML2 applications. */
-
-#ifdef Q_OS_WINCE
-// It's not easy to detect if we are running a QML application
-// Let's try to do so by checking if the Qt Quick module is loaded.
-inline bool isQMLApplication()
-{
- // check if the Qt Quick module is loaded
-#ifdef _DEBUG
- HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L"d.dll");
-#else
- HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L".dll");
-#endif
- return (handle != NULL);
-}
-#endif
-
QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const
{
if (!d->m_fontDatabase) {
#ifdef QT_NO_FREETYPE
d->m_fontDatabase = new QWindowsFontDatabase();
#else // QT_NO_FREETYPE
- if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) {
+ if (d->m_options & QWindowsIntegration::FontDatabaseFreeType)
d->m_fontDatabase = new QWindowsFontDatabaseFT;
- } else if (d->m_options & QWindowsIntegration::FontDatabaseNative){
- d->m_fontDatabase = new QWindowsFontDatabase;
- } else {
-#ifndef Q_OS_WINCE
+ else
d->m_fontDatabase = new QWindowsFontDatabase;
-#else
- if (isQMLApplication()) {
- qCDebug(lcQpaFonts) << "QML application detected, using FreeType rendering";
- d->m_fontDatabase = new QWindowsFontDatabaseFT;
- }
- else
- d->m_fontDatabase = new QWindowsFontDatabase;
-#endif
- }
#endif // QT_NO_FREETYPE
}
return d->m_fontDatabase;
@@ -601,7 +562,7 @@ unsigned QWindowsIntegration::options() const
return d->m_options;
}
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const QString &id, const QString &key) const
{
return new QWindowsSessionManager(id, key);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 9658ef711d..437253cedc 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -104,7 +104,7 @@ public:
void beep() const Q_DECL_OVERRIDE;
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
+#if !defined(QT_NO_SESSIONMANAGER)
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE;
#endif
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
index 2dfe7fc5f9..21ebee6262 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp
@@ -39,7 +39,6 @@
#include "qwindowsinternalmimedata.h"
#include "qwindowscontext.h"
-#include "qplatformfunctions_wince.h"
#include "qwindowsmime.h"
#include <QDebug>
/*!
diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
index 4ac7a303af..4d775b1f21 100644
--- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h
+++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSINTERNALMIME_H
#define QWINDOWSINTERNALMIME_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtGui/private/qdnd_p.h> // QInternalMime
#include <QtCore/QVariant>
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index 5b2370b69d..8d6e83298e 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -552,34 +552,6 @@ inline quint32 winceKeyBend(quint32 keyCode)
return KeyTbl[keyCode];
}
-#ifdef Q_OS_WINCE
-QT_BEGIN_INCLUDE_NAMESPACE
-int ToUnicode(UINT vk, int /*scancode*/, unsigned char* /*kbdBuffer*/, LPWSTR unicodeBuffer, int, int)
-{
- QT_USE_NAMESPACE
- QChar* buf = reinterpret_cast< QChar*>(unicodeBuffer);
- if (KeyTbl[vk] == 0) {
- buf[0] = vk;
- return 1;
- }
- return 0;
-}
-
-int ToAscii(UINT vk, int scancode, unsigned char *kbdBuffer, LPWORD unicodeBuffer, int flag)
-{
- return ToUnicode(vk, scancode, kbdBuffer, (LPWSTR) unicodeBuffer, 0, flag);
-
-}
-
-bool GetKeyboardState(unsigned char* kbuffer)
-{
- for (int i=0; i< 256; ++i)
- kbuffer[i] = GetAsyncKeyState(i);
- return true;
-}
-QT_END_INCLUDE_NAMESPACE
-#endif // Q_OS_WINCE
-
// Translate a VK into a Qt key code, or unicode character
static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0)
{
@@ -780,7 +752,6 @@ static void showSystemMenu(QWindow* w)
if (!menu)
return; // no menu for this window
-#ifndef Q_OS_WINCE
#define enabled (MF_BYCOMMAND | MF_ENABLED)
#define disabled (MF_BYCOMMAND | MF_GRAYED)
@@ -805,7 +776,6 @@ static void showSystemMenu(QWindow* w)
#undef enabled
#undef disabled
-#endif // !Q_OS_WINCE
const QPoint pos = QHighDpi::toNativePixels(topLevel->geometry().topLeft(), topLevel);
const int ret = TrackPopupMenuEx(menu,
TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD,
@@ -1172,7 +1142,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
modifiers, scancode, quint32(msg.wParam), nModifiers, text, false);
result =true;
bool store = true;
-#ifndef Q_OS_WINCE
// Alt+<alphanumerical> go to the Win32 menu system if unhandled by Qt
if (msgType == WM_SYSKEYDOWN && !result && a) {
HWND parent = GetParent(QWindowsWindow::handleOf(receiver));
@@ -1186,7 +1155,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
parent = GetParent(parent);
}
}
-#endif // !Q_OS_WINCE
if (!store)
key_recorder.findKey(int(msg.wParam), true);
}
@@ -1216,7 +1184,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
nModifiers,
(rec ? rec->text : QString()), false);
result = true;
-#ifndef Q_OS_WINCE
// don't pass Alt to Windows unless we are embedded in a non-Qt window
if (code == Qt::Key_Alt) {
const QWindowsContext *context = QWindowsContext::instance();
@@ -1229,7 +1196,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
parent = GetParent(parent);
}
}
-#endif
}
}
return result;
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h
index e21c913156..069f78197e 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.h
+++ b/src/plugins/platforms/windows/qwindowskeymapper.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSKEYMAPPER_H
#define QWINDOWSKEYMAPPER_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QLocale>
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index cb112446fc..d6375693d8 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -403,11 +403,9 @@ QDebug operator<<(QDebug d, const FORMATETC &tc)
case CF_UNICODETEXT:
d << "CF_UNICODETEXT";
break;
-#ifndef Q_OS_WINCE
case CF_ENHMETAFILE:
d << "CF_ENHMETAFILE";
break;
-#endif // !Q_OS_WINCE
default:
d << QWindowsMimeConverter::clipboardFormatName(tc.cfFormat);
break;
diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h
index b727f13747..4c0cbf9f31 100644
--- a/src/plugins/platforms/windows/qwindowsmime.h
+++ b/src/plugins/platforms/windows/qwindowsmime.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSMIME_H
#define QWINDOWSMIME_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QVector>
#include <QtCore/QList>
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 78fff65d84..45fbb4fdd3 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -56,6 +56,37 @@
#include <windowsx.h>
+/* Touch is supported from Windows 7 onwards and data structures
+ * are present in the Windows SDK's, but not in older MSVC Express
+ * versions. */
+
+#if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE)
+
+typedef struct tagTOUCHINPUT {
+ LONG x;
+ LONG y;
+ HANDLE hSource;
+ DWORD dwID;
+ DWORD dwFlags;
+ DWORD dwMask;
+ DWORD dwTime;
+ ULONG_PTR dwExtraInfo;
+ DWORD cxContact;
+ DWORD cyContact;
+} TOUCHINPUT, *PTOUCHINPUT;
+typedef TOUCHINPUT const * PCTOUCHINPUT;
+
+# define TOUCHEVENTF_MOVE 0x0001
+# define TOUCHEVENTF_DOWN 0x0002
+# define TOUCHEVENTF_UP 0x0004
+# define TOUCHEVENTF_INRANGE 0x0008
+# define TOUCHEVENTF_PRIMARY 0x0010
+# define TOUCHEVENTF_NOCOALESCE 0x0020
+# define TOUCHEVENTF_PALM 0x0080
+# define TOUCHINPUTMASKF_CONTACTAREA 0x0004
+# define TOUCHINPUTMASKF_EXTRAINFO 0x0002
+#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE)
+
QT_BEGIN_NAMESPACE
static inline void compressMouseMove(MSG *msg)
@@ -203,7 +234,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
-#ifndef Q_OS_WINCE
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
static const bool passSynthesizedMouseEvents =
!(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch);
@@ -218,7 +248,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
return false;
}
}
-#endif // !Q_OS_WINCE
const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
if (et & QtWindows::NonClientEventFlag) {
@@ -320,7 +349,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
const bool hasCapture = platformWindow->hasMouseCapture();
const bool currentNotCapturing = hasCapture && currentWindowUnderMouse != window;
-#ifndef Q_OS_WINCE
// Enter new window: track to generate leave event.
// If there is an active capture, only track if the current window is capturing,
// so we don't get extra leave when cursor leaves the application.
@@ -334,7 +362,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
qWarning("TrackMouseEvent failed.");
m_trackedWindow = window;
}
-#endif // !Q_OS_WINCE
// No enter or leave events are sent as long as there is an autocapturing window.
if (!hasCapture || !platformWindow->testFlag(QWindowsWindow::AutoMouseCapture)) {
@@ -487,7 +514,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
-#ifndef Q_OS_WINCE
typedef QWindowSystemInterface::TouchPoint QTouchPoint;
typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList;
@@ -563,109 +589,17 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QWindowSystemInterface::handleTouchEvent(window,
m_touchDevice,
touchPoints);
-#else // !Q_OS_WINCE
- Q_UNUSED(window)
- Q_UNUSED(msg)
-#endif
return true;
-
}
bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
-#ifndef Q_OS_WINCE
Q_UNUSED(window)
Q_UNUSED(hwnd)
Q_UNUSED(msg)
return false;
-#else // !Q_OS_WINCE
- GESTUREINFO gi;
- memset(&gi, 0, sizeof(GESTUREINFO));
- gi.cbSize = sizeof(GESTUREINFO);
-
- if (!GetGestureInfo((HGESTUREINFO)msg.lParam, &gi))
- return false;
-
- const QPoint position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
-
- if (gi.dwID != GID_DIRECTMANIPULATION)
- return true;
- static QPoint lastTouchPos;
- const QScreen *screen = window->screen();
- if (!screen)
- screen = QGuiApplication::primaryScreen();
- if (!screen)
- return true;
- const QRect screenGeometry = screen->geometry();
- QWindowSystemInterface::TouchPoint touchPoint;
- static QWindowSystemInterface::TouchPoint touchPoint2;
- touchPoint.id = 0;//gi.dwInstanceID;
- touchPoint.pressure = 1.0;
-
- if (gi.dwFlags & GF_BEGIN)
- touchPoint.state = Qt::TouchPointPressed;
- else if (gi.dwFlags & GF_END)
- touchPoint.state = Qt::TouchPointReleased;
- else if (gi.dwFlags == 0)
- touchPoint.state = Qt::TouchPointMoved;
- else
- return true;
- touchPoint2.pressure = 1.0;
- touchPoint2.id = 1;
- const QPoint winEventPosition = position;
- const int deltaX = GID_DIRECTMANIPULATION_DELTA_X(gi.ullArguments);
- const int deltaY = GID_DIRECTMANIPULATION_DELTA_Y(gi.ullArguments);
- //Touch points are taken from the whole screen so map the position to the screen
- const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition);
- const QPoint globalPosition2 = QWindowsGeometryHint::mapToGlobal(hwnd, QPoint(position.x() + deltaX, position.y() + deltaY));
-
- touchPoint.normalPosition =
- QPointF( (qreal)globalPosition.x() / screenGeometry.width(), (qreal)globalPosition.y() / screenGeometry.height() );
-
- touchPoint.area.moveCenter(globalPosition);
-
- QList<QWindowSystemInterface::TouchPoint> pointList;
- pointList.append(touchPoint);
- if (deltaX != 0 && deltaY != 0) {
- touchPoint2.state = m_had2ndTouchPoint ? Qt::TouchPointMoved : Qt::TouchPointPressed;
- m_had2ndTouchPoint = true;
- touchPoint2.normalPosition =
- QPointF( (qreal)globalPosition2.x() / screenGeometry.width(), (qreal)globalPosition2.y() / screenGeometry.height() );
-
- touchPoint2.area.moveCenter(globalPosition2);
- lastTouchPos = globalPosition2;
- pointList.append(touchPoint2);
- } else if (m_had2ndTouchPoint) {
- touchPoint2.normalPosition =
- QPointF( (qreal)lastTouchPos.x() / screenGeometry.width(), (qreal)lastTouchPos.y() / screenGeometry.height() );
-
- touchPoint2.area.moveCenter(lastTouchPos);
- touchPoint2.state = Qt::TouchPointReleased;
- pointList.append(touchPoint2);
- m_had2ndTouchPoint = false;
- }
-
- if (!m_touchDevice) {
- m_touchDevice = new QTouchDevice;
- // TODO: Device used to be hardcoded to screen in previous code.
- m_touchDevice->setType(QTouchDevice::TouchScreen);
- m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition);
- QWindowSystemInterface::registerTouchDevice(m_touchDevice);
- }
-
- QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, pointList);
- // handle window focusing in/out
- if (window != m_windowUnderMouse) {
- if (m_windowUnderMouse)
- QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse);
- if (window)
- QWindowSystemInterface::handleEnterEvent(window);
- m_windowUnderMouse = window;
- }
- return true;
-#endif // Q_OS_WINCE
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index d16c9f9e02..bd36d9f44c 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -41,7 +41,7 @@
#define QWINDOWSMOUSEHANDLER_H
#include "qtwindowsglobal.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QPointer>
#include <QtCore/QHash>
@@ -91,10 +91,6 @@ private:
QTouchDevice *m_touchDevice;
bool m_leftButtonDown;
QWindow *m_previousCaptureWindow;
-#ifdef Q_OS_WINCE
-//This is required to send a touch up if we don't get a second touch position any more
- bool m_had2ndTouchPoint;
-#endif
};
Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam)
diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp
index bc8bfda32b..ec9683ea8d 100644
--- a/src/plugins/platforms/windows/qwindowsnativeimage.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp
@@ -126,9 +126,7 @@ QWindowsNativeImage::QWindowsNativeImage(int width, int height,
m_image = QImage(width, height, format);
}
-#ifndef Q_OS_WINCE
GdiFlush();
-#endif
}
QWindowsNativeImage::~QWindowsNativeImage()
diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.h b/src/plugins/platforms/windows/qwindowsnativeimage.h
index c96ca7937a..bfe0f07dfd 100644
--- a/src/plugins/platforms/windows/qwindowsnativeimage.h
+++ b/src/plugins/platforms/windows/qwindowsnativeimage.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSNATIVEIMAGE_H
#define QWINDOWSNATIVEIMAGE_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtGui/QImage>
diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h
index 009111e55c..dc31c793e9 100644
--- a/src/plugins/platforms/windows/qwindowsole.h
+++ b/src/plugins/platforms/windows/qwindowsole.h
@@ -40,7 +40,7 @@
#ifndef QWINDOWSOLE_H
#define QWINDOWSOLE_H
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QMap>
#include <QtCore/QPointer>
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index 4ca7f0e413..d5d50a69cd 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -54,17 +54,14 @@
#include <private/qopengl_p.h>
#endif
-#ifndef Q_OS_WINCE
-# include <QtCore/qt_windows.h>
-# include <private/qsystemlibrary_p.h>
-# include <d3d9.h>
-#endif
+#include <QtCore/qt_windows.h>
+#include <private/qsystemlibrary_p.h>
+#include <d3d9.h>
QT_BEGIN_NAMESPACE
GpuDescription GpuDescription::detect()
{
-#ifndef Q_OS_WINCE
typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT);
GpuDescription result;
@@ -95,13 +92,6 @@ GpuDescription GpuDescription::detect()
result.description = adapterIdentifier.Description;
}
return result;
-#else // !Q_OS_WINCE
- GpuDescription result;
- result.vendorId = result.deviceId = result.revision =1;
- result.driverVersion = QVersionNumber(1, 1, 1);
- result.driverName = result.description = QByteArrayLiteral("Generic");
- return result;
-#endif
}
#ifndef QT_NO_DEBUG_STREAM
@@ -155,7 +145,6 @@ QVariant GpuDescription::toVariant() const
QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer()
{
-#ifndef Q_OS_WINCE
const char platformVar[] = "QT_ANGLE_PLATFORM";
if (qEnvironmentVariableIsSet(platformVar)) {
const QByteArray anglePlatform = qgetenv(platformVar);
@@ -167,13 +156,11 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer()
return QWindowsOpenGLTester::AngleRendererD3d11Warp;
qCWarning(lcQpaGl) << "Invalid value set for " << platformVar << ": " << anglePlatform;
}
-#endif // !Q_OS_WINCE
return QWindowsOpenGLTester::InvalidRenderer;
}
QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer()
{
-#ifndef Q_OS_WINCE
const char openGlVar[] = "QT_OPENGL";
if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES)) {
const Renderer glesRenderer = QWindowsOpenGLTester::requestedGlesRenderer();
@@ -195,12 +182,9 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer()
return QWindowsOpenGLTester::SoftwareRasterizer;
qCWarning(lcQpaGl) << "Invalid value set for " << openGlVar << ": " << requested;
}
-#endif // !Q_OS_WINCE
return QWindowsOpenGLTester::InvalidRenderer;
}
-#ifndef Q_OS_WINCE
-
static inline QString resolveBugListFile(const QString &fileName)
{
if (QFileInfo(fileName).isAbsolute())
@@ -216,12 +200,10 @@ static inline QString resolveBugListFile(const QString &fileName)
return QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName);
}
-# ifndef QT_NO_OPENGL
+#ifndef QT_NO_OPENGL
typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRenderersCache;
Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache)
-# endif
-
-#endif // !Q_OS_WINCE
+#endif
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly)
{
@@ -229,8 +211,6 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
Q_UNUSED(glesOnly)
#if defined(QT_NO_OPENGL)
return 0;
-#elif defined(Q_OS_WINCE)
- return QWindowsOpenGLTester::Gles;
#else
QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description);
SupportedRenderersCache *srCache = supportedRenderersCache();
@@ -280,7 +260,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c
}
srCache->insert(qgpu, result);
return result;
-#endif // !Q_OS_WINCE && !QT_NO_OPENGL
+#endif // !QT_NO_OPENGL
}
QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers()
@@ -301,7 +281,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers()
bool QWindowsOpenGLTester::testDesktopGL()
{
-#if !defined(QT_NO_OPENGL) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_OPENGL)
HMODULE lib = 0;
HWND wnd = 0;
HDC dc = 0;
@@ -428,7 +408,7 @@ cleanup:
return result;
#else
return false;
-#endif // !QT_NO_OPENGL && !Q_OS_WINCE
+#endif // !QT_NO_OPENGL
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index b476c9be1d..23d43a95a5 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -43,7 +43,7 @@
#include "qwindowsintegration.h"
#include "qwindowscursor.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QSettings>
#include <QtGui/QPixmap>
@@ -68,8 +68,6 @@ static inline QDpi deviceDPI(HDC hdc)
return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY));
}
-#ifndef Q_OS_WINCE
-
static inline QDpi monitorDPI(HMONITOR hMonitor)
{
if (QWindowsContext::shcoredll.isValid()) {
@@ -81,8 +79,6 @@ static inline QDpi monitorDPI(HMONITOR hMonitor)
return QDpi(0, 0);
}
-#endif // !Q_OS_WINCE
-
typedef QList<QWindowsScreenData> WindowsScreenDataList;
static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
@@ -99,20 +95,9 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
if (data->name == QLatin1String("WinDisc")) {
data->flags |= QWindowsScreenData::LockScreen;
} else {
-#ifdef Q_OS_WINCE
- //Windows CE, just supports one Display and expects to get only DISPLAY,
- //instead of DISPLAY0 and so on, which are passed by info.szDevice
- HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
-#else
- HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL);
-#endif
- if (hdc) {
-#ifndef Q_OS_WINCE
+ if (const HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL)) {
const QDpi dpi = monitorDPI(hMonitor);
data->dpi = dpi.first ? dpi : deviceDPI(hdc);
-#else
- data->dpi = deviceDPI(hdc);
-#endif
data->depth = GetDeviceCaps(hdc, BITSPIXEL);
data->format = data->depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
data->physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE));
@@ -330,7 +315,6 @@ enum OrientationPreference // matching Win32 API ORIENTATION_PREFERENCE
bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o)
{
bool result = false;
-#ifndef Q_OS_WINCE
if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) {
DWORD orientationPreference = 0;
switch (o) {
@@ -352,14 +336,12 @@ bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o)
}
result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference);
}
-#endif // !Q_OS_WINCE
return result;
}
Qt::ScreenOrientation QWindowsScreen::orientationPreference()
{
Qt::ScreenOrientation result = Qt::PrimaryOrientation;
-#ifndef Q_OS_WINCE
if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) {
DWORD orientationPreference = 0;
if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) {
@@ -379,7 +361,6 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference()
}
}
}
-#endif // !Q_OS_WINCE
return result;
}
@@ -388,7 +369,7 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference()
*/
QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const
{
-#if defined(Q_OS_WINCE) || !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
+#if !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
return QPlatformScreen::Subpixel_None;
#else
QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint();
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 2afc410e07..02a9dc3bc3 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -41,9 +41,6 @@
#define QWINDOWSSCREEN_H
#include "qtwindowsglobal.h"
-#ifdef Q_OS_WINCE
-# include "qplatformfunctions_wince.h"
-#endif
#include <QtCore/QList>
#include <QtCore/QVector>
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp
index 3c99e3507e..d559273950 100644
--- a/src/plugins/platforms/windows/qwindowsservices.cpp
+++ b/src/plugins/platforms/windows/qwindowsservices.cpp
@@ -39,16 +39,14 @@
#define QT_NO_URL_CAST_FROM_STRING
#include "qwindowsservices.h"
-#include "qtwindows_additional.h"
+#include <QtCore/qt_windows.h>
#include <QtCore/QUrl>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <shlobj.h>
-#ifndef Q_OS_WINCE
-# include <intshcut.h>
-#endif
+#include <intshcut.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +54,6 @@ enum { debug = 0 };
static inline bool shellExecute(const QUrl &url)
{
-#ifndef Q_OS_WINCE
const QString nativeFilePath =
url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded);
const quintptr result =
@@ -69,10 +66,6 @@ static inline bool shellExecute(const QUrl &url)
return false;
}
return true;
-#else
- Q_UNUSED(url);
- return false;
-#endif
}
// Retrieve the commandline for the default mail client. It contains a
@@ -107,13 +100,9 @@ static inline QString mailCommand()
}
if (!command[0])
return QString();
-#ifndef Q_OS_WINCE
wchar_t expandedCommand[MAX_PATH] = {0};
return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ?
QString::fromWCharArray(expandedCommand) : QString::fromWCharArray(command);
-#else
- return QString();
-#endif
}
static inline bool launchMail(const QUrl &url)
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index 4a24d62770..2c05dcddfc 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -42,7 +42,7 @@
#include "qtwindowsglobal.h"
-#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
+#if !defined(QT_NO_TABLETEVENT)
#include <QtCore/QVector>
#include <QtCore/QPointF>
@@ -143,5 +143,5 @@ private:
QT_END_NAMESPACE
-#endif // !QT_NO_TABLETEVENT && !Q_OS_WINCE
+#endif // !QT_NO_TABLETEVENT
#endif // QWINDOWSTABLETSUPPORT_H
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 4bf424f5f6..6c6eb42d63 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -49,17 +49,12 @@
#include "qwindowsintegration.h"
#include "qt_windows.h"
#include "qwindowsfontdatabase.h"
-#ifdef Q_OS_WINCE
-# include "qplatformfunctions_wince.h"
-# include "winuser.h"
-#else
-# include <commctrl.h>
-# include <objbase.h>
-# ifndef Q_CC_MINGW
-# include <commoncontrols.h>
-# endif
-# include <shellapi.h>
+#include <commctrl.h>
+#include <objbase.h>
+#ifndef Q_CC_MINGW
+# include <commoncontrols.h>
#endif
+#include <shellapi.h>
#include <QtCore/QVariant>
#include <QtCore/QCoreApplication>
@@ -128,7 +123,6 @@ static inline QColor getSysColor(int index)
return COLORREFToQColor(GetSysColor(index));
}
-#ifndef QT_NO_WINCE_SHELLSDK
// QTBUG-48823/Windows 10: SHGetFileInfo() (as called by item views on file system
// models has been observed to trigger a WM_PAINT on the mainwindow. Suppress the
// behavior by running it in a thread.
@@ -170,7 +164,6 @@ static bool shGetFileInfoBackground(QWindowsThreadPoolRunner &r,
}
return result;
}
-#endif // !QT_NO_WINCE_SHELLSDK
// from QStyle::standardPalette
static inline QPalette standardPalette()
@@ -281,14 +274,9 @@ static inline QPalette menuPalette(const QPalette &systemPalette)
result.setColor(QPalette::Active, QPalette::ButtonText, menuTextColor);
result.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
result.setColor(QPalette::Disabled, QPalette::Text, disabled);
-#ifndef Q_OS_WINCE
const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false);
result.setColor(QPalette::Disabled, QPalette::Highlight,
getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT));
-#else
- result.setColor(QPalette::Disabled, QPalette::Highlight,
- getSysColor(COLOR_HIGHLIGHT));
-#endif
result.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled);
result.setColor(QPalette::Disabled, QPalette::Button,
result.color(QPalette::Active, QPalette::Button));
@@ -314,11 +302,7 @@ static inline QPalette *menuBarPalette(const QPalette &menuPalette)
QPalette *result = 0;
if (booleanSystemParametersInfo(SPI_GETFLATMENU, false)) {
result = new QPalette(menuPalette);
-#ifndef Q_OS_WINCE
const QColor menubar(getSysColor(COLOR_MENUBAR));
-#else
- const QColor menubar(getSysColor(COLOR_MENU));
-#endif
result->setColor(QPalette::Active, QPalette::Button, menubar);
result->setColor(QPalette::Disabled, QPalette::Button, menubar);
result->setColor(QPalette::Inactive, QPalette::Button, menubar);
@@ -388,12 +372,10 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const
return QVariant(iconThemeSearchPaths());
case StyleNames:
return QVariant(styleNames());
-#ifndef Q_OS_WINCE
case TextCursorWidth:
return QVariant(int(dWordSystemParametersInfo(SPI_GETCARETWIDTH, 1u)));
case DropShadow:
return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false));
-#endif // !Q_OS_WINCE
case MaximumScrollBarDragDistance:
return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375));
case KeyboardScheme:
@@ -447,7 +429,6 @@ void QWindowsTheme::clearFonts()
void QWindowsTheme::refreshFonts()
{
-#ifndef Q_OS_WINCE // ALL THIS FUNCTIONALITY IS MISSING ON WINCE
clearFonts();
if (!QGuiApplication::desktopSettingsAware())
return;
@@ -476,7 +457,6 @@ void QWindowsTheme::refreshFonts()
m_fonts[DockWidgetTitleFont] = new QFont(titleFont);
m_fonts[ItemViewFont] = new QFont(iconTitleFont);
m_fonts[FixedFont] = new QFont(fixedFont);
-#endif // !Q_OS_WINCE
}
bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const
@@ -500,12 +480,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
static QPixmap loadIconFromShell32(int resourceId, QSizeF size)
{
-#ifdef Q_OS_WINCE
- HMODULE hmod = LoadLibrary(L"ceshell");
-#else
- HMODULE hmod = QSystemLibrary::load(L"shell32");
-#endif
- if (hmod) {
+ if (const HMODULE hmod = QSystemLibrary::load(L"shell32")) {
HICON iconHandle =
static_cast<HICON>(LoadImage(hmod, MAKEINTRESOURCE(resourceId),
IMAGE_ICON, int(size.width()), int(size.height()), 0));
@@ -521,7 +496,7 @@ static QPixmap loadIconFromShell32(int resourceId, QSizeF size)
QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSize) const
{
int resourceId = -1;
- int stockId = SIID_INVALID;
+ SHSTOCKICONID stockId = SIID_INVALID;
UINT stockFlags = 0;
LPCTSTR iconName = 0;
switch (sp) {
@@ -584,7 +559,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
stockId = SIID_RECYCLER;
resourceId = 191;
break;
-#ifndef Q_OS_WINCE
case MessageBoxInformation:
stockId = SIID_INFO;
iconName = IDI_INFORMATION;
@@ -604,29 +578,22 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz
case VistaShield:
stockId = SIID_SHIELD;
break;
-#endif
default:
break;
}
-#ifndef Q_OS_WINCE
if (stockId != SIID_INVALID) {
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
- && QWindowsContext::shell32dll.sHGetStockIconInfo) {
- QPixmap pixmap;
- SHSTOCKICONINFO iconInfo;
- memset(&iconInfo, 0, sizeof(iconInfo));
- iconInfo.cbSize = sizeof(iconInfo);
- stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON);
- if (QWindowsContext::shell32dll.sHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) {
- pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon);
- DestroyIcon(iconInfo.hIcon);
- return pixmap;
- }
+ QPixmap pixmap;
+ SHSTOCKICONINFO iconInfo;
+ memset(&iconInfo, 0, sizeof(iconInfo));
+ iconInfo.cbSize = sizeof(iconInfo);
+ stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON);
+ if (SHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) {
+ pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon);
+ DestroyIcon(iconInfo.hIcon);
+ return pixmap;
}
}
-#endif
if (resourceId != -1) {
QPixmap pixmap = loadIconFromShell32(resourceId, pixmapSize);
@@ -701,14 +668,8 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info)
// For MinGW:
static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}};
- if (!QWindowsContext::shell32dll.sHGetImageList)
- return result;
- if (iImageList == sHIL_JUMBO && QSysInfo::WindowsVersion < QSysInfo::WV_VISTA)
- return result;
-
IImageList *imageList = 0;
- HRESULT hr = QWindowsContext::shell32dll.sHGetImageList(iImageList, iID_IImageList,
- reinterpret_cast<void **>(&imageList));
+ HRESULT hr = SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList));
if (hr != S_OK)
return result;
HICON hIcon;
@@ -764,22 +725,13 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
SHFILEINFO info;
const unsigned int flags =
-#ifndef Q_OS_WINCE
SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX;
-#else
- iconSize|SHGFI_SYSICONINDEX;
-#endif // Q_OS_WINCE
-
-#if !defined(QT_NO_WINCE_SHELLSDK)
const bool val = cacheableDirIcon && useDefaultFolderIcon
? shGetFileInfoBackground(m_threadPoolRunner, L"dummy", FILE_ATTRIBUTE_DIRECTORY,
&info, flags | SHGFI_USEFILEATTRIBUTES)
: shGetFileInfoBackground(m_threadPoolRunner, reinterpret_cast<const wchar_t *>(filePath.utf16()), 0,
&info, flags);
-#else
- const bool val = false;
-#endif // !QT_NO_WINCE_SHELLSDK
// Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
if (val && info.hIcon) {
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 76a36851ce..3a6e6840fd 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -62,6 +62,8 @@
#include <QtCore/QDebug>
+#include <dwmapi.h>
+
QT_BEGIN_NAMESPACE
enum {
@@ -147,7 +149,6 @@ QDebug operator<<(QDebug d, const POINT &p)
return d;
}
-# ifndef Q_OS_WINCE
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
{
QDebugStateSaver saver(d);
@@ -178,14 +179,12 @@ QDebug operator<<(QDebug d, const WINDOWPLACEMENT &wp)
<< ", rcNormalPosition=" << wp.rcNormalPosition;
return d;
}
-# endif // !Q_OS_WINCE
#endif // !QT_NO_DEBUG_STREAM
// QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT
// is in workspace/available area coordinates.
static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point)
{
-#ifndef Q_OS_WINCE
if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)
return QPoint(0, 0);
const QWindowsScreenManager &screenManager = QWindowsContext::instance()->screenManager();
@@ -193,10 +192,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point)
? screenManager.screens().constFirst() : screenManager.screenAtDp(point);
if (screen)
return screen->availableGeometry().topLeft() - screen->geometry().topLeft();
-#else
- Q_UNUSED(hwnd)
- Q_UNUSED(point)
-#endif
return QPoint(0, 0);
}
@@ -205,7 +200,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point)
static inline QRect frameGeometry(HWND hwnd, bool topLevel)
{
RECT rect = { 0, 0, 0, 0 };
-#ifndef Q_OS_WINCE
if (topLevel) {
WINDOWPLACEMENT windowPlacement;
windowPlacement.length = sizeof(WINDOWPLACEMENT);
@@ -215,7 +209,6 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel)
return result.translated(windowPlacementOffset(hwnd, result.topLeft()));
}
}
-#endif // !Q_OS_WINCE
GetWindowRect(hwnd, &rect); // Screen coordinates.
const HWND parent = GetParent(hwnd);
if (parent && !topLevel) {
@@ -236,7 +229,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd)
{
if (!IsWindowVisible(hwnd))
return QWindow::Hidden;
-#ifndef Q_OS_WINCE
WINDOWPLACEMENT windowPlacement;
windowPlacement.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(hwnd, &windowPlacement)) {
@@ -251,7 +243,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd)
break;
}
}
-#endif // !Q_OS_WINCE
return QWindow::Windowed;
}
@@ -269,65 +260,27 @@ static inline bool windowIsOpenGL(const QWindow *w)
static bool applyBlurBehindWindow(HWND hwnd)
{
-#ifdef Q_OS_WINCE
- Q_UNUSED(hwnd);
- return false;
-#else
- enum { dwmBbEnable = 0x1, dwmBbBlurRegion = 0x2 };
-
- struct DwmBlurBehind {
- DWORD dwFlags;
- BOOL fEnable;
- HRGN hRgnBlur;
- BOOL fTransitionOnMaximized;
- };
-
- typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND, const DwmBlurBehind*);
- typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL *);
-
- // DWM API is available only from Windows Vista
- if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
- return false;
-
- static bool functionPointersResolved = false;
- static PtrDwmEnableBlurBehindWindow dwmBlurBehind = 0;
- static PtrDwmIsCompositionEnabled dwmIsCompositionEnabled = 0;
-
- if (Q_UNLIKELY(!functionPointersResolved)) {
- QSystemLibrary library(QStringLiteral("dwmapi"));
- if (library.load()) {
- dwmBlurBehind = (PtrDwmEnableBlurBehindWindow)(library.resolve("DwmEnableBlurBehindWindow"));
- dwmIsCompositionEnabled = (PtrDwmIsCompositionEnabled)(library.resolve("DwmIsCompositionEnabled"));
- }
-
- functionPointersResolved = true;
- }
-
- if (Q_UNLIKELY(!dwmBlurBehind || !dwmIsCompositionEnabled))
- return false;
-
BOOL compositionEnabled;
- if (dwmIsCompositionEnabled(&compositionEnabled) != S_OK)
+ if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK)
return false;
- DwmBlurBehind blurBehind = {0, 0, 0, 0};
+ DWM_BLURBEHIND blurBehind = {0, 0, 0, 0};
if (compositionEnabled) {
- blurBehind.dwFlags = dwmBbEnable | dwmBbBlurRegion;
+ blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
blurBehind.fEnable = TRUE;
blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
} else {
- blurBehind.dwFlags = dwmBbEnable;
+ blurBehind.dwFlags = DWM_BB_ENABLE;
blurBehind.fEnable = FALSE;
}
- const bool result = dwmBlurBehind(hwnd, &blurBehind) == S_OK;
+ const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK;
if (blurBehind.hRgnBlur)
DeleteObject(blurBehind.hRgnBlur);
return result;
-#endif // Q_OS_WINCE
}
// from qwidget_win.cpp, pass flags separately in case they have been "autofixed".
@@ -346,7 +299,6 @@ static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags)
// Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT).
bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity)
{
-#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED
const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
const bool needsLayered = (flags & Qt::WindowTransparentForInput)
|| (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0;
@@ -359,36 +311,22 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has
}
}
return needsLayered;
-#else // !Q_OS_WINCE
- Q_UNUSED(hwnd);
- Q_UNUSED(flags);
- Q_UNUSED(hasAlpha);
- Q_UNUSED(opacity);
- return false;
-#endif // Q_OS_WINCE
}
static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool openGL, qreal level)
{
-#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls
- Q_UNUSED(hwnd);
- Q_UNUSED(flags);
- Q_UNUSED(hasAlpha);
- Q_UNUSED(level);
-#else
if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) {
const BYTE alpha = BYTE(qRound(255.0 * level));
if (hasAlpha && !openGL && (flags & Qt::FramelessWindowHint)) {
// Non-GL windows with alpha: Use blend function to update.
BLENDFUNCTION blend = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA};
- QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
+ UpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
} else {
- QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA);
}
} else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered.
InvalidateRect(hwnd, NULL, TRUE);
}
-#endif // !Q_OS_WINCE
}
static inline void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity)
@@ -604,12 +542,10 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
exStyle |= WS_EX_TOOLWINDOW;
}
-#ifndef Q_OS_WINCE
// make mouse events fall through this window
// NOTE: WS_EX_TRANSPARENT flag can make mouse inputs fall through a layered window
if (flagsIn & Qt::WindowTransparentForInput)
exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT;
-#endif
}
}
@@ -650,10 +586,6 @@ QWindowsWindowData
context->frameX, context->frameY,
context->frameWidth, context->frameHeight,
parentHandle, NULL, appinst, NULL);
-#ifdef Q_OS_WINCE
- if (DisableGestures(result.hwnd, TGF_GID_ALL, TGF_SCOPE_WINDOW))
- EnableGestures(result.hwnd, TGF_GID_DIRECTMANIPULATION, TGF_SCOPE_WINDOW);
-#endif
qCDebug(lcQpaWindows).nospace()
<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
<< context->obtainedGeometry << ' ' << context->margins;
@@ -764,9 +696,7 @@ bool QWindowsGeometryHint::validSize(const QSize &s) const
QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle)
{
RECT rect = {0,0,0,0};
-#ifndef Q_OS_WINCE
style &= ~(WS_OVERLAPPED); // Not permitted, see docs.
-#endif
if (!AdjustWindowRectEx(&rect, style, FALSE, exStyle))
qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__);
const QMargins result(qAbs(rect.left), qAbs(rect.top),
@@ -779,7 +709,6 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle)
bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result)
{
-#ifndef Q_OS_WINCE
// NCCALCSIZE_PARAMS structure if wParam==TRUE
if (!msg.wParam || customMargins.isNull())
return false;
@@ -795,15 +724,8 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co
<< ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2]
<< ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy;
return true;
-#else
- Q_UNUSED(customMargins)
- Q_UNUSED(msg)
- Q_UNUSED(result)
- return false;
-#endif
}
-#ifndef Q_OS_WINCE
void QWindowsGeometryHint::applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const
{
return applyToMinMaxInfo(DWORD(GetWindowLong(hwnd, GWL_STYLE)),
@@ -835,7 +757,6 @@ void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXI
<< " frame=" << margins << ' ' << frameWidth << ',' << frameHeight
<< " out " << *mmi;
}
-#endif // !Q_OS_WINCE
bool QWindowsGeometryHint::positionIncludesFrame(const QWindow *w)
{
@@ -1080,9 +1001,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
m_dropTarget(0),
m_savedStyle(0),
m_format(aWindow->requestedFormat()),
-#ifdef Q_OS_WINCE
- m_previouslyHidden(false),
-#endif
m_iconSmall(0),
m_iconBig(0),
m_surface(0)
@@ -1116,10 +1034,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
QWindowsWindow::~QWindowsWindow()
{
setFlag(WithinDestroy);
-#ifndef Q_OS_WINCE
if (testFlag(TouchRegistered))
QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd);
-#endif // !Q_OS_WINCE
destroyWindow();
destroyIcon();
}
@@ -1163,14 +1079,6 @@ void QWindowsWindow::destroyWindow()
m_surface = 0;
}
#endif
-#ifdef Q_OS_WINCE
- if ((m_windowState & Qt::WindowFullScreen) && !m_previouslyHidden) {
- HWND handle = FindWindow(L"HHTaskBar", L"");
- if (handle) {
- ShowWindow(handle, SW_SHOW);
- }
- }
-#endif // !Q_OS_WINCE
DestroyWindow(m_data.hwnd);
context->removeWindow(m_data.hwnd);
m_data.hwnd = 0;
@@ -1338,7 +1246,6 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const
return pos;
}
-#ifndef Q_OS_WINCE
static inline HWND transientParentHwnd(HWND hwnd)
{
if (GetAncestor(hwnd, GA_PARENT) == GetDesktopWindow()) {
@@ -1348,15 +1255,18 @@ static inline HWND transientParentHwnd(HWND hwnd)
}
return 0;
}
-#endif // !Q_OS_WINCE
// Update the transient parent for a toplevel window. The concept does not
// really exist on Windows, the relationship is set by passing a parent along with !WS_CHILD
// to window creation or by setting the parent using GWL_HWNDPARENT (as opposed to
// SetParent, which would make it a real child).
+
+#ifndef GWL_HWNDPARENT
+# define GWL_HWNDPARENT (-8)
+#endif
+
void QWindowsWindow::updateTransientParent() const
{
-#ifndef Q_OS_WINCE
if (window()->type() == Qt::Popup)
return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow().
// Update transient parent.
@@ -1368,7 +1278,6 @@ void QWindowsWindow::updateTransientParent() const
newTransientParent = tw->handle();
if (newTransientParent != oldTransientParent)
SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent));
-#endif // !Q_OS_WINCE
}
static inline bool testShowWithoutActivating(const QWindow *window)
@@ -1486,16 +1395,12 @@ void QWindowsWindow::handleCompositionSettingsChanged()
static QRect normalFrameGeometry(HWND hwnd)
{
-#ifndef Q_OS_WINCE
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
if (GetWindowPlacement(hwnd, &wp)) {
const QRect result = qrectFromRECT(wp.rcNormalPosition);
return result.translated(windowPlacementOffset(hwnd, result.topLeft()));
}
-#else
- Q_UNUSED(hwnd)
-#endif
return QRect();
}
@@ -1615,7 +1520,6 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const
<< " new frame: " << frameGeometry;
bool result = false;
-#ifndef Q_OS_WINCE
const HWND hwnd = handle();
WINDOWPLACEMENT windowPlacement;
windowPlacement.length = sizeof(WINDOWPLACEMENT);
@@ -1628,9 +1532,7 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const
RECTfromQRect(frameGeometry.translated(-windowPlacementOffset(hwnd, frameGeometry.topLeft())));
windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE;
result = SetWindowPlacement(hwnd, &windowPlacement);
- } else
-#endif // !Q_OS_WINCE
- {
+ } else {
result = MoveWindow(hwnd, frameGeometry.x(), frameGeometry.y(),
frameGeometry.width(), frameGeometry.height(), true);
}
@@ -1823,18 +1725,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
setFlag(FrameDirty);
if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) {
-#ifdef Q_OS_WINCE
- HWND handle = FindWindow(L"HHTaskBar", L"");
- if (handle) {
- if (newState == Qt::WindowFullScreen) {
- BOOL hidden = ShowWindow(handle, SW_HIDE);
- if (!hidden)
- m_previouslyHidden = true;
- } else if (!m_previouslyHidden){
- ShowWindow(handle, SW_SHOW);
- }
- }
-#endif
if (newState == Qt::WindowFullScreen) {
#ifndef Q_FLATTEN_EXPOSE
UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
@@ -1846,17 +1736,13 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
// Window state but emulated by changing geometry and style.
if (!m_savedStyle) {
m_savedStyle = style();
-#ifndef Q_OS_WINCE
if (oldState == Qt::WindowMinimized || oldState == Qt::WindowMaximized) {
const QRect nf = normalFrameGeometry(m_data.hwnd);
if (nf.isValid())
m_savedFrameGeometry = nf;
} else {
-#endif
m_savedFrameGeometry = frameGeometry_sys();
-#ifndef Q_OS_WINCE
}
-#endif
}
if (m_savedStyle & WS_SYSMENU)
newStyle |= WS_SYSMENU;
@@ -1969,7 +1855,6 @@ void QWindowsWindow::propagateSizeHints()
bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &margins)
{
-#ifndef Q_OS_WINCE
if (!qWindow->isTopLevel()) // Implement hasHeightForWidth().
return false;
WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam);
@@ -1989,10 +1874,6 @@ bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *
windowPos->cx = correctedFrameGeometry.width();
windowPos->cy = correctedFrameGeometry.height();
return true;
-#else // !Q_OS_WINCE
- Q_UNUSED(message)
- return false;
-#endif
}
bool QWindowsWindow::handleGeometryChanging(MSG *message) const
@@ -2050,15 +1931,13 @@ static inline void addRectToWinRegion(const QRect &rect, HRGN *winRegion)
static HRGN qRegionToWinRegion(const QRegion &region)
{
- const QVector<QRect> rects = region.rects();
- if (rects.isEmpty())
- return NULL;
- const int rectCount = rects.size();
- if (rectCount == 1)
- return createRectRegion(region.boundingRect());
- HRGN hRegion = createRectRegion(rects.front());
- for (int i = 1; i < rectCount; ++i)
- addRectToWinRegion(rects.at(i), &hRegion);
+ auto it = region.begin();
+ const auto end = region.end();
+ if (it == end)
+ return nullptr;
+ HRGN hRegion = createRectRegion(*it);
+ while (++it != end)
+ addRectToWinRegion(*it, &hRegion);
return hRegion;
}
@@ -2087,7 +1966,6 @@ void QWindowsWindow::requestActivateWindow()
// 'Active' state handling is based in focus since it needs to work for
// child windows as well.
if (m_data.hwnd) {
-#ifndef Q_OS_WINCE
const DWORD currentThread = GetCurrentThreadId();
bool attached = false;
DWORD foregroundThread = 0;
@@ -2104,13 +1982,10 @@ void QWindowsWindow::requestActivateWindow()
attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE;
}
}
-#endif // !Q_OS_WINCE
SetForegroundWindow(m_data.hwnd);
SetFocus(m_data.hwnd);
-#ifndef Q_OS_WINCE
if (attached)
AttachThreadInput(foregroundThread, currentThread, FALSE);
-#endif // !Q_OS_WINCE
}
}
@@ -2192,7 +2067,6 @@ void QWindowsWindow::setFrameStrutEventsEnabled(bool enabled)
}
}
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
{
const QWindowsGeometryHint hint(window(), m_data.customMargins);
@@ -2263,8 +2137,6 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re
return false;
}
-#endif // !Q_OS_WINCE
-
#ifndef QT_NO_CURSOR
// Return the default cursor (Arrow) from QWindowsCursor's cache.
static inline CursorHandlePtr defaultCursor(const QWindow *w)
@@ -2331,7 +2203,6 @@ void QWindowsWindow::setCursor(const CursorHandlePtr &c)
#endif
}
-#ifndef Q_OS_WINCE
void QWindowsWindow::setAlertState(bool enabled)
{
if (isAlertState() == enabled)
@@ -2370,7 +2241,6 @@ void QWindowsWindow::stopAlertWindow()
info.uCount = 0;
FlashWindowEx(&info);
}
-#endif // !Q_OS_WINCE
bool QWindowsWindow::isEnabled() const
{
@@ -2486,7 +2356,6 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind
void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes)
{
-#ifndef Q_OS_WINCE
if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) {
ULONG touchFlags = 0;
const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags);
@@ -2499,7 +2368,6 @@ void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTou
else
qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName()));
}
-#endif // !Q_OS_WINCE
}
void QWindowsWindow::aboutToMakeCurrent()
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index df7d2295a9..924f242e6e 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -40,10 +40,7 @@
#ifndef QWINDOWSWINDOW_H
#define QWINDOWSWINDOW_H
-#include "qtwindows_additional.h"
-#ifdef Q_OS_WINCE
-# include "qplatformfunctions_wince.h"
-#endif
+#include <QtCore/qt_windows.h>
#include "qwindowscursor.h"
#include <qpa/qplatformwindow.h>
@@ -60,10 +57,8 @@ struct QWindowsGeometryHint
explicit QWindowsGeometryHint(const QWindow *w, const QMargins &customMargins);
static QMargins frame(DWORD style, DWORD exStyle);
static bool handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result);
-#ifndef Q_OS_WINCE //MinMax maybe define struct if not available
void applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const;
void applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const;
-#endif
bool validSize(const QSize &s) const;
static inline QPoint mapToGlobal(HWND hwnd, const QPoint &);
@@ -83,10 +78,8 @@ struct QWindowCreationContext
QWindowCreationContext(const QWindow *w, const QRect &r,
const QMargins &customMargins,
DWORD style, DWORD exStyle);
-#ifndef Q_OS_WINCE //MinMax maybe define struct if not available
void applyToMinMaxInfo(MINMAXINFO *mmi) const
{ geometryHint.applyToMinMaxInfo(style, exStyle, mmi); }
-#endif
QWindowsGeometryHint geometryHint;
const QWindow *window;
@@ -293,10 +286,8 @@ public:
HDC getDC();
void releaseDC();
-#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
void getSizeHints(MINMAXINFO *mmi) const;
bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const;
-#endif // !Q_OS_WINCE
#ifndef QT_NO_CURSOR
CursorHandlePtr cursor() const { return m_cursor; }
@@ -316,12 +307,10 @@ public:
void invalidateSurface() Q_DECL_OVERRIDE;
void aboutToMakeCurrent();
-#ifndef Q_OS_WINCE
void setAlertState(bool enabled) Q_DECL_OVERRIDE;
bool isAlertState() const Q_DECL_OVERRIDE { return testFlag(AlertState); }
void alertWindow(int durationMs = 0);
void stopAlertWindow();
-#endif
static void setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes);
void registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes = QWindowsWindowFunctions::NormalTouch);
@@ -357,9 +346,6 @@ private:
unsigned m_savedStyle;
QRect m_savedFrameGeometry;
const QSurfaceFormat m_format;
-#ifdef Q_OS_WINCE
- bool m_previouslyHidden;
-#endif
HICON m_iconSmall;
HICON m_iconBig;
void *m_surface;
@@ -368,11 +354,9 @@ private:
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const RECT &r);
QDebug operator<<(QDebug d, const POINT &);
-# ifndef Q_OS_WINCE
QDebug operator<<(QDebug d, const MINMAXINFO &i);
QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p);
QDebug operator<<(QDebug d, const WINDOWPLACEMENT &);
-# endif // !Q_OS_WINCE
#endif // !QT_NO_DEBUG_STREAM
// ---------- QWindowsGeometryHint inline functions.
@@ -436,11 +420,7 @@ inline void QWindowsWindow::destroyIcon()
inline bool QWindowsWindow::isLayered() const
{
-#ifndef Q_OS_WINCE
return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED;
-#else
- return false;
-#endif
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
index 48c53592d6..1cadcd1954 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -1,14 +1,11 @@
# Note: OpenGL32 must precede Gdi32 as it overwrites some functions.
-LIBS *= -lole32
-!wince: LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32
+LIBS += -lole32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32
contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32
mingw: LIBS *= -luuid
# For the dialog helpers:
-!wince: LIBS *= -lshlwapi -lshell32
-!wince: LIBS *= -ladvapi32
-wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\""
+LIBS += -lshlwapi -lshell32 -ladvapi32
DEFINES *= QT_NO_CAST_FROM_ASCII
@@ -53,7 +50,6 @@ HEADERS += \
$$PWD/qwindowsfontdatabase.h \
$$PWD/qwindowsmousehandler.h \
$$PWD/qtwindowsglobal.h \
- $$PWD/qtwindows_additional.h \
$$PWD/qwindowsole.h \
$$PWD/qwindowsmime.h \
$$PWD/qwindowsinternalmimedata.h \
@@ -62,7 +58,6 @@ HEADERS += \
$$PWD/qwindowstheme.h \
$$PWD/qwindowsdialoghelpers.h \
$$PWD/qwindowsservices.h \
- $$PWD/qplatformfunctions_wince.h \
$$PWD/qwindowsnativeimage.h \
$$PWD/qwindowsnativeinterface.h \
$$PWD/qwindowsopengltester.h \
@@ -101,37 +96,30 @@ contains(QT_CONFIG,dynamicgl) {
}
}
-!wince:!contains( DEFINES, QT_NO_TABLETEVENT ) {
+!contains( DEFINES, QT_NO_TABLETEVENT ) {
INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wintab
HEADERS += $$PWD/qwindowstabletsupport.h
SOURCES += $$PWD/qwindowstabletsupport.cpp
}
-!wince:!contains( DEFINES, QT_NO_SESSIONMANAGER ) {
+!contains( DEFINES, QT_NO_SESSIONMANAGER ) {
SOURCES += $$PWD/qwindowssessionmanager.cpp
HEADERS += $$PWD/qwindowssessionmanager.h
}
-!wince:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) {
- RESOURCES += $$PWD/cursors.qrc
-}
+!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ):RESOURCES += $$PWD/cursors.qrc
-!wince: RESOURCES += $$PWD/openglblacklists.qrc
+RESOURCES += $$PWD/openglblacklists.qrc
contains(QT_CONFIG, freetype) {
- DEFINES *= QT_NO_FONTCONFIG
- include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
- HEADERS += \
- $$PWD/qwindowsfontdatabase_ft.h
- SOURCES += \
- $$PWD/qwindowsfontdatabase_ft.cpp
-} else:contains(QT_CONFIG, system-freetype) {
- CONFIG += qpa/basicunixfontdatabase
- include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri)
- HEADERS += \
- $$PWD/qwindowsfontdatabase_ft.h
- SOURCES += \
- $$PWD/qwindowsfontdatabase_ft.cpp
+ HEADERS += $$PWD/qwindowsfontdatabase_ft.h
+ SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp
+ contains(QT_CONFIG, system-freetype) {
+ include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri)
+ } else {
+ DEFINES *= QT_NO_FONTCONFIG
+ include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
+ }
}
contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri)
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 2e0f723693..adafa830d5 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -4,7 +4,7 @@ QT *= core-private
QT *= gui-private
QT *= platformsupport-private
-!wince:LIBS *= -lgdi32
+LIBS += -lgdi32 -ldwmapi
include(windows.pri)
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index a999fb0aa2..130ae9be0c 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -223,14 +223,14 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy)
preparePaint(area);
const QPoint delta(dx, dy);
- foreach (const QRect &rect, area.rects())
+ for (const QRect &rect : area)
qt_scrollRectInImage(*image(), rect, delta);
if (m_xcb_pixmap) {
flushPixmap(area);
ensureGC(m_xcb_pixmap);
const QRect bounds(QPoint(0, 0), size());
- foreach (const QRect &src, area.rects()) {
+ for (const QRect &src : area) {
const QRect dst = src.translated(delta).intersected(bounds);
Q_XCB_CALL(xcb_copy_area(xcb_connection(),
m_xcb_pixmap,
@@ -531,11 +531,9 @@ void QXcbBackingStore::beginPaint(const QRegion &region)
if (m_image->hasAlpha()) {
QPainter p(paintDevice());
p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = region.rects();
const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
- }
+ for (const QRect &rect : region)
+ p.fillRect(rect, blank);
}
}
@@ -555,22 +553,21 @@ void QXcbBackingStore::endPaint()
// Slow path: the paint device was m_rgbImage. Now copy with swapping red
// and blue into m_image.
- const QVector<QRect> rects = region.rects();
- if (rects.isEmpty())
+ auto it = region.begin();
+ const auto end = region.end();
+ if (it == end)
return;
QPainter p(m_image->image());
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ while (it != end) {
const QRect rect = *it;
p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped());
}
}
-#ifndef QT_NO_OPENGL
QImage QXcbBackingStore::toImage() const
{
return m_image && m_image->image() ? *m_image->image() : QImage();
}
-#endif
QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const
{
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h
index 5a8f385c1b..6af679d28a 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.h
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.h
@@ -63,8 +63,8 @@ public:
void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures, QOpenGLContext *context,
bool translucentBackground) Q_DECL_OVERRIDE;
- QImage toImage() const Q_DECL_OVERRIDE;
#endif
+ QImage toImage() const Q_DECL_OVERRIDE;
QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index bc62b500e5..5d46c53b30 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1773,24 +1773,6 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t *
window->handleClientMessageEvent(event);
}
-xcb_generic_event_t *QXcbConnection::checkEvent(int type)
-{
- QXcbEventArray *eventqueue = m_reader->lock();
-
- for (int i = 0; i < eventqueue->size(); ++i) {
- xcb_generic_event_t *event = eventqueue->at(i);
- if (event && event->response_type == type) {
- (*eventqueue)[i] = 0;
- m_reader->unlock();
- return event;
- }
- }
-
- m_reader->unlock();
-
- return 0;
-}
-
static const char * xcb_atomnames = {
// window-manager <-> client protocols
"WM_PROTOCOLS\0"
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 891f0fbcb5..1336b3f5d3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -447,7 +447,6 @@ public:
QXcbWindowEventListener *windowEventListenerFromId(xcb_window_t id);
QXcbWindow *platformWindowFromId(xcb_window_t id);
- xcb_generic_event_t *checkEvent(int type);
template<typename T>
inline xcb_generic_event_t *checkEvent(T &checker);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index fc04d6afc4..063778a1de 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2798,9 +2798,8 @@ void QXcbWindow::setMask(const QRegion &region)
XCB_SHAPE_SK_BOUNDING, xcb_window(), 0, 0, XCB_NONE);
} else {
QVector<xcb_rectangle_t> rects;
- const QVector<QRect> regionRects = region.rects();
- rects.reserve(regionRects.count());
- foreach (const QRect &r, regionRects)
+ rects.reserve(region.rectCount());
+ for (const QRect &r : region)
rects.push_back(qRectToXCBRectangle(r));
xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index f4a4e5a78a..cbb4c361f9 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -48,10 +48,10 @@ contains(QT_CONFIG, xcb-xlib) {
DEFINES += XCB_USE_XINPUT2
SOURCES += qxcbconnection_xi2.cpp
LIBS += -lXi
- !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) {
- DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \
- LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \
- LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH
+ !isEmpty(QMAKE_XINPUT2_VERSION_MAJOR) {
+ DEFINES += LIBXI_MAJOR=$$QMAKE_XINPUT2_VERSION_MAJOR \
+ LIBXI_MINOR=$$QMAKE_XINPUT2_VERSION_MINOR \
+ LIBXI_PATCH=$$QMAKE_XINPUT2_VERSION_PATCH
}
}
}
@@ -81,7 +81,7 @@ CONFIG += qpa/genericunixfontdatabase
contains(QT_CONFIG, dbus-linked) {
QT += dbus
- LIBS += $$QT_LIBS_DBUS
+ LIBS += $$QMAKE_LIBS_DBUS
}
contains(QT_CONFIG, xcb-qt) {
diff --git a/src/plugins/platformthemes/gtk3/gtk3.pro b/src/plugins/platformthemes/gtk3/gtk3.pro
index cd19e73ed8..72a33efeac 100644
--- a/src/plugins/platformthemes/gtk3/gtk3.pro
+++ b/src/plugins/platformthemes/gtk3/gtk3.pro
@@ -8,14 +8,16 @@ load(qt_plugin)
QT += core-private gui-private platformsupport-private
CONFIG += X11
-QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTK3
-LIBS += $$QT_LIBS_QGTK3
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_GTK3
+LIBS += $$QMAKE_LIBS_GTK3
HEADERS += \
qgtk3dialoghelpers.h \
+ qgtk3menu.h \
qgtk3theme.h
SOURCES += \
main.cpp \
qgtk3dialoghelpers.cpp \
+ qgtk3menu.cpp \
qgtk3theme.cpp
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
new file mode 100644
index 0000000000..288978ae84
--- /dev/null
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp
@@ -0,0 +1,489 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 "qgtk3menu.h"
+
+#include <QtGui/qwindow.h>
+#include <QtGui/qpa/qplatformtheme.h>
+
+#undef signals
+#include <gtk/gtk.h>
+
+QT_BEGIN_NAMESPACE
+
+static guint qt_gdkKey(const QKeySequence &shortcut)
+{
+ if (shortcut.isEmpty())
+ return 0;
+
+ // TODO: proper mapping
+ Qt::KeyboardModifiers mods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier;
+ return (shortcut[0] ^ mods) & shortcut[0];
+}
+
+static GdkModifierType qt_gdkModifiers(const QKeySequence &shortcut)
+{
+ if (shortcut.isEmpty())
+ return GdkModifierType(0);
+
+ guint mods = 0;
+ int m = shortcut[0];
+ if (m & Qt::ShiftModifier)
+ mods |= GDK_SHIFT_MASK;
+ if (m & Qt::ControlModifier)
+ mods |= GDK_CONTROL_MASK;
+ if (m & Qt::AltModifier)
+ mods |= GDK_MOD1_MASK;
+ if (m & Qt::MetaModifier)
+ mods |= GDK_META_MASK;
+
+ return static_cast<GdkModifierType>(mods);
+}
+
+QGtk3MenuItem::QGtk3MenuItem()
+ : m_visible(true),
+ m_separator(false),
+ m_checkable(false),
+ m_checked(false),
+ m_enabled(true),
+ m_underline(false),
+ m_invalid(true),
+ m_tag(reinterpret_cast<quintptr>(this)),
+ m_menu(nullptr),
+ m_item(nullptr)
+{
+}
+
+QGtk3MenuItem::~QGtk3MenuItem()
+{
+}
+
+bool QGtk3MenuItem::isInvalid() const
+{
+ return m_invalid;
+}
+
+GtkWidget *QGtk3MenuItem::create()
+{
+ if (m_invalid) {
+ if (m_item) {
+ gtk_widget_destroy(m_item);
+ m_item = nullptr;
+ }
+ m_invalid = false;
+ }
+
+ if (!m_item) {
+ if (m_separator) {
+ m_item = gtk_separator_menu_item_new();
+ } else {
+ if (m_checkable) {
+ m_item = gtk_check_menu_item_new();
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(m_item), m_checked);
+ g_signal_connect(m_item, "toggled", G_CALLBACK(onToggle), this);
+ } else {
+ m_item = gtk_menu_item_new();
+ g_signal_connect(m_item, "activate", G_CALLBACK(onActivate), this);
+ }
+ gtk_menu_item_set_label(GTK_MENU_ITEM(m_item), m_text.toUtf8());
+ gtk_menu_item_set_use_underline(GTK_MENU_ITEM(m_item), m_underline);
+ if (m_menu)
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(m_item), m_menu->handle());
+ g_signal_connect(m_item, "select", G_CALLBACK(onSelect), this);
+ if (!m_shortcut.isEmpty()) {
+ GtkWidget *label = gtk_bin_get_child(GTK_BIN(m_item));
+ gtk_accel_label_set_accel(GTK_ACCEL_LABEL(label), qt_gdkKey(m_shortcut), qt_gdkModifiers(m_shortcut));
+ }
+ }
+ gtk_widget_set_sensitive(m_item, m_enabled);
+ gtk_widget_set_visible(m_item, m_visible);
+ if (GTK_IS_CHECK_MENU_ITEM(m_item))
+ g_object_set(m_item, "draw-as-radio", m_exclusive, NULL);
+ }
+
+ return m_item;
+}
+
+GtkWidget *QGtk3MenuItem::handle() const
+{
+ return m_item;
+}
+
+quintptr QGtk3MenuItem::tag() const
+{
+ return m_tag;
+}
+
+void QGtk3MenuItem::setTag(quintptr tag)
+{
+ m_tag = tag;
+}
+
+QString QGtk3MenuItem::text() const
+{
+ return m_text;
+}
+
+static QString convertMnemonics(QString text, bool *found)
+{
+ *found = false;
+
+ int i = text.length() - 1;
+ while (i >= 0) {
+ const QChar c = text.at(i);
+ if (c == QLatin1Char('&')) {
+ if (i == 0 || text.at(i - 1) != QLatin1Char('&')) {
+ // convert Qt to GTK mnemonic
+ if (i < text.length() - 1 && !text.at(i + 1).isSpace()) {
+ text.replace(i, 1, QLatin1Char('_'));
+ *found = true;
+ }
+ } else if (text.at(i - 1) == QLatin1Char('&')) {
+ // unescape ampersand
+ text.replace(--i, 2, QLatin1Char('&'));
+ }
+ } else if (c == QLatin1Char('_')) {
+ // escape GTK mnemonic
+ text.insert(i, QLatin1Char('_'));
+ }
+ --i;
+ }
+
+ return text;
+}
+
+void QGtk3MenuItem::setText(const QString &text)
+{
+ m_text = convertMnemonics(text, &m_underline);
+ if (GTK_IS_MENU_ITEM(m_item)) {
+ gtk_menu_item_set_label(GTK_MENU_ITEM(m_item), m_text.toUtf8());
+ gtk_menu_item_set_use_underline(GTK_MENU_ITEM(m_item), m_underline);
+ }
+}
+
+QGtk3Menu *QGtk3MenuItem::menu() const
+{
+ return m_menu;
+}
+
+void QGtk3MenuItem::setMenu(QPlatformMenu *menu)
+{
+ m_menu = qobject_cast<QGtk3Menu *>(menu);
+ if (GTK_IS_MENU_ITEM(m_item))
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(m_item), m_menu ? m_menu->handle() : NULL);
+}
+
+bool QGtk3MenuItem::isVisible() const
+{
+ return m_visible;
+}
+
+void QGtk3MenuItem::setVisible(bool visible)
+{
+ if (m_visible == visible)
+ return;
+
+ m_visible = visible;
+ if (GTK_IS_MENU_ITEM(m_item))
+ gtk_widget_set_visible(m_item, visible);
+}
+
+bool QGtk3MenuItem::isSeparator() const
+{
+ return m_separator;
+}
+
+void QGtk3MenuItem::setIsSeparator(bool separator)
+{
+ if (m_separator == separator)
+ return;
+
+ m_invalid = true;
+ m_separator = separator;
+}
+
+bool QGtk3MenuItem::isCheckable() const
+{
+ return m_checkable;
+}
+
+void QGtk3MenuItem::setCheckable(bool checkable)
+{
+ if (m_checkable == checkable)
+ return;
+
+ m_invalid = true;
+ m_checkable = checkable;
+}
+
+bool QGtk3MenuItem::isChecked() const
+{
+ return m_checked;
+}
+
+void QGtk3MenuItem::setChecked(bool checked)
+{
+ if (m_checked == checked)
+ return;
+
+ m_checked = checked;
+ if (GTK_IS_CHECK_MENU_ITEM(m_item))
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(m_item), checked);
+}
+
+QKeySequence QGtk3MenuItem::shortcut() const
+{
+ return m_shortcut;
+}
+
+void QGtk3MenuItem::setShortcut(const QKeySequence& shortcut)
+{
+ if (m_shortcut == shortcut)
+ return;
+
+ m_shortcut = shortcut;
+ if (GTK_IS_MENU_ITEM(m_item)) {
+ GtkWidget *label = gtk_bin_get_child(GTK_BIN(m_item));
+ gtk_accel_label_set_accel(GTK_ACCEL_LABEL(label), qt_gdkKey(m_shortcut), qt_gdkModifiers(m_shortcut));
+ }
+}
+
+bool QGtk3MenuItem::isEnabled() const
+{
+ return m_enabled;
+}
+
+void QGtk3MenuItem::setEnabled(bool enabled)
+{
+ if (m_enabled == enabled)
+ return;
+
+ m_enabled = enabled;
+ if (m_item)
+ gtk_widget_set_sensitive(m_item, enabled);
+}
+
+bool QGtk3MenuItem::hasExclusiveGroup() const
+{
+ return m_exclusive;
+}
+
+void QGtk3MenuItem::setHasExclusiveGroup(bool exclusive)
+{
+ if (m_exclusive == exclusive)
+ return;
+
+ m_exclusive = exclusive;
+ if (GTK_IS_CHECK_MENU_ITEM(m_item))
+ g_object_set(m_item, "draw-as-radio", exclusive, NULL);
+}
+
+void QGtk3MenuItem::onSelect(GtkMenuItem *, void *data)
+{
+ QGtk3MenuItem *item = static_cast<QGtk3MenuItem *>(data);
+ if (item)
+ emit item->hovered();
+}
+
+void QGtk3MenuItem::onActivate(GtkMenuItem *, void *data)
+{
+ QGtk3MenuItem *item = static_cast<QGtk3MenuItem *>(data);
+ if (item)
+ emit item->activated();
+}
+
+void QGtk3MenuItem::onToggle(GtkCheckMenuItem *check, void *data)
+{
+ QGtk3MenuItem *item = static_cast<QGtk3MenuItem *>(data);
+ if (item) {
+ bool active = gtk_check_menu_item_get_active(check);
+ if (active != item->isChecked()) {
+ item->setChecked(active);
+ emit item->activated();
+ }
+ }
+}
+
+QGtk3Menu::QGtk3Menu()
+ : m_tag(reinterpret_cast<quintptr>(this))
+{
+ m_menu = gtk_menu_new();
+
+ g_signal_connect(m_menu, "show", G_CALLBACK(onShow), this);
+ g_signal_connect(m_menu, "hide", G_CALLBACK(onHide), this);
+}
+
+QGtk3Menu::~QGtk3Menu()
+{
+ if (GTK_IS_WIDGET(m_menu))
+ gtk_widget_destroy(m_menu);
+}
+
+GtkWidget *QGtk3Menu::handle() const
+{
+ return m_menu;
+}
+
+void QGtk3Menu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before)
+{
+ QGtk3MenuItem *gitem = static_cast<QGtk3MenuItem *>(item);
+ if (!gitem || m_items.contains(gitem))
+ return;
+
+ GtkWidget *handle = gitem->create();
+ int index = m_items.indexOf(static_cast<QGtk3MenuItem *>(before));
+ if (index < 0)
+ index = m_items.count();
+ m_items.insert(index, gitem);
+ gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), handle, index);
+}
+
+void QGtk3Menu::removeMenuItem(QPlatformMenuItem *item)
+{
+ QGtk3MenuItem *gitem = static_cast<QGtk3MenuItem *>(item);
+ if (!gitem && !m_items.removeOne(gitem))
+ return;
+
+ GtkWidget *handle = gitem->handle();
+ if (handle)
+ gtk_container_remove(GTK_CONTAINER(m_menu), handle);
+}
+
+void QGtk3Menu::syncMenuItem(QPlatformMenuItem *item)
+{
+ QGtk3MenuItem *gitem = static_cast<QGtk3MenuItem *>(item);
+ int index = m_items.indexOf(gitem);
+ if (index == -1 || !gitem->isInvalid())
+ return;
+
+ GtkWidget *handle = gitem->create();
+ if (handle)
+ gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), handle, index);
+}
+
+void QGtk3Menu::syncSeparatorsCollapsible(bool enable)
+{
+ Q_UNUSED(enable);
+}
+
+quintptr QGtk3Menu::tag() const
+{
+ return m_tag;
+}
+
+void QGtk3Menu::setTag(quintptr tag)
+{
+ m_tag = tag;
+}
+
+void QGtk3Menu::setEnabled(bool enabled)
+{
+ gtk_widget_set_sensitive(m_menu, enabled);
+}
+
+void QGtk3Menu::setVisible(bool visible)
+{
+ gtk_widget_set_visible(m_menu, visible);
+}
+
+static void qt_gtk_menu_position_func(GtkMenu *, gint *x, gint *y, gboolean *push_in, gpointer data)
+{
+ QGtk3Menu *menu = static_cast<QGtk3Menu *>(data);
+ QPoint targetPos = menu->targetPos();
+ *x = targetPos.x();
+ *y = targetPos.y();
+ *push_in = true;
+}
+
+QPoint QGtk3Menu::targetPos() const
+{
+ return m_targetPos;
+}
+
+void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item)
+{
+ int index = m_items.indexOf(static_cast<QGtk3MenuItem *>(const_cast<QPlatformMenuItem *>(item)));
+ if (index != -1)
+ gtk_menu_set_active(GTK_MENU(m_menu), index);
+
+ m_targetPos = targetRect.bottomLeft();
+ if (parentWindow)
+ m_targetPos = parentWindow->mapToGlobal(m_targetPos);
+
+ gtk_menu_popup(GTK_MENU(m_menu), NULL, NULL, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time());
+}
+
+void QGtk3Menu::dismiss()
+{
+ gtk_menu_popdown(GTK_MENU(m_menu));
+}
+
+QPlatformMenuItem *QGtk3Menu::menuItemAt(int position) const
+{
+ return m_items.value(position);
+}
+
+QPlatformMenuItem *QGtk3Menu::menuItemForTag(quintptr tag) const
+{
+ for (QGtk3MenuItem *item : m_items) {
+ if (item->tag() == tag)
+ return item;
+ }
+ return nullptr;
+}
+
+QPlatformMenuItem *QGtk3Menu::createMenuItem() const
+{
+ return new QGtk3MenuItem;
+}
+
+QPlatformMenu *QGtk3Menu::createSubMenu() const
+{
+ return new QGtk3Menu;
+}
+
+void QGtk3Menu::onShow(GtkWidget *, void *data)
+{
+ QGtk3Menu *menu = static_cast<QGtk3Menu *>(data);
+ if (menu)
+ emit menu->aboutToShow();
+}
+
+void QGtk3Menu::onHide(GtkWidget *, void *data)
+{
+ QGtk3Menu *menu = static_cast<QGtk3Menu *>(data);
+ if (menu)
+ emit menu->aboutToHide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.h b/src/plugins/platformthemes/gtk3/qgtk3menu.h
new file mode 100644
index 0000000000..ad108f1218
--- /dev/null
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.h
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the plugins 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 QGTK3MENU_H
+#define QGTK3MENU_H
+
+#include <QtGui/qpa/qplatformmenu.h>
+
+typedef struct _GtkWidget GtkWidget;
+typedef struct _GtkMenuItem GtkMenuItem;
+typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
+
+QT_BEGIN_NAMESPACE
+
+class QGtk3Menu;
+
+class QGtk3MenuItem: public QPlatformMenuItem
+{
+public:
+ QGtk3MenuItem();
+ ~QGtk3MenuItem();
+
+ bool isInvalid() const;
+
+ GtkWidget *create();
+ GtkWidget *handle() const;
+
+ quintptr tag() const;
+ void setTag(quintptr tag) override;
+
+ QString text() const;
+ void setText(const QString &text) override;
+
+ QGtk3Menu *menu() const;
+ void setMenu(QPlatformMenu *menu) override;
+
+ bool isVisible() const;
+ void setVisible(bool visible) override;
+
+ bool isSeparator() const;
+ void setIsSeparator(bool separator) override;
+
+ bool isCheckable() const;
+ void setCheckable(bool checkable) override;
+
+ bool isChecked() const;
+ void setChecked(bool checked) override;
+
+ QKeySequence shortcut() const;
+ void setShortcut(const QKeySequence &shortcut) override;
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled) override;
+
+ bool hasExclusiveGroup() const;
+ void setHasExclusiveGroup(bool exclusive) override;
+
+ void setRole(MenuRole role) override { Q_UNUSED(role); }
+ void setFont(const QFont &font) override { Q_UNUSED(font); }
+ void setIcon(const QIcon &icon) override { Q_UNUSED(icon); }
+ void setIconSize(int size) override { Q_UNUSED(size); }
+
+protected:
+ static void onSelect(GtkMenuItem *item, void *data);
+ static void onActivate(GtkMenuItem *item, void *data);
+ static void onToggle(GtkCheckMenuItem *item, void *data);
+
+private:
+ bool m_visible;
+ bool m_separator;
+ bool m_checkable;
+ bool m_checked;
+ bool m_enabled;
+ bool m_exclusive;
+ bool m_underline;
+ bool m_invalid;
+ quintptr m_tag;
+ QGtk3Menu *m_menu;
+ GtkWidget *m_item;
+ QString m_text;
+ QKeySequence m_shortcut;
+};
+
+class QGtk3Menu : public QPlatformMenu
+{
+ Q_OBJECT
+
+public:
+ QGtk3Menu();
+ ~QGtk3Menu();
+
+ GtkWidget *handle() const;
+
+ void insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *item) override;
+ void syncMenuItem(QPlatformMenuItem *item) override;
+ void syncSeparatorsCollapsible(bool enable) override;
+
+ quintptr tag() const override;
+ void setTag(quintptr tag) override;
+
+ void setEnabled(bool enabled) override;
+ void setVisible(bool visible) override;
+
+ void setIcon(const QIcon &icon) override { Q_UNUSED(icon); }
+ void setText(const QString &text) override { Q_UNUSED(text); }
+
+ QPoint targetPos() const;
+
+ void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override;
+ void dismiss() override;
+
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
+
+ QPlatformMenuItem *createMenuItem() const override;
+ QPlatformMenu *createSubMenu() const override;
+
+protected:
+ static void onShow(GtkWidget *menu, void *data);
+ static void onHide(GtkWidget *menu, void *data);
+
+private:
+ quintptr m_tag;
+ GtkWidget *m_menu;
+ QPoint m_targetPos;
+ QVector<QGtk3MenuItem *> m_items;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGTK3MENU_H
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
index 65bec3dbd1..6df631bff3 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp
@@ -39,6 +39,7 @@
#include "qgtk3theme.h"
#include "qgtk3dialoghelpers.h"
+#include "qgtk3menu.h"
#include <QVariant>
#undef signals
@@ -142,4 +143,14 @@ QPlatformDialogHelper *QGtk3Theme::createPlatformDialogHelper(DialogType type) c
}
}
+QPlatformMenu* QGtk3Theme::createPlatformMenu() const
+{
+ return new QGtk3Menu;
+}
+
+QPlatformMenuItem* QGtk3Theme::createPlatformMenuItem() const
+{
+ return new QGtk3MenuItem;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.h b/src/plugins/platformthemes/gtk3/qgtk3theme.h
index 8bb9adeab8..52036680c6 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.h
@@ -55,6 +55,9 @@ public:
bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE;
QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE;
+ QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE;
+ QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE;
+
static const char *name;
};
diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro
index 2365c5bc0e..31822ef8dc 100644
--- a/src/plugins/sqldrivers/db2/db2.pro
+++ b/src/plugins/sqldrivers/db2/db2.pro
@@ -1,8 +1,15 @@
TARGET = qsqldb2
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_db2_p.h
+SOURCES += $$PWD/qsql_db2.cpp $$PWD/main.cpp
+
+unix {
+ !contains(LIBS, .*db2.*):LIBS += -ldb2
+} else {
+ !contains(LIBS, .*db2.*):LIBS += -ldb2cli
+}
+
OTHER_FILES += db2.json
-include(../../../sql/drivers/db2/qsql_db2.pri)
PLUGIN_CLASS_NAME = QDB2DriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/db2/main.cpp b/src/plugins/sqldrivers/db2/main.cpp
index 3869d7798d..97338b8eef 100644
--- a/src/plugins/sqldrivers/db2/main.cpp
+++ b/src/plugins/sqldrivers/db2/main.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../sql/drivers/db2/qsql_db2_p.h"
+#include "qsql_db2_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index 4ccc3aca9e..4ccc3aca9e 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
diff --git a/src/sql/drivers/db2/qsql_db2_p.h b/src/plugins/sqldrivers/db2/qsql_db2_p.h
index fa6d739479..fa6d739479 100644
--- a/src/sql/drivers/db2/qsql_db2_p.h
+++ b/src/plugins/sqldrivers/db2/qsql_db2_p.h
diff --git a/src/plugins/sqldrivers/ibase/ibase.pro b/src/plugins/sqldrivers/ibase/ibase.pro
index 1f29597a2b..8237245183 100644
--- a/src/plugins/sqldrivers/ibase/ibase.pro
+++ b/src/plugins/sqldrivers/ibase/ibase.pro
@@ -1,8 +1,17 @@
TARGET = qsqlibase
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_ibase_p.h
+SOURCES += $$PWD/qsql_ibase.cpp $$PWD/main.cpp
+
+unix {
+ !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds
+} else {
+ !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) {
+ LIBS += -lgds32_ms
+ }
+}
+
OTHER_FILES += ibase.json
-include(../../../sql/drivers/ibase/qsql_ibase.pri)
PLUGIN_CLASS_NAME = QIBaseDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/ibase/main.cpp b/src/plugins/sqldrivers/ibase/main.cpp
index c6f0b785de..8d462afcdc 100644
--- a/src/plugins/sqldrivers/ibase/main.cpp
+++ b/src/plugins/sqldrivers/ibase/main.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../sql/drivers/ibase/qsql_ibase_p.h"
+#include "qsql_ibase_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index 6fd91b6b76..6fd91b6b76 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
diff --git a/src/sql/drivers/ibase/qsql_ibase_p.h b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
index c7cee41462..c7cee41462 100644
--- a/src/sql/drivers/ibase/qsql_ibase_p.h
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index 855a6eeb9c..00d9c5bb34 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../sql/drivers/mysql/qsql_mysql_p.h"
+#include "qsql_mysql_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sqldrivers/mysql/mysql.pro b/src/plugins/sqldrivers/mysql/mysql.pro
index c917bfca48..3bd8cd0040 100644
--- a/src/plugins/sqldrivers/mysql/mysql.pro
+++ b/src/plugins/sqldrivers/mysql/mysql.pro
@@ -1,8 +1,23 @@
TARGET = qsqlmysql
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_mysql_p.h
+SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
+
+QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_MYSQL
+LIBS += $$QMAKE_LIBS_MYSQL
+
+unix {
+ isEmpty(QMAKE_LIBS_MYSQL) {
+ !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
+ use_libmysqlclient_r:LIBS += -lmysqlclient_r
+ else:LIBS += -lmysqlclient
+ }
+ }
+} else {
+ !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql
+}
+
OTHER_FILES += mysql.json
-include(../../../sql/drivers/mysql/qsql_mysql.pri)
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 56caf52dcb..56caf52dcb 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
diff --git a/src/sql/drivers/mysql/qsql_mysql_p.h b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
index 7641f9aa34..7641f9aa34 100644
--- a/src/sql/drivers/mysql/qsql_mysql_p.h
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
diff --git a/src/plugins/sqldrivers/oci/main.cpp b/src/plugins/sqldrivers/oci/main.cpp
index 980116123d..e576928d31 100644
--- a/src/plugins/sqldrivers/oci/main.cpp
+++ b/src/plugins/sqldrivers/oci/main.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../sql/drivers/oci/qsql_oci_p.h"
+#include "qsql_oci_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sqldrivers/oci/oci.pro b/src/plugins/sqldrivers/oci/oci.pro
index 96a0dd9ab6..a22d1181bf 100644
--- a/src/plugins/sqldrivers/oci/oci.pro
+++ b/src/plugins/sqldrivers/oci/oci.pro
@@ -1,8 +1,16 @@
TARGET = qsqloci
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_oci_p.h
+SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
+
+unix {
+ !contains(LIBS, .*clnts.*):LIBS += -lclntsh
+} else {
+ LIBS *= -loci
+}
+darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
+
OTHER_FILES += oci.json
-include(../../../sql/drivers/oci/qsql_oci.pri)
PLUGIN_CLASS_NAME = QOCIDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 47d6db7ea4..47d6db7ea4 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
diff --git a/src/sql/drivers/oci/qsql_oci_p.h b/src/plugins/sqldrivers/oci/qsql_oci_p.h
index 69911f4bee..69911f4bee 100644
--- a/src/sql/drivers/oci/qsql_oci_p.h
+++ b/src/plugins/sqldrivers/oci/qsql_oci_p.h
diff --git a/src/plugins/sqldrivers/odbc/main.cpp b/src/plugins/sqldrivers/odbc/main.cpp
index 69ea7b1f8e..ac63941a82 100644
--- a/src/plugins/sqldrivers/odbc/main.cpp
+++ b/src/plugins/sqldrivers/odbc/main.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../sql/drivers/odbc/qsql_odbc_p.h"
+#include "qsql_odbc_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sqldrivers/odbc/odbc.pro b/src/plugins/sqldrivers/odbc/odbc.pro
index c0020c065f..0e49f1ac66 100644
--- a/src/plugins/sqldrivers/odbc/odbc.pro
+++ b/src/plugins/sqldrivers/odbc/odbc.pro
@@ -1,8 +1,19 @@
TARGET = qsqlodbc
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_odbc_p.h
+SOURCES += $$PWD/qsql_odbc.cpp $$PWD/main.cpp
+
+unix {
+ DEFINES += UNICODE
+ !contains(LIBS, .*odbc.*) {
+ osx:LIBS += -liodbc
+ else:LIBS += $$QMAKE_LIBS_ODBC
+ }
+} else {
+ LIBS *= -lodbc32
+}
+
OTHER_FILES += odbc.json
-include(../../../sql/drivers/odbc/qsql_odbc.pri)
PLUGIN_CLASS_NAME = QODBCDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index 59ef42d609..59ef42d609 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
diff --git a/src/sql/drivers/odbc/qsql_odbc_p.h b/src/plugins/sqldrivers/odbc/qsql_odbc_p.h
index f4ce8bc243..f4ce8bc243 100644
--- a/src/sql/drivers/odbc/qsql_odbc_p.h
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc_p.h
diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp
index eae1c1c554..7657fcbfdf 100644
--- a/src/plugins/sqldrivers/psql/main.cpp
+++ b/src/plugins/sqldrivers/psql/main.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../sql/drivers/psql/qsql_psql_p.h"
+#include "qsql_psql_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
index 0fabe0e616..4a05266120 100644
--- a/src/plugins/sqldrivers/psql/psql.pro
+++ b/src/plugins/sqldrivers/psql/psql.pro
@@ -1,8 +1,17 @@
TARGET = qsqlpsql
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_psql_p.h
+SOURCES += $$PWD/qsql_psql.cpp $$PWD/main.cpp
+
+unix|mingw {
+ LIBS += $$QMAKE_LIBS_PSQL
+ !contains(LIBS, .*pq.*):LIBS += -lpq
+ QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_PSQL
+} else {
+ !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32
+}
+
OTHER_FILES += psql.json
-include(../../../sql/drivers/psql/qsql_psql.pri)
PLUGIN_CLASS_NAME = QPSQLDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index fcf75af298..fcf75af298 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
diff --git a/src/sql/drivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h
index 8468b9af93..8468b9af93 100644
--- a/src/sql/drivers/psql/qsql_psql_p.h
+++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h
diff --git a/src/plugins/sqldrivers/sqldrivers.pro b/src/plugins/sqldrivers/sqldrivers.pro
index 39c58d4f2b..37dbd2394e 100644
--- a/src/plugins/sqldrivers/sqldrivers.pro
+++ b/src/plugins/sqldrivers/sqldrivers.pro
@@ -1,11 +1,11 @@
TEMPLATE = subdirs
-contains(sql-plugins, psql) : SUBDIRS += psql
-contains(sql-plugins, mysql) : SUBDIRS += mysql
-contains(sql-plugins, odbc) : SUBDIRS += odbc
-contains(sql-plugins, tds) : SUBDIRS += tds
-contains(sql-plugins, oci) : SUBDIRS += oci
-contains(sql-plugins, db2) : SUBDIRS += db2
-contains(sql-plugins, sqlite) : SUBDIRS += sqlite
-contains(sql-plugins, sqlite2) : SUBDIRS += sqlite2
-contains(sql-plugins, ibase) : SUBDIRS += ibase
+contains(sql-drivers, psql) : SUBDIRS += psql
+contains(sql-drivers, mysql) : SUBDIRS += mysql
+contains(sql-drivers, odbc) : SUBDIRS += odbc
+contains(sql-drivers, tds) : SUBDIRS += tds
+contains(sql-drivers, oci) : SUBDIRS += oci
+contains(sql-drivers, db2) : SUBDIRS += db2
+contains(sql-drivers, sqlite) : SUBDIRS += sqlite
+contains(sql-drivers, sqlite2) : SUBDIRS += sqlite2
+contains(sql-drivers, ibase) : SUBDIRS += ibase
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index 2a45b73d14..ef4ef2e93c 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -59,6 +59,7 @@
#endif
#include <sqlite3.h>
+#include <functional>
Q_DECLARE_OPAQUE_POINTER(sqlite3*)
Q_DECLARE_METATYPE(sqlite3*)
@@ -140,6 +141,7 @@ public:
inline QSQLiteDriverPrivate() : QSqlDriverPrivate(), access(0) { dbmsType = QSqlDriver::SQLite; }
sqlite3 *access;
QList <QSQLiteResult *> results;
+ QStringList notificationid;
};
@@ -571,6 +573,7 @@ QSQLiteDriver::QSQLiteDriver(sqlite3 *connection, QObject *parent)
QSQLiteDriver::~QSQLiteDriver()
{
+ close();
}
bool QSQLiteDriver::hasFeature(DriverFeature f) const
@@ -585,11 +588,11 @@ bool QSQLiteDriver::hasFeature(DriverFeature f) const
case SimpleLocking:
case FinishQuery:
case LowPrecisionNumbers:
+ case EventNotifications:
return true;
case QuerySize:
case NamedPlaceholders:
case BatchOperations:
- case EventNotifications:
case MultipleResultSets:
case CancelQuery:
return false;
@@ -664,9 +667,13 @@ void QSQLiteDriver::close()
for (QSQLiteResult *result : qAsConst(d->results))
result->d_func()->finalize();
+ if (d->access && (d->notificationid.count() > 0)) {
+ d->notificationid.clear();
+ sqlite3_update_hook(d->access, NULL, NULL);
+ }
+
if (sqlite3_close(d->access) != SQLITE_OK)
- setLastError(qMakeError(d->access, tr("Error closing database"),
- QSqlError::ConnectionError));
+ setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError));
d->access = 0;
setOpen(false);
setOpenError(false);
@@ -825,4 +832,72 @@ QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierTyp
return _q_escapeIdentifier(identifier);
}
+static void handle_sqlite_callback(void *qobj,int aoperation, char const *adbname, char const *atablename,
+ sqlite3_int64 arowid)
+{
+ Q_UNUSED(aoperation);
+ Q_UNUSED(adbname);
+ QSQLiteDriver *driver = static_cast<QSQLiteDriver *>(qobj);
+ if (driver) {
+ QMetaObject::invokeMethod(driver, "handleNotification", Qt::QueuedConnection,
+ Q_ARG(QString, QString::fromUtf8(atablename)), Q_ARG(qint64, arowid));
+ }
+}
+
+bool QSQLiteDriver::subscribeToNotification(const QString &name)
+{
+ Q_D(QSQLiteDriver);
+ if (!isOpen()) {
+ qWarning("Database not open.");
+ return false;
+ }
+
+ if (d->notificationid.contains(name)) {
+ qWarning("Already subscribing to '%s'.", qPrintable(name));
+ return false;
+ }
+
+ //sqlite supports only one notification callback, so only the first is registered
+ d->notificationid << name;
+ if (d->notificationid.count() == 1)
+ sqlite3_update_hook(d->access, &handle_sqlite_callback, reinterpret_cast<void *> (this));
+
+ return true;
+}
+
+bool QSQLiteDriver::unsubscribeFromNotification(const QString &name)
+{
+ Q_D(QSQLiteDriver);
+ if (!isOpen()) {
+ qWarning("Database not open.");
+ return false;
+ }
+
+ if (!d->notificationid.contains(name)) {
+ qWarning("Not subscribed to '%s'.", qPrintable(name));
+ return false;
+ }
+
+ d->notificationid.removeAll(name);
+ if (d->notificationid.isEmpty())
+ sqlite3_update_hook(d->access, NULL, NULL);
+
+ return true;
+}
+
+QStringList QSQLiteDriver::subscribedToNotifications() const
+{
+ Q_D(const QSQLiteDriver);
+ return d->notificationid;
+}
+
+void QSQLiteDriver::handleNotification(const QString &tableName, qint64 rowid)
+{
+ Q_D(const QSQLiteDriver);
+ if (d->notificationid.contains(tableName)) {
+ emit notification(tableName);
+ emit notification(tableName, QSqlDriver::UnknownSource, QVariant(rowid));
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/sql/drivers/sqlite/qsql_sqlite_p.h b/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h
index c9b7708698..ca969a4b53 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite_p.h
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h
@@ -93,6 +93,12 @@ public:
QSqlIndex primaryIndex(const QString &table) const Q_DECL_OVERRIDE;
QVariant handle() const Q_DECL_OVERRIDE;
QString escapeIdentifier(const QString &identifier, IdentifierType) const Q_DECL_OVERRIDE;
+
+ bool subscribeToNotification(const QString &name) Q_DECL_OVERRIDE;
+ bool unsubscribeFromNotification(const QString &name) Q_DECL_OVERRIDE;
+ QStringList subscribedToNotifications() const Q_DECL_OVERRIDE;
+private Q_SLOTS:
+ void handleNotification(const QString &tableName, qint64 rowid);
};
QT_END_NAMESPACE
diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp
index 94b41c9878..2ad466a61e 100644
--- a/src/plugins/sqldrivers/sqlite/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite/smain.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../../src/sql/drivers/sqlite/qsql_sqlite_p.h"
+#include "qsql_sqlite_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro
index cc6d02cbe8..c98655f85c 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -1,8 +1,16 @@
TARGET = qsqlite
-SOURCES = smain.cpp
+HEADERS += $$PWD/qsql_sqlite_p.h
+SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp
+
+!system-sqlite:!contains(LIBS, .*sqlite3.*) {
+ include($$PWD/../../../3rdparty/sqlite.pri)
+} else {
+ LIBS += $$QMAKE_LIBS_SQLITE
+ QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_SQLITE
+}
+
OTHER_FILES += sqlite.json
-include(../../../sql/drivers/sqlite/qsql_sqlite.pri)
PLUGIN_CLASS_NAME = QSQLiteDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp
index 67c24e4168..67c24e4168 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
index 83b248ec6a..83b248ec6a 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h
+++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
diff --git a/src/plugins/sqldrivers/sqlite2/smain.cpp b/src/plugins/sqldrivers/sqlite2/smain.cpp
index 06b428c8ef..3a5734f8c9 100644
--- a/src/plugins/sqldrivers/sqlite2/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite2/smain.cpp
@@ -39,7 +39,7 @@
#include <qsqldriverplugin.h>
#include <qstringlist.h>
-#include "../../../../src/sql/drivers/sqlite2/qsql_sqlite2_p.h"
+#include "qsql_sqlite2_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sqldrivers/sqlite2/sqlite2.pro b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
index d69afc119f..d0ab0eef41 100644
--- a/src/plugins/sqldrivers/sqlite2/sqlite2.pro
+++ b/src/plugins/sqldrivers/sqlite2/sqlite2.pro
@@ -1,8 +1,11 @@
TARGET = qsqlite2
-SOURCES = smain.cpp
+HEADERS += $$PWD/qsql_sqlite2_p.h
+SOURCES += $$PWD/qsql_sqlite2.cpp $$PWD/smain.cpp
+
+!contains(LIBS, .*sqlite.*):LIBS += -lsqlite
+
OTHER_FILES += sqlite2.json
-include(../../../sql/drivers/sqlite2/qsql_sqlite2.pri)
PLUGIN_CLASS_NAME = QSQLite2DriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
index ffb31ae179..4aa1444608 100644
--- a/src/plugins/sqldrivers/tds/main.cpp
+++ b/src/plugins/sqldrivers/tds/main.cpp
@@ -45,7 +45,7 @@
#define _WINSCARD_H_
#include <windows.h>
#endif
-#include "../../../sql/drivers/tds/qsql_tds_p.h"
+#include "qsql_tds_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/plugins/sqldrivers/tds/qsql_tds.cpp
index 10d9fe7298..10d9fe7298 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/plugins/sqldrivers/tds/qsql_tds.cpp
diff --git a/src/sql/drivers/tds/qsql_tds_p.h b/src/plugins/sqldrivers/tds/qsql_tds_p.h
index d0914455a2..d0914455a2 100644
--- a/src/sql/drivers/tds/qsql_tds_p.h
+++ b/src/plugins/sqldrivers/tds/qsql_tds_p.h
diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
index 88f4b7c451..b5d32ae5a8 100644
--- a/src/plugins/sqldrivers/tds/tds.pro
+++ b/src/plugins/sqldrivers/tds/tds.pro
@@ -1,8 +1,17 @@
TARGET = qsqltds
-SOURCES = main.cpp
+HEADERS += $$PWD/qsql_tds_p.h
+SOURCES += $$PWD/qsql_tds.cpp $$PWD/main.cpp
+
+unix|mingw: {
+ LIBS += $$QMAKE_LIBS_TDS
+ !contains(LIBS, .*sybdb.*):LIBS += -lsybdb
+ QMAKE_CXXFLAGS *= $$QMAKE_CFLAGS_TDS
+} else {
+ LIBS *= -lNTWDBLIB
+}
+
OTHER_FILES += tds.json
-include(../../../sql/drivers/tds/qsql_tds.pri)
PLUGIN_CLASS_NAME = QTDSDriverPlugin
include(../qsqldriverbase.pri)
diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h
index ed9e8e272b..199d8aef63 100644
--- a/src/printsupport/kernel/qprint_p.h
+++ b/src/printsupport/kernel/qprint_p.h
@@ -56,7 +56,7 @@
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
-#if (defined Q_OS_MAC && !defined Q_OS_IOS) || (defined Q_OS_UNIX && !defined QT_NO_CUPS)
+#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS)
#include <cups/ppd.h> // Use for type defs only, don't want to actually link in main module
#endif
@@ -244,7 +244,7 @@ public:
return QByteArray();
}
-#if (defined Q_OS_MAC && !defined Q_OS_IOS) || (defined Q_OS_UNIX && !defined QT_NO_CUPS)
+#if (defined Q_OS_OSX) || (defined Q_OS_UNIX && !defined QT_NO_CUPS)
// PPD utilities shared by CUPS and Mac plugins requiring CUPS headers
// May turn into a proper internal QPpd class if enough shared between Mac and CUPS,
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index edf4dcb164..a57b72b13e 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1716,7 +1716,6 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
}
}
-#if !defined(Q_OS_WINCE)
// Scale, rotate and translate here.
XFORM win_xform;
win_xform.eM11 = xform.m11();
@@ -1728,7 +1727,6 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
SetGraphicsMode(hdc, GM_ADVANCED);
SetWorldTransform(hdc, &win_xform);
-#endif
if (fast) {
// fast path
@@ -1781,11 +1779,9 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
}
}
-#if !defined(Q_OS_WINCE)
win_xform.eM11 = win_xform.eM22 = 1.0;
win_xform.eM12 = win_xform.eM21 = win_xform.eDx = win_xform.eDy = 0.0;
SetWorldTransform(hdc, &win_xform);
-#endif
SelectObject(hdc, old_font);
}
diff --git a/src/sql/drivers/db2/qsql_db2.pri b/src/sql/drivers/db2/qsql_db2.pri
deleted file mode 100644
index c9e65e2c2e..0000000000
--- a/src/sql/drivers/db2/qsql_db2.pri
+++ /dev/null
@@ -1,8 +0,0 @@
-HEADERS += $$PWD/qsql_db2_p.h
-SOURCES += $$PWD/qsql_db2.cpp
-
-unix {
- !contains(LIBS, .*db2.*):LIBS += -ldb2
-} else {
- !contains(LIBS, .*db2.*):LIBS += -ldb2cli
-}
diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri
deleted file mode 100644
index 87cc0b1d9e..0000000000
--- a/src/sql/drivers/drivers.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-contains(sql-drivers, all):sql-driver += psql mysql odbc oci tds db2 sqlite ibase
-
-contains(sql-drivers, psql):include($$PWD/psql/qsql_psql.pri)
-contains(sql-drivers, mysql):include($$PWD/mysql/qsql_mysql.pri)
-contains(sql-drivers, odbc):include($$PWD/odbc/qsql_odbc.pri)
-contains(sql-drivers, oci):include($$PWD/oci/qsql_oci.pri)
-contains(sql-drivers, tds):include($$PWD/tds/qsql_tds.pri)
-contains(sql-drivers, db2):include($$PWD/db2/qsql_db2.pri)
-contains(sql-drivers, ibase):include($$PWD/ibase/qsql_ibase.pri)
-contains(sql-drivers, sqlite2):include($$PWD/sqlite2/qsql_sqlite2.pri)
-contains(sql-drivers, sqlite):include($$PWD/sqlite/qsql_sqlite.pri)
diff --git a/src/sql/drivers/ibase/qsql_ibase.pri b/src/sql/drivers/ibase/qsql_ibase.pri
deleted file mode 100644
index ef3b68d34e..0000000000
--- a/src/sql/drivers/ibase/qsql_ibase.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-HEADERS += $$PWD/qsql_ibase_p.h
-SOURCES += $$PWD/qsql_ibase.cpp
-
-unix {
- !contains(LIBS, .*gds.*):!contains(LIBS, .*libfb.*):LIBS += -lgds
-} else {
- !contains(LIBS, .*gds.*):!contains(LIBS, .*fbclient.*) {
- LIBS += -lgds32_ms
- }
-}
diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri
deleted file mode 100644
index 3cfb6144a1..0000000000
--- a/src/sql/drivers/mysql/qsql_mysql.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-HEADERS += $$PWD/qsql_mysql_p.h
-SOURCES += $$PWD/qsql_mysql.cpp
-
-QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
-LIBS += $$QT_LFLAGS_MYSQL
-
-unix {
- isEmpty(QT_LFLAGS_MYSQL) {
- !contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
- use_libmysqlclient_r:LIBS += -lmysqlclient_r
- else:LIBS += -lmysqlclient
- }
- }
-} else {
- !contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*):LIBS += -llibmysql
-}
diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri
deleted file mode 100644
index 66ccdb1abb..0000000000
--- a/src/sql/drivers/oci/qsql_oci.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-HEADERS += $$PWD/qsql_oci_p.h
-SOURCES += $$PWD/qsql_oci.cpp
-
-unix {
- !contains(LIBS, .*clnts.*):LIBS += -lclntsh
-} else {
- LIBS *= -loci
-}
-mac:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri
deleted file mode 100644
index b206df37c3..0000000000
--- a/src/sql/drivers/odbc/qsql_odbc.pri
+++ /dev/null
@@ -1,12 +0,0 @@
-HEADERS += $$PWD/qsql_odbc_p.h
-SOURCES += $$PWD/qsql_odbc.cpp
-
-unix {
- DEFINES += UNICODE
- !contains(LIBS, .*odbc.*) {
- macx:LIBS += -liodbc
- else:LIBS += $$QT_LFLAGS_ODBC
- }
-} else {
- LIBS *= -lodbc32
-}
diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri
deleted file mode 100644
index 867be3edb8..0000000000
--- a/src/sql/drivers/psql/qsql_psql.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-HEADERS += $$PWD/qsql_psql_p.h
-SOURCES += $$PWD/qsql_psql.cpp
-
-unix|mingw {
- LIBS += $$QT_LFLAGS_PSQL
- !contains(LIBS, .*pq.*):LIBS += -lpq
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
-} else {
- !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32
-}
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.pri b/src/sql/drivers/sqlite/qsql_sqlite.pri
deleted file mode 100644
index e323f2eba5..0000000000
--- a/src/sql/drivers/sqlite/qsql_sqlite.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-HEADERS += $$PWD/qsql_sqlite_p.h
-SOURCES += $$PWD/qsql_sqlite.cpp
-
-!system-sqlite:!contains(LIBS, .*sqlite3.*) {
- include($$PWD/../../../3rdparty/sqlite.pri)
-} else {
- LIBS += $$QT_LFLAGS_SQLITE
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
-}
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri
deleted file mode 100644
index 5baba30db0..0000000000
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.pri
+++ /dev/null
@@ -1,4 +0,0 @@
-HEADERS += $$PWD/qsql_sqlite2_p.h
-SOURCES += $$PWD/qsql_sqlite2.cpp
-
-!contains(LIBS, .*sqlite.*):LIBS += -lsqlite
diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri
deleted file mode 100644
index 8c528c154d..0000000000
--- a/src/sql/drivers/tds/qsql_tds.pri
+++ /dev/null
@@ -1,10 +0,0 @@
-HEADERS += $$PWD/qsql_tds_p.h
-SOURCES += $$PWD/qsql_tds.cpp
-
-unix|mingw: {
- LIBS += $$QT_LFLAGS_TDS
- !contains(LIBS, .*sybdb.*):LIBS += -lsybdb
- QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS
-} else {
- LIBS *= -lNTWDBLIB
-}
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 62e1b6a7a5..d91e502b96 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -39,51 +39,6 @@
#include "qsqldatabase.h"
#include "qsqlquery.h"
-
-#ifdef Q_OS_WIN32
-// Conflicting declarations of LPCBYTE in sqlfront.h and winscard.h
-#define _WINSCARD_H_
-#endif
-
-#ifdef QT_SQL_PSQL
-#include "../drivers/psql/qsql_psql_p.h"
-#endif
-#ifdef QT_SQL_MYSQL
-#include "../drivers/mysql/qsql_mysql_p.h"
-#endif
-#ifdef QT_SQL_ODBC
-#include "../drivers/odbc/qsql_odbc_p.h"
-#endif
-#ifdef QT_SQL_OCI
-#include "../drivers/oci/qsql_oci_p.h"
-#endif
-#ifdef QT_SQL_TDS
-// conflicting RETCODE typedef between odbc and freetds
-#define RETCODE DBRETCODE
-#include "../drivers/tds/qsql_tds_p.h"
-#undef RETCODE
-#endif
-#ifdef QT_SQL_DB2
-#include "../drivers/db2/qsql_db2_p.h"
-#endif
-#ifdef QT_SQL_SQLITE
-#include "../drivers/sqlite/qsql_sqlite_p.h"
-#endif
-#ifdef QT_SQL_SQLITE2
-#include "../drivers/sqlite2/qsql_sqlite2_p.h"
-#endif
-#ifdef QT_SQL_IBASE
-#undef SQL_FLOAT // avoid clash with ODBC
-#undef SQL_DOUBLE
-#undef SQL_TIMESTAMP
-#undef SQL_TYPE_TIME
-#undef SQL_TYPE_DATE
-#undef SQL_DATE
-#define SCHAR IBASE_SCHAR // avoid clash with ODBC (older versions of ibase.h with Firebird)
-#include "../drivers/ibase/qsql_ibase_p.h"
-#undef SCHAR
-#endif
-
#include "qdebug.h"
#include "qcoreapplication.h"
#include "qreadwritelock.h"
@@ -542,39 +497,6 @@ QStringList QSqlDatabase::drivers()
{
QStringList list;
-#ifdef QT_SQL_PSQL
- list << QLatin1String("QPSQL7");
- list << QLatin1String("QPSQL");
-#endif
-#ifdef QT_SQL_MYSQL
- list << QLatin1String("QMYSQL3");
- list << QLatin1String("QMYSQL");
-#endif
-#ifdef QT_SQL_ODBC
- list << QLatin1String("QODBC3");
- list << QLatin1String("QODBC");
-#endif
-#ifdef QT_SQL_OCI
- list << QLatin1String("QOCI8");
- list << QLatin1String("QOCI");
-#endif
-#ifdef QT_SQL_TDS
- list << QLatin1String("QTDS7");
- list << QLatin1String("QTDS");
-#endif
-#ifdef QT_SQL_DB2
- list << QLatin1String("QDB2");
-#endif
-#ifdef QT_SQL_SQLITE
- list << QLatin1String("QSQLITE");
-#endif
-#ifdef QT_SQL_SQLITE2
- list << QLatin1String("QSQLITE2");
-#endif
-#ifdef QT_SQL_IBASE
- list << QLatin1String("QIBASE");
-#endif
-
if (QFactoryLoader *fl = loader()) {
typedef QMultiMap<int, QString> PluginKeyMap;
typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
@@ -726,45 +648,6 @@ void QSqlDatabasePrivate::init(const QString &type)
drvName = type;
if (!driver) {
-#ifdef QT_SQL_PSQL
- if (type == QLatin1String("QPSQL") || type == QLatin1String("QPSQL7"))
- driver = new QPSQLDriver();
-#endif
-#ifdef QT_SQL_MYSQL
- if (type == QLatin1String("QMYSQL") || type == QLatin1String("QMYSQL3"))
- driver = new QMYSQLDriver();
-#endif
-#ifdef QT_SQL_ODBC
- if (type == QLatin1String("QODBC") || type == QLatin1String("QODBC3"))
- driver = new QODBCDriver();
-#endif
-#ifdef QT_SQL_OCI
- if (type == QLatin1String("QOCI") || type == QLatin1String("QOCI8"))
- driver = new QOCIDriver();
-#endif
-#ifdef QT_SQL_TDS
- if (type == QLatin1String("QTDS") || type == QLatin1String("QTDS7"))
- driver = new QTDSDriver();
-#endif
-#ifdef QT_SQL_DB2
- if (type == QLatin1String("QDB2"))
- driver = new QDB2Driver();
-#endif
-#ifdef QT_SQL_SQLITE
- if (type == QLatin1String("QSQLITE"))
- driver = new QSQLiteDriver();
-#endif
-#ifdef QT_SQL_SQLITE2
- if (type == QLatin1String("QSQLITE2"))
- driver = new QSQLite2Driver();
-#endif
-#ifdef QT_SQL_IBASE
- if (type == QLatin1String("QIBASE"))
- driver = new QIBaseDriver();
-#endif
- }
-
- if (!driver) {
DriverDict dict = QSqlDatabasePrivate::driverDict();
for (DriverDict::const_iterator it = dict.constBegin();
it != dict.constEnd() && !driver; ++it) {
diff --git a/src/sql/sql.pro b/src/sql/sql.pro
index 8846f03d78..133bf831c8 100644
--- a/src/sql/sql.pro
+++ b/src/sql/sql.pro
@@ -11,7 +11,6 @@ PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
include(kernel/kernel.pri)
-include(drivers/drivers.pri)
include(models/models.pri)
MODULE_PLUGIN_TYPES = \
diff --git a/src/src.pro b/src/src.pro
index 585767361e..4ca1347f2b 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -132,9 +132,9 @@ src_plugins.depends = src_sql src_xml src_network
src_android.subdir = $$PWD/android
# this order is important
-contains(QT_CONFIG, zlib)|cross_compile {
+!contains(QT_CONFIG, system-zlib)|cross_compile {
SUBDIRS += src_qtzlib
- contains(QT_CONFIG, zlib) {
+ !contains(QT_CONFIG, system-zlib) {
src_3rdparty_libpng.depends += src_corelib
src_3rdparty_freetype.depends += src_corelib
}
@@ -159,7 +159,7 @@ contains(QT_CONFIG, dbus) {
}
contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
!contains(QT_CONFIG, no-gui) {
- contains(QT_CONFIG, harfbuzz) {
+ contains(QT_CONFIG, harfbuzz):!contains(QT_CONFIG, system-harfbuzz) {
SUBDIRS += src_3rdparty_harfbuzzng
src_gui.depends += src_3rdparty_harfbuzzng
}
@@ -172,7 +172,7 @@ contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
src_3rdparty_freetype.depends += src_3rdparty_libpng
src_plugins.depends += src_3rdparty_libpng
}
- contains(QT_CONFIG, freetype) {
+ contains(QT_CONFIG, freetype):!contains(QT_CONFIG, system-freetype) {
SUBDIRS += src_3rdparty_freetype
src_platformsupport.depends += src_3rdparty_freetype
}
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index 2cb174022d..2c57550c3d 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -241,17 +241,18 @@ QTest::qWaitForWindowShown(&widget);
//! [24]
//! [25]
+QTouchDevice *dev = QTest::createTouchDevice();
QWidget widget;
-QTest::touchEvent(&widget)
+QTest::touchEvent(&widget, dev)
.press(0, QPoint(10, 10));
-QTest::touchEvent(&widget)
+QTest::touchEvent(&widget, dev)
.stationary(0)
.press(1, QPoint(40, 10));
-QTest::touchEvent(&widget)
+QTest::touchEvent(&widget, dev)
.move(0, QPoint(12, 12))
.move(1, QPoint(45, 5));
-QTest::touchEvent(&widget)
+QTest::touchEvent(&widget, dev)
.release(0, QPoint(12, 12))
.release(1, QPoint(45, 5));
//! [25]
diff --git a/src/testlib/qabstracttestlogger.cpp b/src/testlib/qabstracttestlogger.cpp
index 72b5eb3ed7..8337600fa1 100644
--- a/src/testlib/qabstracttestlogger.cpp
+++ b/src/testlib/qabstracttestlogger.cpp
@@ -62,7 +62,7 @@ QAbstractTestLogger::QAbstractTestLogger(const char *filename)
stream = stdout;
return;
}
-#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE)
+#if defined(_MSC_VER)
if (::fopen_s(&stream, filename, "wt")) {
#else
stream = ::fopen(filename, "wt");
diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp
index 0a9072907f..0ba55dbeb7 100644
--- a/src/testlib/qbenchmarkmetric.cpp
+++ b/src/testlib/qbenchmarkmetric.cpp
@@ -56,6 +56,7 @@
\value CPUTicks CPU time
\value CPUMigrations Process migrations between CPUs
\value CPUCycles CPU cycles
+ \value RefCPUCycles Reference CPU cycles
\value BusCycles Bus cycles
\value StalledCycles Cycles stalled
\value InstructionReads Instruction reads
@@ -108,6 +109,8 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric)
return "CPUMigrations";
case CPUCycles:
return "CPUCycles";
+ case RefCPUCycles:
+ return "RefCPUCycles";
case BusCycles:
return "BusCycles";
case StalledCycles:
@@ -180,6 +183,8 @@ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric)
return "CPU migrations";
case CPUCycles:
return "CPU cycles";
+ case RefCPUCycles:
+ return "Reference CPU cycles";
case BusCycles:
return "bus cycles";
case StalledCycles:
diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h
index 44bf14b9b6..6e423473b1 100644
--- a/src/testlib/qbenchmarkmetric.h
+++ b/src/testlib/qbenchmarkmetric.h
@@ -78,7 +78,8 @@ enum QBenchmarkMetric {
MinorPageFaults,
MajorPageFaults,
AlignmentFaults,
- EmulationFaults
+ EmulationFaults,
+ RefCPUCycles,
};
}
diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp
index 587d3e0124..d6db40ce52 100644
--- a/src/testlib/qbenchmarkperfevents.cpp
+++ b/src/testlib/qbenchmarkperfevents.cpp
@@ -153,6 +153,7 @@ bool QBenchmarkPerfEventsMeasurer::isAvailable()
Event type Event counter Unit Name and aliases
HARDWARE CPU_CYCLES CPUCycles cycles cpu-cycles
+ HARDWARE REF_CPU_CYCLES RefCPUCycles ref-cycles
HARDWARE INSTRUCTIONS Instructions instructions
HARDWARE CACHE_REFERENCES CacheReferences cache-references
HARDWARE CACHE_MISSES CacheMisses cache-misses
@@ -321,6 +322,7 @@ static const char eventlist_strings[] =
"migrations\0"
"minor-faults\0"
"page-faults\0"
+ "ref-cycles\0"
"stalled-cycles-backend\0"
"stalled-cycles-frontend\0"
"task-clock\0"
@@ -407,9 +409,10 @@ static const Events eventlist[] = {
{ 1256, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS, QTest::CPUMigrations },
{ 1267, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN, QTest::MinorPageFaults },
{ 1280, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS, QTest::PageFaults },
- { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles },
- { 1315, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles },
- { 1339, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds },
+ { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES, QTest::RefCPUCycles },
+ { 1303, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles },
+ { 1326, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles },
+ { 1350, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds },
{ 0, PERF_TYPE_MAX, 0, QTest::Events }
};
/* -- END GENERATED CODE -- */
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index a286246acd..dc20d922e5 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -49,10 +49,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef Q_OS_WINCE
-#include <QtCore/QString>
-#endif
-
#ifdef min // windows.h without NOMINMAX is included by the benchmark headers.
# undef min
#endif
@@ -215,16 +211,7 @@ Q_CORE_EXPORT bool qt_logging_to_console(); // defined in qlogging.cpp
void QPlainTestLogger::outputMessage(const char *str)
{
-#if defined(Q_OS_WINCE)
- QString strUtf16 = QString::fromLocal8Bit(str);
- const int maxOutputLength = 255;
- do {
- QString tmp = strUtf16.left(maxOutputLength);
- OutputDebugString((wchar_t*)tmp.utf16());
- strUtf16.remove(0, maxOutputLength);
- } while (!strUtf16.isEmpty());
- if (stream != stdout)
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
// log to system log only if output is not redirected, and no console is attached
if (!qt_logging_to_console() && stream == stdout) {
OutputDebugStringA(str);
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 6ab8d3d96b..49a0c2104b 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -192,6 +192,11 @@ template<> inline char *toString(const QHostAddress &addr)
}
#endif
+inline char *toString(std::nullptr_t)
+{
+ return toString(QLatin1String("nullptr"));
+}
+
template<>
inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual,
const char *expected, const char *file, int line)
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp
index 05ad5cef5b..1fa76a692a 100644
--- a/src/testlib/qtestblacklist.cpp
+++ b/src/testlib/qtestblacklist.cpp
@@ -103,6 +103,9 @@ static QSet<QByteArray> keywords()
#ifdef Q_OS_IOS
<< "ios"
#endif
+#ifdef Q_OS_TVOS
+ << "tvos"
+#endif
#ifdef Q_OS_ANDROID
<< "android"
#endif
@@ -112,9 +115,6 @@ static QSet<QByteArray> keywords()
#ifdef Q_OS_WINRT
<< "winrt"
#endif
-#ifdef Q_OS_WINCE
- << "wince"
-#endif
#if QT_POINTER_SIZE == 8
<< "64bit"
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 2231f12e2d..b6c70fdd86 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -87,11 +87,9 @@
#endif
#ifdef Q_OS_WIN
-#ifndef Q_OS_WINCE
# if !defined(Q_CC_MINGW) || (defined(Q_CC_MINGW) && defined(__MINGW64_VERSION_MAJOR))
# include <crtdbg.h>
# endif
-#endif
#include <windows.h> // for Sleep
#endif
#ifdef Q_OS_UNIX
@@ -111,6 +109,36 @@ QT_BEGIN_NAMESPACE
using QtMiscUtils::toHexUpper;
using QtMiscUtils::fromHex;
+static bool debuggerPresent()
+{
+#if defined(Q_OS_LINUX)
+ int fd = open("/proc/self/status", O_RDONLY);
+ if (fd == -1)
+ return false;
+ char buffer[2048];
+ ssize_t size = read(fd, buffer, sizeof(buffer) - 1);
+ if (size == -1) {
+ close(fd);
+ return false;
+ }
+ buffer[size] = 0;
+ const char tracerPidToken[] = "\nTracerPid:";
+ char *tracerPid = strstr(buffer, tracerPidToken);
+ if (!tracerPid) {
+ close(fd);
+ return false;
+ }
+ tracerPid += sizeof(tracerPidToken);
+ long int pid = strtol(tracerPid, &tracerPid, 10);
+ close(fd);
+ return pid != 0;
+#elif defined(Q_OS_WIN)
+ return IsDebuggerPresent();
+#else
+ // TODO
+ return false;
+#endif
+}
static void stackTrace()
{
@@ -118,6 +146,10 @@ static void stackTrace()
const int disableStackDump = qEnvironmentVariableIntValue("QTEST_DISABLE_STACK_DUMP", &ok);
if (ok && disableStackDump == 1)
return;
+
+ if (debuggerPresent())
+ return;
+
#ifdef Q_OS_LINUX
fprintf(stderr, "\n========= Received signal, dumping stack ==============\n");
char cmd[512];
@@ -1251,37 +1283,6 @@ char *toPrettyUnicode(const ushort *p, int length)
return buffer.take();
}
-static bool debuggerPresent()
-{
-#if defined(Q_OS_LINUX)
- int fd = open("/proc/self/status", O_RDONLY);
- if (fd == -1)
- return false;
- char buffer[2048];
- ssize_t size = read(fd, buffer, sizeof(buffer) - 1);
- if (size == -1) {
- close(fd);
- return false;
- }
- buffer[size] = 0;
- const char tracerPidToken[] = "\nTracerPid:";
- char *tracerPid = strstr(buffer, tracerPidToken);
- if (!tracerPid) {
- close(fd);
- return false;
- }
- tracerPid += sizeof(tracerPidToken);
- long int pid = strtol(tracerPid, &tracerPid, 10);
- close(fd);
- return pid != 0;
-#elif defined(Q_OS_WIN)
- return IsDebuggerPresent();
-#else
- // TODO
- return false;
-#endif
-}
-
void TestMethods::invokeTests(QObject *testObject) const
{
const QMetaObject *metaObject = testObject->metaObject();
@@ -1380,7 +1381,9 @@ FatalSignalHandler::FatalSignalHandler()
act.sa_flags = SA_RESETHAND;
#endif
-#ifdef SA_ONSTACK
+// tvOS/watchOS both define SA_ONSTACK (in sys/signal.h) but mark sigaltstack() as
+// unavailable (__WATCHOS_PROHIBITED __TVOS_PROHIBITED in signal.h)
+#if defined(SA_ONSTACK) && !defined(Q_OS_TVOS)
// Let the signal handlers use an alternate stack
// This is necessary if SIGSEGV is to catch a stack overflow
# if defined(Q_CC_GNU) && defined(Q_OF_ELF)
@@ -1446,7 +1449,7 @@ FatalSignalHandler::~FatalSignalHandler()
} // namespace
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
// Helper class for resolving symbol names by dynamically loading "dbghelp.dll".
class DebugSymbolResolver
@@ -1584,7 +1587,7 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
return EXCEPTION_EXECUTE_HANDLER;
}
-#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN) && !Q_OS_WINRT
static void initEnvironment()
{
@@ -1676,7 +1679,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
qtest_qParseArgs(argc, argv, false);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (!noCrashHandler) {
# ifndef Q_CC_MINGW
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
@@ -1686,7 +1689,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
SetUnhandledExceptionFilter(windowsFaultHandler);
# endif
} // !noCrashHandler
-#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN
#ifdef QTESTLIB_USE_VALGRIND
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) {
@@ -2421,6 +2424,14 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
+/*! \fn bool QTest::qCompare(T *t, std::nullptr_t, const char *actual, const char *expected, const char *file, int line)
+ \internal
+*/
+
+/*! \fn bool QTest::qCompare(std::nullptr_t, T *t, const char *actual, const char *expected, const char *file, int line)
+ \internal
+*/
+
/*! \fn bool QTest::qCompare(T *t1, T *t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 83ecaab8df..09da575bc9 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -63,7 +63,7 @@ class QRegularExpression;
#define QVERIFY(statement) \
do {\
- if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\
+ if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
return;\
} while (0)
@@ -332,13 +332,27 @@ namespace QTest
Q_TESTLIB_EXPORT bool qCompare(double const &t1, double const &t2,
const char *actual, const char *expected, const char *file, int line);
- inline bool compare_ptr_helper(const void *t1, const void *t2, const char *actual,
+ inline bool compare_ptr_helper(const volatile void *t1, const volatile void *t2, const char *actual,
const char *expected, const char *file, int line)
{
return compare_helper(t1 == t2, "Compared pointers are not the same",
toString(t1), toString(t2), actual, expected, file, line);
}
+ inline bool compare_ptr_helper(const volatile void *t1, std::nullptr_t, const char *actual,
+ const char *expected, const char *file, int line)
+ {
+ return compare_helper(t1 == nullptr, "Compared pointers are not the same",
+ toString(t1), toString(nullptr), actual, expected, file, line);
+ }
+
+ inline bool compare_ptr_helper(std::nullptr_t, const volatile void *t2, const char *actual,
+ const char *expected, const char *file, int line)
+ {
+ return compare_helper(nullptr == t2, "Compared pointers are not the same",
+ toString(nullptr), toString(t2), actual, expected, file, line);
+ }
+
Q_TESTLIB_EXPORT bool compare_string_helper(const char *t1, const char *t2, const char *actual,
const char *expected, const char *file, int line);
@@ -388,6 +402,19 @@ namespace QTest
return compare_ptr_helper(t1, t2, actual, expected, file, line);
}
+ template <typename T>
+ inline bool qCompare(T *t1, std::nullptr_t, const char *actual, const char *expected,
+ const char *file, int line)
+ {
+ return compare_ptr_helper(t1, nullptr, actual, expected, file, line);
+ }
+ template <typename T>
+ inline bool qCompare(std::nullptr_t, T *t2, const char *actual, const char *expected,
+ const char *file, int line)
+ {
+ return compare_ptr_helper(nullptr, t2, actual, expected, file, line);
+ }
+
template <typename T1, typename T2>
inline bool qCompare(const T1 *t1, const T2 *t2, const char *actual, const char *expected,
const char *file, int line)
diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc
index 85f71fc27f..8bf3b30ffb 100644
--- a/src/testlib/qtestcase.qdoc
+++ b/src/testlib/qtestcase.qdoc
@@ -907,6 +907,14 @@
*/
/*!
+ \fn char *QTest::toString(std::nullptr_t)
+ \overload
+ \since 5.8
+
+ Returns a string containing \c{nullptr}.
+*/
+
+/*!
\fn char *QTest::toString(const QString &string)
\overload
@@ -1114,6 +1122,20 @@
*/
/*!
+ \fn QTest::createTouchDevice()
+ \since 5.8
+
+ Creates a dummy touch device for simulation of touch events.
+
+ The touch device will be registered with the QPA window system interface,
+ and deleted automatically when the QCoreApplication is deleted. So you
+ should typically use createTouchDevice() to initialize a QTouchDevice
+ member variable in your test case class, and use the same instance for all tests.
+
+ \sa QTest::QTouchEventSequence
+*/
+
+/*!
\class QTest::QTouchEventSequence
\inmodule QtTest
\since 4.6
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index bdc964389e..11aa14c268 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -65,6 +65,7 @@ Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
namespace QTest
{
+ Q_GUI_EXPORT QTouchDevice * createTouchDevice(QTouchDevice::DeviceType devType = QTouchDevice::TouchScreen);
class QTouchEventSequence
{
diff --git a/src/testlib/qxctestlogger.mm b/src/testlib/qxctestlogger.mm
index c50b50eb06..ffabe88db2 100644
--- a/src/testlib/qxctestlogger.mm
+++ b/src/testlib/qxctestlogger.mm
@@ -191,7 +191,7 @@ private:
name:[NSString stringWithFormat:@"%@DidFinishLaunchingNotification",
#if defined(Q_OS_OSX)
@"NSApplication"
- #elif defined(Q_OS_IOS)
+ #else
@"UIApplication"
#endif
]
diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp
index 72faaeb9b1..ec33c29ae5 100644
--- a/src/testlib/qxunittestlogger.cpp
+++ b/src/testlib/qxunittestlogger.cpp
@@ -256,7 +256,7 @@ void QXunitTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
benchmarkElement->addAttribute(
QTest::AI_Metric,
- QTest::benchmarkMetricName(QBenchmarkTestMethodData::current->result.metric));
+ QTest::benchmarkMetricName(result.metric));
benchmarkElement->addAttribute(QTest::AI_Tag, result.context.tag.toUtf8().data());
const qreal valuePerIteration = qreal(result.value) / qreal(result.iterations);
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 372a69c3ed..386dfb6c0e 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -67,13 +67,6 @@ DEFINES *= QT_NO_CAST_TO_ASCII \
QT_NO_FOREACH \
QT_NO_DATASTREAM
embedded:QMAKE_CXXFLAGS += -fno-rtti
-wince: LIBS += \
- ole32.lib \
- oleaut32.lib \
- uuid.lib \
- commctrl.lib \
- coredll.lib \
- winsock.lib
mac {
LIBS += -framework Security
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index a43105297f..f763d0c8fe 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -119,12 +119,12 @@ mac {
LIBS += -framework Foundation
osx: LIBS_PRIVATE += -framework CoreServices
- ios: LIBS_PRIVATE += -framework UIKit
+ uikit: LIBS_PRIVATE += -framework UIKit
}
macx {
OBJECTIVE_SOURCES += \
- ../../corelib/tools/qstring_mac.mm \
+ ../../corelib/kernel/qcore_foundation.mm \
../../corelib/io/qstandardpaths_mac.mm
} else:unix {
SOURCES += \
@@ -134,7 +134,7 @@ macx {
../../corelib/io/qstandardpaths_win.cpp
}
-contains(QT_CONFIG, zlib)|cross_compile {
+!contains(QT_CONFIG, system-zlib)|cross_compile {
include(../../3rdparty/zlib.pri)
} else {
CONFIG += no_core_dep
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 0734a92d5a..491301d582 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -200,20 +200,24 @@ int runMoc(int argc, char **argv)
.arg(mocOutputRevision).arg(QString::fromLatin1(QT_VERSION_STR)));
parser.addHelpOption();
parser.addVersionOption();
+ parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
QCommandLineOption outputOption(QStringLiteral("o"));
outputOption.setDescription(QStringLiteral("Write output to file rather than stdout."));
outputOption.setValueName(QStringLiteral("file"));
+ outputOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(outputOption);
QCommandLineOption includePathOption(QStringLiteral("I"));
includePathOption.setDescription(QStringLiteral("Add dir to the include path for header files."));
includePathOption.setValueName(QStringLiteral("dir"));
+ includePathOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(includePathOption);
QCommandLineOption macFrameworkOption(QStringLiteral("F"));
macFrameworkOption.setDescription(QStringLiteral("Add Mac framework to the include path for header files."));
macFrameworkOption.setValueName(QStringLiteral("framework"));
+ macFrameworkOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(macFrameworkOption);
QCommandLineOption preprocessOption(QStringLiteral("E"));
@@ -223,16 +227,19 @@ int runMoc(int argc, char **argv)
QCommandLineOption defineOption(QStringLiteral("D"));
defineOption.setDescription(QStringLiteral("Define macro, with optional definition."));
defineOption.setValueName(QStringLiteral("macro[=def]"));
+ defineOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(defineOption);
QCommandLineOption undefineOption(QStringLiteral("U"));
undefineOption.setDescription(QStringLiteral("Undefine macro."));
undefineOption.setValueName(QStringLiteral("macro"));
+ undefineOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(undefineOption);
QCommandLineOption metadataOption(QStringLiteral("M"));
metadataOption.setDescription(QStringLiteral("Add key/value pair to plugin meta data"));
metadataOption.setValueName(QStringLiteral("key=value"));
+ metadataOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(metadataOption);
QCommandLineOption noIncludeOption(QStringLiteral("i"));
@@ -242,11 +249,13 @@ int runMoc(int argc, char **argv)
QCommandLineOption pathPrefixOption(QStringLiteral("p"));
pathPrefixOption.setDescription(QStringLiteral("Path prefix for included file."));
pathPrefixOption.setValueName(QStringLiteral("path"));
+ pathPrefixOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(pathPrefixOption);
QCommandLineOption forceIncludeOption(QStringLiteral("f"));
forceIncludeOption.setDescription(QStringLiteral("Force #include <file> (overwrite default)."));
forceIncludeOption.setValueName(QStringLiteral("file"));
+ forceIncludeOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(forceIncludeOption);
QCommandLineOption prependIncludeOption(QStringLiteral("b"));
@@ -257,6 +266,7 @@ int runMoc(int argc, char **argv)
QCommandLineOption noNotesWarningsCompatOption(QStringLiteral("n"));
noNotesWarningsCompatOption.setDescription(QStringLiteral("Do not display notes (-nn) or warnings (-nw). Compatibility option."));
noNotesWarningsCompatOption.setValueName(QStringLiteral("which"));
+ noNotesWarningsCompatOption.setFlags(QCommandLineOption::ShortOptionStyle);
parser.addOption(noNotesWarningsCompatOption);
QCommandLineOption noNotesOption(QStringLiteral("no-notes"));
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp
index 7466da47f3..8c8141f9e5 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp
@@ -770,22 +770,22 @@ void WriteInitialization::acceptWidget(DomWidget *node)
//
// Special handling for qtableview/qtreeview fake header attributes
//
- static const QStringList realPropertyNames =
- (QStringList() << QLatin1String("visible")
- << QLatin1String("cascadingSectionResizes")
- << QLatin1String("defaultSectionSize")
- << QLatin1String("highlightSections")
- << QLatin1String("minimumSectionSize")
- << QLatin1String("showSortIndicator")
- << QLatin1String("stretchLastSection"));
+ static const QLatin1String realPropertyNames[] = {
+ QLatin1String("visible"),
+ QLatin1String("cascadingSectionResizes"),
+ QLatin1String("defaultSectionSize"),
+ QLatin1String("highlightSections"),
+ QLatin1String("minimumSectionSize"),
+ QLatin1String("showSortIndicator"),
+ QLatin1String("stretchLastSection"),
+ };
if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeView"))
|| m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTreeWidget"))) {
DomPropertyList headerProperties;
- for (const QString &realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
- + realPropertyName.mid(1);
- const QString fakePropertyName = QLatin1String("header") + upperPropertyName;
+ for (auto realPropertyName : realPropertyNames) {
+ const QString fakePropertyName = QLatin1String("header")
+ + QChar(realPropertyName.at(0)).toUpper() + realPropertyName.mid(1);
if (DomProperty *fakeProperty = attributes.value(fakePropertyName)) {
fakeProperty->setAttributeName(realPropertyName);
headerProperties << fakeProperty;
@@ -797,16 +797,16 @@ void WriteInitialization::acceptWidget(DomWidget *node)
} else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableView"))
|| m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTableWidget"))) {
- static const QStringList headerPrefixes =
- (QStringList() << QLatin1String("horizontalHeader")
- << QLatin1String("verticalHeader"));
+ static const QLatin1String headerPrefixes[] = {
+ QLatin1String("horizontalHeader"),
+ QLatin1String("verticalHeader"),
+ };
- for (const QString &headerPrefix : headerPrefixes) {
+ for (auto headerPrefix : headerPrefixes) {
DomPropertyList headerProperties;
- for (const QString &realPropertyName : realPropertyNames) {
- const QString upperPropertyName = realPropertyName.at(0).toUpper()
- + realPropertyName.mid(1);
- const QString fakePropertyName = headerPrefix + upperPropertyName;
+ for (auto realPropertyName : realPropertyNames) {
+ const QString fakePropertyName = headerPrefix
+ + QChar(realPropertyName.at(0)).toUpper() + realPropertyName.mid(1);
if (DomProperty *fakeProperty = attributes.value(fakePropertyName)) {
fakeProperty->setAttributeName(realPropertyName);
headerProperties << fakeProperty;
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 8faa73b68b..463019dbd0 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -120,19 +120,26 @@ public:
{
if (!isValid())
return QString();
+ QString str;
switch (t) {
case QAccessible::Name:
- return qt_accStripAmp(m_parent->tabText(m_index));
+ str = m_parent->accessibleTabName(m_index);
+ if (str.isEmpty())
+ str = qt_accStripAmp(m_parent->tabText(m_index));
+ break;
case QAccessible::Accelerator:
- return qt_accHotKey(m_parent->tabText(m_index));
+ str = qt_accHotKey(m_parent->tabText(m_index));
+ break;
case QAccessible::Description:
- return m_parent->tabToolTip(m_index);
+ str = m_parent->tabToolTip(m_index);
+ break;
case QAccessible::Help:
- return m_parent->tabWhatsThis(m_index);
+ str = m_parent->tabWhatsThis(m_index);
+ break;
default:
break;
}
- return QString();
+ return str;
}
void setText(QAccessible::Text, const QString &) Q_DECL_OVERRIDE {}
@@ -237,7 +244,12 @@ int QAccessibleTabBar::childCount() const
QString QAccessibleTabBar::text(QAccessible::Text t) const
{
if (t == QAccessible::Name) {
- return qt_accStripAmp(tabBar()->tabText(tabBar()->currentIndex()));
+ const QTabBar *tBar = tabBar();
+ int idx = tBar->currentIndex();
+ QString str = tBar->accessibleTabName(idx);
+ if (str.isEmpty())
+ str = qt_accStripAmp(tBar->tabText(idx));
+ return str;
} else if (t == QAccessible::Accelerator) {
return qt_accHotKey(tabBar()->tabText(tabBar()->currentIndex()));
}
diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp
index ebe8efc79e..ecb84d8b50 100644
--- a/src/widgets/accessible/itemviews.cpp
+++ b/src/widgets/accessible/itemviews.cpp
@@ -512,7 +512,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const
if (!iface) {
QModelIndex index = view()->model()->index(row, column, view()->rootIndex());
if (Q_UNLIKELY(!index.isValid())) {
- qWarning() << "QAccessibleTable::child: Invalid index at: " << row << column;
+ qWarning("QAccessibleTable::child: Invalid index at: %d %d", row, column);
return 0;
}
iface = new QAccessibleTableCell(view(), index, cellRole());
@@ -783,7 +783,7 @@ QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const
{
QModelIndex index = indexFromLogical(row, column);
if (Q_UNLIKELY(!index.isValid())) {
- qWarning() << "Requested invalid tree cell: " << row << column;
+ qWarning("Requested invalid tree cell: %d %d", row, column);
return 0;
}
const QTreeView *treeView = qobject_cast<const QTreeView*>(view());
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 04ef82f49d..f3652c09da 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -92,7 +92,7 @@ public:
SetColorAll = ShowColor | SelectColor
};
- QColorDialogPrivate() : options(new QColorDialogOptions)
+ QColorDialogPrivate() : options(QColorDialogOptions::create())
#ifdef Q_OS_WIN32
, updateTimer(0)
#endif
@@ -1180,14 +1180,10 @@ QColorShower::QColorShower(QColorDialog *parent)
gl->setMargin(gl->spacing());
lab = new QColorShowLabel(this);
-#ifndef Q_OS_WINCE
#ifdef QT_SMALL_COLORDIALOG
lab->setMinimumHeight(60);
#endif
lab->setMinimumWidth(60);
-#else
- lab->setMinimumWidth(20);
-#endif
// For QVGA screens only the comboboxes and color label are visible.
// For nHD screens only color and luminence pickers and color label are visible.
@@ -1702,7 +1698,7 @@ void QColorDialogPrivate::initWidgets()
leftLay = 0;
-#if defined(Q_OS_WINCE) || defined(QT_SMALL_COLORDIALOG)
+#if defined(QT_SMALL_COLORDIALOG)
smallDisplay = true;
const int lumSpace = 20;
#else
@@ -1725,7 +1721,7 @@ void QColorDialogPrivate::initWidgets()
leftLay->addWidget(lblBasicColors);
leftLay->addWidget(standard);
-#if !defined(Q_OS_WINCE) && !defined(QT_SMALL_COLORDIALOG)
+#if !defined(QT_SMALL_COLORDIALOG)
// The screen color picker button
screenColorPickerButton = new QPushButton();
leftLay->addWidget(screenColorPickerButton);
@@ -1734,9 +1730,7 @@ void QColorDialogPrivate::initWidgets()
q->connect(screenColorPickerButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor()));
#endif
-#if !defined(Q_OS_WINCE)
leftLay->addStretch();
-#endif
custom = new QColorWell(q, customColorRows, colorColumns, QColorDialogOptions::customColors());
custom->setAcceptDrops(true);
@@ -1931,10 +1925,8 @@ static const Qt::WindowFlags DefaultWindowFlags =
Constructs a color dialog with the given \a parent.
*/
QColorDialog::QColorDialog(QWidget *parent)
- : QDialog(*new QColorDialogPrivate, parent, DefaultWindowFlags)
+ : QColorDialog(QColor(Qt::white), parent)
{
- Q_D(QColorDialog);
- d->init(Qt::white);
}
/*!
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 8f3072e41c..464a1e139e 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -427,31 +427,6 @@ void QDialogPrivate::resetModalitySetByOpen()
resetModalityTo = -1;
}
-#if defined(Q_OS_WINCE)
-#ifdef Q_OS_WINCE_WM
-void QDialogPrivate::_q_doneAction()
-{
- //Done...
- QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest));
-}
-#endif
-
-/*!
- \reimp
-*/
-bool QDialog::event(QEvent *e)
-{
- bool result = QWidget::event(e);
-#ifdef Q_OS_WINCE
- if (e->type() == QEvent::OkRequest) {
- accept();
- result = true;
- }
-#endif
- return result;
-}
-#endif
-
/*!
In general returns the modal dialog's result code, \c Accepted or
\c Rejected.
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index db5baf24f9..562fbb63bb 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -98,9 +98,6 @@ public Q_SLOTS:
protected:
QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
-#if defined(Q_OS_WINCE)
- bool event(QEvent *e);
-#endif
void keyPressEvent(QKeyEvent *);
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
@@ -113,10 +110,6 @@ protected:
private:
Q_DECLARE_PRIVATE(QDialog)
Q_DISABLE_COPY(QDialog)
-
-#ifdef Q_OS_WINCE_WM
- Q_PRIVATE_SLOT(d_func(), void _q_doneAction())
-#endif
};
QT_END_NAMESPACE
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 6a9b5bae57..6fe4b602a1 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -99,10 +99,6 @@ public:
void hideDefault();
void resetModalitySetByOpen();
-#ifdef Q_OS_WINCE_WM
- void _q_doneAction();
-#endif
-
int rescode;
int resetModalityTo;
bool wasModalitySet;
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 77d9eb29ac..5fcbe3fe9d 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -60,11 +60,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef Q_OS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
-#endif
-
QT_BEGIN_NAMESPACE
class QErrorMessagePrivate : public QDialogPrivate
@@ -100,32 +95,12 @@ public:
QSize QErrorMessageTextView::minimumSizeHint() const
{
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile())
- if (qt_wince_is_high_dpi())
- return QSize(200, 200);
- else
- return QSize(100, 100);
- else
- return QSize(70, 70);
-#else
return QSize(50, 50);
-#endif
}
QSize QErrorMessageTextView::sizeHint() const
{
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile())
- if (qt_wince_is_high_dpi())
- return QSize(400, 200);
- else
- return QSize(320, 120);
- else
- return QSize(300, 100);
-#else
return QSize(250, 75);
-#endif //Q_OS_WINCE
}
/*!
@@ -248,9 +223,6 @@ QErrorMessage::QErrorMessage(QWidget * parent)
d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
#endif
d->again->setChecked(true);
-#if defined(Q_OS_WINCE)
- d->ok->setFixedSize(0,0);
-#endif
d->ok->setFocus();
d->retranslateStrings();
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 1cf2d2b05e..e5f11e78da 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -60,15 +60,7 @@
#include <qmimedatabase.h>
#include <qapplication.h>
#include <qstylepainter.h>
-#if !defined(Q_OS_WINCE)
#include "ui_qfiledialog.h"
-#else
-#define Q_EMBEDDED_SMALLSCREEN
-#include "ui_qfiledialog_embedded.h"
-#if defined(Q_OS_WINCE)
-extern bool qt_priv_ptr_valid;
-#endif
-#endif
#if defined(Q_OS_UNIX)
#include <pwd.h>
#include <unistd.h> // for pathconf() on OS X
@@ -533,7 +525,7 @@ QFileDialogPrivate::QFileDialogPrivate()
showHiddenAction(0),
useDefaultCaption(true),
qFileDialogUi(0),
- options(new QFileDialogOptions)
+ options(QFileDialogOptions::create())
{
}
@@ -1750,7 +1742,7 @@ int QFileDialogPrivate::maxNameLength(const QString &path)
{
#if defined(Q_OS_UNIX)
return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
-#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+#elif defined(Q_OS_WINRT)
Q_UNUSED(path);
return MAX_PATH;
#elif defined(Q_OS_WIN)
@@ -4015,7 +4007,7 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const
QString currentLocation = dirModel->rootPath();
QString path = index.data(QFileSystemModel::FilePathRole).toString();
if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) {
-#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE)
+#if defined(Q_OS_UNIX)
if (currentLocation == QDir::separator())
return path.mid(currentLocation.length());
#endif
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index f273a4fb37..d10f6d7065 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -177,10 +177,6 @@ public:
#if defined(Q_OS_WIN)
QString n(path);
n.replace(QLatin1Char('\\'), QLatin1Char('/'));
-#if defined(Q_OS_WINCE)
- if ((n.size() > 1) && (n.startsWith(QLatin1String("//"))))
- n = n.mid(1);
-#endif
return n;
#else // the compile should optimize away this
return path;
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 014792ea93..6df020dd58 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -263,7 +263,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const
static QString translateDriveName(const QFileInfo &drive)
{
QString driveName = drive.absoluteFilePath();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (driveName.startsWith(QLatin1Char('/'))) // UNC host
return drive.fileName();
if (driveName.endsWith(QLatin1Char('/')))
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 81c8fbe229..5424a4126a 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -366,7 +366,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
// ### TODO can we use bool QAbstractFileEngine::caseSensitive() const?
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
if ((pathElements.isEmpty())
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN)
&& QDir::fromNativeSeparators(longPath) != QLatin1String("/")
#endif
)
@@ -375,7 +375,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
QString elementPath;
QChar separator = QLatin1Char('/');
QString trailingSeparator;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
QString host = QLatin1String("\\\\") + pathElements.constFirst();
if (absolutePath == QDir::fromNativeSeparators(host))
@@ -840,7 +840,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const
*/
QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
QFileSystemNode *dirNode = node(index);
if (!dirNode->volumeName.isNull())
return dirNode->volumeName + QLatin1String(" (") + name(index) + QLatin1Char(')');
@@ -1292,11 +1292,10 @@ QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const
idx = idx.parent();
}
QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator()));
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN)
if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/'))
fullPath = fullPath.mid(1);
-#endif
-#if defined(Q_OS_WIN)
+#else
if (fullPath.length() == 2 && fullPath.endsWith(QLatin1Char(':')))
fullPath.append(QLatin1Char('/'));
#endif
@@ -1687,7 +1686,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile
#else
Q_UNUSED(info)
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
//The parentNode is "" so we are listing the drives
if (parentNode->fileName.isEmpty()) {
wchar_t name[MAX_PATH + 1];
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index af3406b699..beb25f665d 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -95,7 +95,7 @@ public:
}
QString fileName;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
QString volumeName;
#endif
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 2a500d3a08..1c4166c567 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -110,7 +110,7 @@ static const Qt::WindowFlags DefaultWindowFlags =
QFontDialogPrivate::QFontDialogPrivate()
: writingSystem(QFontDatabase::Any),
- options(QSharedPointer<QFontDialogOptions>::create())
+ options(QFontDialogOptions::create())
{
}
@@ -168,10 +168,8 @@ QFontDialog::QFontDialog(QWidget *parent)
\a initial color.
*/
QFontDialog::QFontDialog(const QFont &initial, QWidget *parent)
- : QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags)
+ : QFontDialog(parent)
{
- Q_D(QFontDialog);
- d->init();
setCurrentFont(initial);
}
@@ -321,11 +319,7 @@ void QFontDialogPrivate::init()
buttonBox->addButton(QDialogButtonBox::Cancel);
QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
-#if defined(Q_OS_WINCE)
- q->resize(180, 120);
-#else
q->resize(500, 360);
-#endif // Q_OS_WINCE
sizeEdit->installEventFilter(q);
familyList->installEventFilter(q);
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 88af70fa36..689704884f 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -200,7 +200,7 @@ public:
#endif
compatMode(false), autoAddOkButton(true),
detectedEscapeButton(0), informativeLabel(0),
- options(new QMessageDialogOptions) { }
+ options(QMessageDialogOptions::create()) { }
void init(const QString &title = QString(), const QString &text = QString());
void setupLayout();
@@ -218,9 +218,6 @@ public:
int layoutMinimumWidth();
void retranslateStrings();
-#ifdef Q_OS_WINCE
- void hideSpecial();
-#endif
static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon,
const QString &title, const QString &text,
int button0, int button1, int button2);
@@ -362,24 +359,15 @@ void QMessageBoxPrivate::updateSize()
return;
QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
-#if defined(Q_OS_WINCE)
- // the width of the screen, less the window border.
- int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width());
-#else
int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this
// on small screens allows the messagebox be the same size as the screen
if (screenSize.width() <= 1024)
hardLimit = screenSize.width();
-#endif
#ifdef Q_OS_MAC
int softLimit = qMin(screenSize.width()/2, 420);
#else
// note: ideally on windows, hard and soft limits but it breaks compat
-#ifndef Q_OS_WINCE
int softLimit = qMin(screenSize.width()/2, 500);
-#else
- int softLimit = qMin(screenSize.width() * 3 / 4, 500);
-#endif //Q_OS_WINCE
#endif
if (informativeLabel)
@@ -436,28 +424,6 @@ void QMessageBoxPrivate::updateSize()
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}
-
-#ifdef Q_OS_WINCE
-/*!
- \internal
- Hides special buttons which are rather shown in the title bar
- on WinCE, to conserve screen space.
-*/
-
-void QMessageBoxPrivate::hideSpecial()
-{
- Q_Q(QMessageBox);
- QList<QPushButton*> list = q->findChildren<QPushButton*>();
- for (int i=0; i<list.size(); ++i) {
- QPushButton *pb = list.at(i);
- QString text = pb->text();
- text.remove(QChar::fromLatin1('&'));
- if (text == QApplication::translate("QMessageBox", "OK" ))
- pb->setFixedSize(0,0);
- }
-}
-#endif
-
static int oldButton(int button)
{
switch (button & QMessageBox::ButtonMask) {
@@ -1368,24 +1334,6 @@ bool QMessageBox::event(QEvent *e)
case QEvent::LanguageChange:
d_func()->retranslateStrings();
break;
-#ifdef Q_OS_WINCE
- case QEvent::OkRequest:
- case QEvent::HelpRequest: {
- QString bName =
- (e->type() == QEvent::OkRequest)
- ? QApplication::translate("QMessageBox", "OK")
- : QApplication::translate("QMessageBox", "Help");
- QList<QPushButton*> list = findChildren<QPushButton*>();
- for (int i=0; i<list.size(); ++i) {
- QPushButton *pb = list.at(i);
- if (pb->text() == bName) {
- if (pb->isEnabled())
- pb->click();
- return pb->isEnabled();
- }
- }
- }
-#endif
default:
break;
}
@@ -1525,20 +1473,6 @@ void QMessageBox::keyPressEvent(QKeyEvent *e)
QDialog::keyPressEvent(e);
}
-#ifdef Q_OS_WINCE
-/*!
- \reimp
-*/
-void QMessageBox::setVisible(bool visible)
-{
- Q_D(QMessageBox);
- if (visible)
- d->hideSpecial();
- QDialog::setVisible(visible);
-}
-#endif
-
-
/*!
\overload
@@ -1596,9 +1530,6 @@ void QMessageBox::showEvent(QShowEvent *e)
Q_D(QMessageBox);
if (d->autoAddOkButton) {
addButton(Ok);
-#if defined(Q_OS_WINCE)
- d->hideSpecial();
-#endif
}
if (d->detailsButton)
addButton(d->detailsButton, QMessageBox::ActionRole);
@@ -1912,9 +1843,6 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
if (!pm.isNull())
msgBox->setIconPixmap(pm);
-#if defined(Q_OS_WINCE)
- msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok));
-#endif
// should perhaps be a style hint
#ifdef Q_OS_MAC
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index c958e4c352..8cded63a3c 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -142,10 +142,6 @@ public:
QPushButton *addButton(StandardButton button);
void removeButton(QAbstractButton *button);
-#ifdef Q_OS_WINCE
- void setVisible(bool visible);
-#endif
-
using QDialog::open;
void open(QObject *receiver, const char *member);
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index f3fe500d26..26a8fcc92d 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -138,9 +138,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
void QProgressDialogPrivate::layout()
{
Q_Q(QProgressDialog);
- int sp = q->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- int mtb = q->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin);
- int mlr = qMin(q->width() / 10, mtb);
+ int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q);
+ int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q);
+ int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q));
+ int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q));
const bool centered =
bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q));
@@ -154,12 +155,12 @@ void QProgressDialogPrivate::layout()
// dialog can be made very small if the user demands it so.
for (int attempt=5; attempt--;) {
cspc = cancel ? cs.height() + sp : 0;
- lh = qMax(0, q->height() - mtb - bh.height() - sp - cspc);
+ lh = qMax(0, q->height() - mb - bh.height() - sp - cspc);
if (lh < q->height()/4) {
// Getting cramped
sp /= 2;
- mtb /= 2;
+ mb /= 2;
if (cancel) {
cs.setHeight(qMax(4,cs.height()-sp-2));
}
@@ -171,14 +172,14 @@ void QProgressDialogPrivate::layout()
if (cancel) {
cancel->setGeometry(
- centered ? q->width()/2 - cs.width()/2 : q->width() - mlr - cs.width(),
- q->height() - mtb - cs.height(),
+ centered ? q->width()/2 - cs.width()/2 : q->width() - mr - cs.width(),
+ q->height() - mb - cs.height(),
cs.width(), cs.height());
}
if (label)
- label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh);
- bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height());
+ label->setGeometry(ml, additionalSpacing, q->width() - ml - mr, lh);
+ bar->setGeometry(ml, lh + sp + additionalSpacing, q->width() - ml - mr, bh.height());
}
void QProgressDialogPrivate::retranslateStrings()
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 53f947354c..f3d27ff77f 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -69,10 +69,6 @@
#include "private/qdialog_p.h"
#include <qdebug.h>
-#ifdef Q_OS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
-#endif
-
#include <string.h> // for memset()
#include <algorithm>
@@ -2215,10 +2211,6 @@ QWizard::QWizard(QWidget *parent, Qt::WindowFlags flags)
{
Q_D(QWizard);
d->init();
-#ifdef Q_OS_WINCE
- if (!qt_wince_is_mobile())
- setWindowFlags(windowFlags() & ~Qt::WindowOkButtonHint);
-#endif
}
/*!
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 8bc5ba7f56..9d8e7c4b66 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -41,7 +41,6 @@
#ifndef QT_NO_STYLE_WINDOWSVISTA
#include "qwizard_win_p.h"
-#include <private/qsystemlibrary_p.h>
#include <private/qapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
#include "qwizard.h"
@@ -54,112 +53,19 @@
#include <QtWidgets/QDesktopWidget>
#include <uxtheme.h>
+#include <vssym32.h>
+#include <dwmapi.h>
Q_DECLARE_METATYPE(QMargins)
-QT_BEGIN_NAMESPACE
+#ifndef WM_DWMCOMPOSITIONCHANGED
+# define WM_DWMCOMPOSITIONCHANGED 0x031E
+#endif
-//DWM related
-typedef struct { //MARGINS
- int cxLeftWidth; // width of left border that retains its size
- int cxRightWidth; // width of right border that retains its size
- int cyTopHeight; // height of top border that retains its size
- int cyBottomHeight; // height of bottom border that retains its size
-} WIZ_MARGINS;
-typedef struct { //DTTOPTS
- DWORD dwSize;
- DWORD dwFlags;
- COLORREF crText;
- COLORREF crBorder;
- COLORREF crShadow;
- int eTextShadowType;
- POINT ptShadowOffset;
- int iBorderSize;
- int iFontPropId;
- int iColorPropId;
- int iStateId;
- BOOL fApplyOverlay;
- int iGlowSize;
-} WIZ_DTTOPTS;
-
-typedef struct {
- DWORD dwFlags;
- DWORD dwMask;
-} WIZ_WTA_OPTIONS;
-
-#define WIZ_WM_THEMECHANGED 0x031A
-#define WIZ_WM_DWMCOMPOSITIONCHANGED 0x031E
-
-enum WIZ_WINDOWTHEMEATTRIBUTETYPE {
- WIZ_WTA_NONCLIENT = 1
-};
-
-#define WIZ_WTNCA_NODRAWCAPTION 0x00000001
-#define WIZ_WTNCA_NODRAWICON 0x00000002
-
-#define WIZ_DT_CENTER 0x00000001 //DT_CENTER
-#define WIZ_DT_VCENTER 0x00000004
-#define WIZ_DT_SINGLELINE 0x00000020
-#define WIZ_DT_NOPREFIX 0x00000800
-
-enum WIZ_NAVIGATIONPARTS { //NAVIGATIONPARTS
- WIZ_NAV_BACKBUTTON = 1,
- WIZ_NAV_FORWARDBUTTON = 2,
- WIZ_NAV_MENUBUTTON = 3,
-};
-
-enum WIZ_NAV_BACKBUTTONSTATES { //NAV_BACKBUTTONSTATES
- WIZ_NAV_BB_NORMAL = 1,
- WIZ_NAV_BB_HOT = 2,
- WIZ_NAV_BB_PRESSED = 3,
- WIZ_NAV_BB_DISABLED = 4,
-};
-
-#define WIZ_TMT_CAPTIONFONT (801) //TMT_CAPTIONFONT
-#define WIZ_DTT_COMPOSITED (1UL << 13) //DTT_COMPOSITED
-#define WIZ_DTT_GLOWSIZE (1UL << 11) //DTT_GLOWSIZE
-
-#define WIZ_WM_NCMOUSELEAVE 674 //WM_NCMOUSELEAVE
-
-#define WIZ_WP_CAPTION 1 //WP_CAPTION
-#define WIZ_CS_ACTIVE 1 //CS_ACTIVE
-#define WIZ_TMT_FILLCOLORHINT 3821 //TMT_FILLCOLORHINT
-#define WIZ_TMT_BORDERCOLORHINT 3822 //TMT_BORDERCOLORHINT
-
-typedef BOOL (WINAPI *PtrDwmDefWindowProc)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult);
-typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled);
-typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const WIZ_MARGINS* pMarInset);
-typedef HRESULT (WINAPI *PtrSetWindowThemeAttribute)(HWND hwnd, enum WIZ_WINDOWTHEMEATTRIBUTETYPE eAttribute, PVOID pvAttribute, DWORD cbAttribute);
-
-static PtrDwmDefWindowProc pDwmDefWindowProc = 0;
-static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled = 0;
-static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0;
-static PtrSetWindowThemeAttribute pSetWindowThemeAttribute = 0;
-
-//Theme related
-typedef bool (WINAPI *PtrIsAppThemed)();
-typedef bool (WINAPI *PtrIsThemeActive)();
-typedef HANDLE (WINAPI *PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
-typedef HRESULT (WINAPI *PtrCloseThemeData)(HANDLE hTheme);
-typedef HRESULT (WINAPI *PtrGetThemeSysFont)(HANDLE hTheme, int iFontId, LOGFONTW *plf);
-typedef HRESULT (WINAPI *PtrDrawThemeTextEx)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT pRect, const WIZ_DTTOPTS *pOptions);
-typedef HRESULT (WINAPI *PtrDrawThemeBackground)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
-typedef HRESULT (WINAPI *PtrGetThemePartSize)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz);
-typedef HRESULT (WINAPI *PtrGetThemeColor)(HANDLE hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor);
-
-static PtrIsAppThemed pIsAppThemed = 0;
-static PtrIsThemeActive pIsThemeActive = 0;
-static PtrOpenThemeData pOpenThemeData = 0;
-static PtrCloseThemeData pCloseThemeData = 0;
-static PtrGetThemeSysFont pGetThemeSysFont = 0;
-static PtrDrawThemeTextEx pDrawThemeTextEx = 0;
-static PtrDrawThemeBackground pDrawThemeBackground = 0;
-static PtrGetThemePartSize pGetThemePartSize = 0;
-static PtrGetThemeColor pGetThemeColor = 0;
+QT_BEGIN_NAMESPACE
int QVistaHelper::instanceCount = 0;
int QVistaHelper::m_devicePixelRatio = 1;
-bool QVistaHelper::is_vista = false;
QVistaHelper::VistaState QVistaHelper::cachedVistaState = QVistaHelper::Dirty;
/******************************************************************************
@@ -179,14 +85,6 @@ QSize QVistaBackButton::sizeHint() const
ensurePolished();
int size = int(QStyleHelper::dpiScaled(32));
int width = size, height = size;
-/*
- HANDLE theme = pOpenThemeData(0, L"Navigation");
- SIZE size;
- if (pGetThemePartSize(theme, 0, WIZ_NAV_BACKBUTTON, WIZ_NAV_BB_NORMAL, 0, TS_TRUE, &size) == S_OK) {
- width = size.cx;
- height = size.cy;
- }
-*/
return QSize(width, height);
}
@@ -208,7 +106,7 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
{
QPainter p(this);
QRect r = rect();
- HANDLE theme = pOpenThemeData(0, L"Navigation");
+ const HANDLE theme = OpenThemeData(0, L"Navigation");
//RECT rect;
QPoint origin;
const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin);
@@ -225,19 +123,17 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
clipRect.left = rDp.left() + xoffsetDp;
clipRect.right = rDp.right() + xoffsetDp;
- int state = WIZ_NAV_BB_NORMAL;
+ int state = NAV_BB_NORMAL;
if (!isEnabled())
- state = WIZ_NAV_BB_DISABLED;
+ state = NAV_BB_DISABLED;
else if (isDown())
- state = WIZ_NAV_BB_PRESSED;
+ state = NAV_BB_PRESSED;
else if (underMouse())
- state = WIZ_NAV_BB_HOT;
-
- WIZ_NAVIGATIONPARTS buttonType = (layoutDirection() == Qt::LeftToRight
- ? WIZ_NAV_BACKBUTTON
- : WIZ_NAV_FORWARDBUTTON);
+ state = NAV_BB_HOT;
- pDrawThemeBackground(theme, hdc, buttonType, state, &clipRect, &clipRect);
+ DrawThemeBackground(theme, hdc,
+ layoutDirection() == Qt::LeftToRight ? NAV_BACKBUTTON : NAV_FORWARDBUTTON,
+ state, &clipRect, &clipRect);
}
/******************************************************************************
@@ -251,13 +147,10 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
, backButton_(0)
{
QVistaHelper::m_devicePixelRatio = wizard->devicePixelRatio();
- is_vista = resolveSymbols();
if (instanceCount++ == 0)
cachedVistaState = Dirty;
- if (is_vista) {
- backButton_ = new QVistaBackButton(wizard);
- backButton_->hide();
- }
+ backButton_ = new QVistaBackButton(wizard);
+ backButton_->hide();
// Handle diff between Windows 7 and Vista
iconSpacing = QStyleHelper::dpiScaled(7);
@@ -292,20 +185,13 @@ void QVistaHelper::updateCustomMargins(bool vistaMargins)
bool QVistaHelper::isCompositionEnabled()
{
- bool value = is_vista;
- if (is_vista) {
- HRESULT hr;
- BOOL bEnabled;
-
- hr = pDwmIsCompositionEnabled(&bEnabled);
- value = (SUCCEEDED(hr) && bEnabled);
- }
- return value;
+ BOOL bEnabled;
+ return SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && bEnabled;
}
bool QVistaHelper::isThemeActive()
{
- return is_vista && pIsThemeActive();
+ return IsThemeActive();
}
QVistaHelper::VistaState QVistaHelper::vistaState()
@@ -326,11 +212,9 @@ QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
- HANDLE hTheme = pOpenThemeData(handle, L"WINDOW");
- pGetThemeColor(
- hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE,
- wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT,
- &rgb);
+ const HANDLE hTheme = OpenThemeData(handle, L"WINDOW");
+ GetThemeColor(hTheme, WP_CAPTION, CS_ACTIVE,
+ wizard->isActiveWindow() ? TMT_FILLCOLORHINT : TMT_BORDERCOLORHINT, &rgb);
BYTE r = GetRValue(rgb);
BYTE g = GetGValue(rgb);
BYTE b = GetBValue(rgb);
@@ -341,13 +225,13 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
{
bool value = false;
if (vistaState() == VistaAero) {
- WIZ_MARGINS mar = {0, 0, 0, 0};
+ MARGINS mar = {0, 0, 0, 0};
if (type == NormalTitleBar)
mar.cyTopHeight = 0;
else
mar.cyTopHeight = (titleBarSize() + topOffset()) * QVistaHelper::m_devicePixelRatio;
if (const HWND wizardHandle = wizardHWND())
- if (SUCCEEDED(pDwmExtendFrameIntoClientArea(wizardHandle, &mar)))
+ if (SUCCEEDED(DwmExtendFrameIntoClientArea(wizardHandle, &mar)))
value = true;
}
return value;
@@ -359,7 +243,7 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme)
{
LOGFONT result = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } };
- if (!hTheme || FAILED(pGetThemeSysFont(hTheme, WIZ_TMT_CAPTIONFONT, &result))) {
+ if (!hTheme || FAILED(GetThemeSysFont(hTheme, TMT_CAPTIONFONT, &result))) {
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false);
@@ -370,10 +254,8 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme)
static bool getCaptionQFont(int dpi, QFont *result)
{
- if (!pOpenThemeData)
- return false;
const HANDLE hTheme =
- pOpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW");
+ OpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW");
if (!hTheme)
return false;
// Call into QWindowsNativeInterface to convert the LOGFONT into a QFont.
@@ -448,16 +330,14 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
{
- if (is_vista) {
- WIZ_WTA_OPTIONS opt;
- opt.dwFlags = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
- if (visible)
- opt.dwMask = 0;
- else
- opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
- if (const HWND handle = wizardHWND())
- pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
- }
+ WTA_OPTIONS opt;
+ opt.dwFlags = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION;
+ if (visible)
+ opt.dwMask = 0;
+ else
+ opt.dwMask = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION;
+ if (const HWND handle = wizardHWND())
+ SetWindowThemeAttribute(handle, WTA_NONCLIENT, &opt, sizeof(WTA_OPTIONS));
}
bool QVistaHelper::winEvent(MSG* msg, long* result)
@@ -466,7 +346,7 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
case WM_NCHITTEST: {
LRESULT lResult;
// Perform hit testing using DWM
- if (pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) {
+ if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) {
// DWM returned a hit, no further processing necessary
*result = lResult;
} else {
@@ -485,7 +365,7 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
default:
LRESULT lResult;
// Pass to DWM to handle
- if (pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult))
+ if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult))
*result = lResult;
// If the message wasn't handled by DWM, continue processing it as normal
else
@@ -524,7 +404,7 @@ void QVistaHelper::mouseEvent(QEvent *event)
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
{
- if (message->message == WIZ_WM_THEMECHANGED || message->message == WIZ_WM_DWMCOMPOSITIONCHANGED)
+ if (message->message == WM_THEMECHANGED || message->message == WM_DWMCOMPOSITIONCHANGED)
cachedVistaState = Dirty;
bool status = false;
@@ -707,7 +587,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio,
rect.size() * QVistaHelper::m_devicePixelRatio);
HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop());
- HANDLE hTheme = pOpenThemeData(handle, L"WINDOW");
+ const HANDLE hTheme = OpenThemeData(handle, L"WINDOW");
if (!hTheme) return false;
// Set up a memory DC and bitmap that we'll draw into
HDC dcMem;
@@ -732,15 +612,16 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
// Draw the text!
- WIZ_DTTOPTS dto;
- dto.dwSize = sizeof(WIZ_DTTOPTS);
- const UINT uFormat = WIZ_DT_SINGLELINE|WIZ_DT_CENTER|WIZ_DT_VCENTER|WIZ_DT_NOPREFIX;
+ DTTOPTS dto;
+ memset(&dto, 0, sizeof(dto));
+ dto.dwSize = sizeof(dto);
+ const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX;
RECT rctext ={0,0, rectDp.width(), rectDp.height()};
- dto.dwFlags = WIZ_DTT_COMPOSITED|WIZ_DTT_GLOWSIZE;
+ dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE;
dto.iGlowSize = glowSize();
- pDrawThemeTextEx(hTheme, dcMem, 0, 0, (LPCWSTR)text.utf16(), -1, uFormat, &rctext, &dto );
+ DrawThemeTextEx(hTheme, dcMem, 0, 0, reinterpret_cast<LPCWSTR>(text.utf16()), -1, uFormat, &rctext, &dto );
BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY);
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
SelectObject(dcMem, (HGDIOBJ) hOldFont);
@@ -813,51 +694,6 @@ int QVistaHelper::captionSizeDp()
return GetSystemMetrics(SM_CYCAPTION);
}
-bool QVistaHelper::resolveSymbols()
-{
- static bool tried = false;
- if (!tried) {
- tried = true;
- QSystemLibrary dwmLib(L"dwmapi");
- pDwmIsCompositionEnabled =
- (PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
- if (pDwmIsCompositionEnabled) {
- pDwmDefWindowProc = (PtrDwmDefWindowProc)dwmLib.resolve("DwmDefWindowProc");
- pDwmExtendFrameIntoClientArea =
- (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
- }
- QSystemLibrary themeLib(L"uxtheme");
- pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
- if (pIsAppThemed) {
- pDrawThemeBackground = (PtrDrawThemeBackground)themeLib.resolve("DrawThemeBackground");
- pGetThemePartSize = (PtrGetThemePartSize)themeLib.resolve("GetThemePartSize");
- pGetThemeColor = (PtrGetThemeColor)themeLib.resolve("GetThemeColor");
- pIsThemeActive = (PtrIsThemeActive)themeLib.resolve("IsThemeActive");
- pOpenThemeData = (PtrOpenThemeData)themeLib.resolve("OpenThemeData");
- pCloseThemeData = (PtrCloseThemeData)themeLib.resolve("CloseThemeData");
- pGetThemeSysFont = (PtrGetThemeSysFont)themeLib.resolve("GetThemeSysFont");
- pDrawThemeTextEx = (PtrDrawThemeTextEx)themeLib.resolve("DrawThemeTextEx");
- pSetWindowThemeAttribute = (PtrSetWindowThemeAttribute)themeLib.resolve("SetWindowThemeAttribute");
- }
- }
-
- return (
- pDwmIsCompositionEnabled != 0
- && pDwmDefWindowProc != 0
- && pDwmExtendFrameIntoClientArea != 0
- && pIsAppThemed != 0
- && pDrawThemeBackground != 0
- && pGetThemePartSize != 0
- && pGetThemeColor != 0
- && pIsThemeActive != 0
- && pOpenThemeData != 0
- && pCloseThemeData != 0
- && pGetThemeSysFont != 0
- && pDrawThemeTextEx != 0
- && pSetWindowThemeAttribute != 0
- );
-}
-
int QVistaHelper::titleOffset()
{
int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index 42b4dee784..c0aa6f7bc4 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -126,7 +126,6 @@ private:
int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; }
int titleOffset();
- bool resolveSymbols();
void drawTitleBar(QPainter *painter);
void setMouseCursor(QPoint pos);
void collapseTopFrameStrut();
@@ -137,7 +136,6 @@ private:
bool eventFilter(QObject *obj, QEvent *event);
static int instanceCount;
- static bool is_vista;
static VistaState cachedVistaState;
static bool isCompositionEnabled();
static bool isThemeActive();
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
index c39a0d83bb..a907a0421f 100644
--- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
@@ -77,6 +77,7 @@ QApplication::setStyle(QStyleFactory::create("Fusion"));
//! [1]
+// ### fixme: Qt 6: Remove [2]
//! [2]
int main(int argc, char *argv[])
{
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index db683a4e4d..b00a950823 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1439,9 +1439,8 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con
// Determine the item's exposed area
option->exposedRect = QRectF();
const QTransform reverseMap = worldTransform.inverted();
- const QVector<QRect> exposedRects(exposedRegion.rects());
- for (int i = 0; i < exposedRects.size(); ++i) {
- option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i)));
+ for (const QRect &exposedRect : exposedRegion) {
+ option->exposedRect |= reverseMap.mapRect(QRectF(exposedRect));
if (option->exposedRect.contains(brect))
break;
}
@@ -5350,8 +5349,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c
QTransform unscale = QTransform::fromScale(1 / granularity, 1 / granularity);
QRegion r;
QBitmap colorMask = QBitmap::fromImage(mask.createMaskFromColor(0));
- const auto rects = QRegion(colorMask).rects();
- for (const QRect &rect : rects) {
+ for (const QRect &rect : QRegion(colorMask)) {
QRect xrect = unscale.mapRect(rect).translated(deviceRect.topLeft() - QPoint(pad, pad));
r += xrect.adjusted(-1, -1, 1, 1) & deviceRect;
}
@@ -5915,9 +5913,8 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect)
// Append newly exposed areas. Note that the exposed region is currently
// in pixmap coordinates, so we have to translate it to item coordinates.
exposed.translate(cache->boundingRect.topLeft());
- const QVector<QRect> exposedRects = exposed.rects();
- for (int i = 0; i < exposedRects.size(); ++i)
- cache->exposed += exposedRects.at(i);
+ for (const QRect &exposedRect : exposed)
+ cache->exposed += exposedRect;
// Trigger update. This will redraw the newly exposed area and make sure
// the pixmap is re-blitted in case there are overlapping items.
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index cb1d1e68d1..da5c2849ae 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -4657,8 +4657,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
for (int i = 0; i < exposed.size(); ++i)
br |= exposed.at(i);
QTransform pixmapToItem = itemToPixmap.inverted();
- const auto rects = scrollExposure.rects();
- for (const QRect &r : rects)
+ for (const QRect &r : scrollExposure)
br |= pixmapToItem.mapRect(r);
}
styleOptionTmp = *option;
@@ -5431,12 +5430,14 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
return true;
}
if (d->activePanel->isWidget()) {
- QGraphicsWidget *fw = static_cast<QGraphicsWidget *>(d->activePanel)->d_func()->focusNext;
+ QGraphicsWidget *test = static_cast<QGraphicsWidget *>(d->activePanel);
+ QGraphicsWidget *fw = next ? test->d_func()->focusNext : test->d_func()->focusPrev;
do {
if (fw->focusPolicy() & Qt::TabFocus) {
setFocusItem(fw, next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
return true;
}
+ fw = next ? fw->d_func()->focusNext : fw->d_func()->focusPrev;
} while (fw != d->activePanel);
}
}
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index fc5dbdd80a..44e80ebeb9 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -1029,9 +1029,7 @@ bool QGraphicsViewPrivate::updateRegion(const QRectF &rect, const QTransform &xf
if (!intersectsViewport(viewRect, viewport->width(), viewport->height()))
return false; // Update region for sure outside viewport.
- const QVector<QRect> &rects = region.rects();
- for (int i = 0; i < rects.size(); ++i) {
- viewRect = rects.at(i);
+ for (QRect viewRect : region) {
if (dontAdjustForAntialiasing)
viewRect.adjust(-1, -1, 1, 1);
else
@@ -1146,8 +1144,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
// the expose region, convert it to a path, and then search for items
// using QGraphicsScene::items(QPainterPath);
QRegion adjustedRegion;
- const auto rects = exposedRegion.rects();
- for (const QRect &r : rects)
+ for (const QRect &r : exposedRegion)
adjustedRegion += r.adjusted(-1, -1, 1, 1);
const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion)));
@@ -2676,11 +2673,9 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects)
// Extract and reset dirty scene rect info.
QVector<QRect> dirtyViewportRects;
- const QVector<QRect> &dirtyRects = d->dirtyRegion.rects();
- const int dirtyRectsCount = dirtyRects.size();
- dirtyViewportRects.reserve(dirtyRectsCount + rects.count());
- for (int i = 0; i < dirtyRectsCount; ++i)
- dirtyViewportRects += dirtyRects.at(i);
+ dirtyViewportRects.reserve(d->dirtyRegion.rectCount() + rects.count());
+ for (const QRect &dirtyRect : d->dirtyRegion)
+ dirtyViewportRects += dirtyRect;
d->dirtyRegion = QRegion();
d->dirtyBoundingRect = QRect();
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 26dd49f8cf..42e0cc7585 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -340,8 +340,8 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged()
This enum indicates how the view responds to user selections:
\value SingleSelection When the user selects an item, any already-selected
- item becomes unselected, and the user cannot unselect the selected item by
- clicking on it.
+ item becomes unselected. It is possible for the user to deselect the selected
+ item.
\value ContiguousSelection When the user selects an item in the usual way,
the selection is cleared and the new item selected. However, if the user
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index dfb1d7619e..315d2503a4 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -858,7 +858,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
return QModelIndex();
QString absolutePath = QDir(path).absolutePath();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
absolutePath = absolutePath.toLower();
// On Windows, "filename......." and "filename" are equivalent
if (absolutePath.endsWith(QLatin1Char('.'))) {
@@ -873,7 +873,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
if ((pathElements.isEmpty() || !QFileInfo::exists(path))
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN)
&& path != QLatin1String("/")
#endif
)
@@ -883,7 +883,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
if (!d->root.populated) // make sure the root is populated
d->populate(&d->root);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
QString host = pathElements.first();
int r = 0;
@@ -901,7 +901,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
emit const_cast<QDirModel*>(this)->layoutChanged();
} else
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (pathElements.at(0).endsWith(QLatin1Char(':'))) {
pathElements[0] += QLatin1Char('/');
}
@@ -925,7 +925,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
const QFileInfo& fi = parent->children.at(j).info;
QString childFileName;
childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
childFileName = childFileName.toLower();
#endif
if (childFileName == element) {
@@ -938,15 +938,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
// we couldn't find the path element, we create a new node since we _know_ that the path is valid
if (row == -1) {
-#if defined(Q_OS_WINCE)
- QString newPath;
- if (parent->info.isRoot())
- newPath = parent->info.absoluteFilePath() + element;
- else
- newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element;
-#else
QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element;
-#endif
if (!d->allowAppendChild || !QFileInfo(newPath).isDir())
return QModelIndex();
d->appendChild(parent, newPath);
@@ -1290,7 +1282,7 @@ QString QDirModelPrivate::name(const QModelIndex &index) const
const QFileInfo info = n->info;
if (info.isRoot()) {
QString name = info.absoluteFilePath();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (name.startsWith(QLatin1Char('/'))) // UNC host
return info.fileName();
if (name.endsWith(QLatin1Char('/')))
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index 66c0ffcd58..78ff5f79ab 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -365,7 +365,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const
return retIcon;
if (info.isRoot())
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
{
UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16());
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index eebd0de9bb..c7cc1d155e 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1398,8 +1398,7 @@ void QTableView::paintEvent(QPaintEvent *event)
firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn);
}
- const QVector<QRect> rects = region.rects();
- for (auto dirtyArea : rects) {
+ for (QRect dirtyArea : region) {
dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y)));
if (rightToLeft) {
dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x)));
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index d2e1a10566..1e7ca803d6 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1477,13 +1477,12 @@ void QTreeView::drawTree(QPainter *painter, const QRegion &region) const
QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos());
d->hoverBranch = d->itemDecorationAt(hoverPos);
- QVector<QRect> rects = region.rects();
QVector<int> drawn;
- bool multipleRects = (rects.size() > 1);
- for (int a = 0; a < rects.size(); ++a) {
+ bool multipleRects = (region.rectCount() > 1);
+ for (const QRect &a : region) {
const QRect area = (multipleRects
- ? QRect(0, rects.at(a).y(), viewportWidth, rects.at(a).height())
- : rects.at(a));
+ ? QRect(0, a.y(), viewportWidth, a.height())
+ : a);
d->leftAndRight = d->startAndEndColumns(area);
int i = firstVisibleItem; // the first item at the top of the viewport
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 718ecffcc9..88b29e9147 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -279,12 +279,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
group the action will be automatically inserted into the group.
*/
QAction::QAction(QObject* parent)
- : QObject(*(new QActionPrivate), parent)
+ : QAction(*new QActionPrivate, parent)
{
- Q_D(QAction);
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
}
@@ -302,13 +298,10 @@ QAction::QAction(QObject* parent)
*/
QAction::QAction(const QString &text, QObject* parent)
- : QObject(*(new QActionPrivate), parent)
+ : QAction(parent)
{
Q_D(QAction);
d->text = text;
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
}
/*!
@@ -324,14 +317,10 @@ QAction::QAction(const QString &text, QObject* parent)
setToolTip().
*/
QAction::QAction(const QIcon &icon, const QString &text, QObject* parent)
- : QObject(*(new QActionPrivate), parent)
+ : QAction(text, parent)
{
Q_D(QAction);
d->icon = icon;
- d->text = text;
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
}
/*!
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 86b3282124..5007969c96 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -101,23 +101,13 @@
#include "qdatetime.h"
-#ifdef Q_OS_WINCE
-extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp
-extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp
-extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
-#endif
-
#include <qpa/qplatformwindow.h>
//#define ALIEN_DEBUG
static void initResources()
{
-#if defined(Q_OS_WINCE)
- Q_INIT_RESOURCE(qstyle_wince);
-#else
Q_INIT_RESOURCE(qstyle);
-#endif
Q_INIT_RESOURCE(qmessagebox);
}
@@ -171,12 +161,7 @@ static QByteArray nativeStyleClassName()
return name;
}
-#ifdef Q_OS_WINCE
-int QApplicationPrivate::autoMaximizeThreshold = -1;
-bool QApplicationPrivate::autoSipEnabled = false;
-#else
bool QApplicationPrivate::autoSipEnabled = true;
-#endif
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
: QApplicationPrivateBase(argc, argv, flags)
@@ -352,8 +337,10 @@ void QApplicationPrivate::createEventDispatcher()
\sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings
*/
+// ### fixme: Qt 6: Remove ColorSpec and accessors.
/*!
\enum QApplication::ColorSpec
+ \obsolete
\value NormalColor the default color allocation policy
\value CustomColor the same as NormalColor for X11; allocates colors
@@ -410,8 +397,6 @@ QString QApplicationPrivate::styleSheet; // default application styles
#endif
QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
-int QApplicationPrivate::app_cspec = QApplication::NormalColor;
-
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
@@ -657,17 +642,6 @@ void QApplicationPrivate::initialize()
if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0)
QCoreApplication::setAttribute(Qt::AA_NativeWindows);
-#ifdef Q_OS_WINCE
-#ifdef QT_AUTO_MAXIMIZE_THRESHOLD
- autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD;
-#else
- if (qt_wince_is_mobile())
- autoMaximizeThreshold = 50;
- else
- autoMaximizeThreshold = -1;
-#endif //QT_AUTO_MAXIMIZE_THRESHOLD
-#endif //Q_OS_WINCE
-
#ifndef QT_NO_WHEELEVENT
QApplicationPrivate::wheel_scroll_lines = 3;
#endif
@@ -1061,19 +1035,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
The default is platform dependent.
*/
-
-#ifdef Q_OS_WINCE
-void QApplication::setAutoMaximizeThreshold(const int threshold)
-{
- QApplicationPrivate::autoMaximizeThreshold = threshold;
-}
-
-int QApplication::autoMaximizeThreshold() const
-{
- return QApplicationPrivate::autoMaximizeThreshold;
-}
-#endif
-
void QApplication::setAutoSipEnabled(const bool enabled)
{
QApplicationPrivate::autoSipEnabled = enabled;
@@ -1314,17 +1275,21 @@ QStyle* QApplication::setStyle(const QString& style)
/*!
Returns the color specification.
+ \obsolete
\sa QApplication::setColorSpec()
*/
int QApplication::colorSpec()
{
- return QApplicationPrivate::app_cspec;
+ return QApplication::NormalColor;
}
/*!
Sets the color specification for the application to \a spec.
+ \obsolete
+
+ This call has no effect.
The color specification controls how the application allocates colors when
run on a display with a limited amount of colors, e.g. 8 bit / 256 color
@@ -1380,10 +1345,7 @@ int QApplication::colorSpec()
void QApplication::setColorSpec(int spec)
{
- if (Q_UNLIKELY(qApp))
- qWarning("QApplication::setColorSpec: This function must be "
- "called before the QApplication object is created");
- QApplicationPrivate::app_cspec = spec;
+ Q_UNUSED(spec)
}
/*!
@@ -3777,7 +3739,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
if (receiver->isWidgetType()) {
QWidget *widget = static_cast<QWidget *>(receiver);
-#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
+#if !defined(QT_NO_CURSOR)
// toggle HasMouse widget state on enter and leave
if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) &&
(!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window()))
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index b27fba620e..52f44759f4 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -84,9 +84,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication
#ifndef QT_NO_STYLE_STYLESHEET
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
#endif
-#ifdef Q_OS_WINCE
- Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold)
-#endif
Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
public:
@@ -101,8 +98,10 @@ public:
static void setStyle(QStyle*);
static QStyle *setStyle(const QString&);
enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
- static int colorSpec();
- static void setColorSpec(int);
+#if QT_DEPRECATED_SINCE(5, 8)
+ QT_DEPRECATED static int colorSpec();
+ QT_DEPRECATED static void setColorSpec(int);
+#endif // QT_DEPRECATED_SINCE(5, 8)
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {}
#endif
@@ -195,10 +194,6 @@ public Q_SLOTS:
#ifndef QT_NO_STYLE_STYLESHEET
void setStyleSheet(const QString& sheet);
#endif
-#ifdef Q_OS_WINCE
- void setAutoMaximizeThreshold(const int threshold);
- int autoMaximizeThreshold() const;
-#endif
void setAutoSipEnabled(const bool enabled);
bool autoSipEnabled() const;
static void closeAllWindows();
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 3358cce744..8aab3bfae4 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -90,11 +90,8 @@ extern Q_GUI_EXPORT bool qt_is_gui_used;
extern QClipboard *qt_clipboard;
#endif
-#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE)
+#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN)
extern QSysInfo::WinVersion qt_winver;
-# ifdef Q_OS_WINCE
- extern DWORD qt_cever;
-# endif
#elif defined (Q_OS_MAC)
extern QSysInfo::MacVersion qt_macver;
#endif
@@ -126,9 +123,6 @@ public:
#endif
static void reset_instance_pointer();
#endif
-#ifdef Q_OS_WINCE
- static int autoMaximizeThreshold;
-#endif
static bool autoSipEnabled;
static QString desktopStyleKey();
@@ -189,7 +183,6 @@ public:
static QWidgetList *popupWidgets;
static QStyle *app_style;
static bool overrides_native_style;
- static int app_cspec;
static QPalette *sys_pal;
static QPalette *set_pal;
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 9b346a2c50..ce5e58642c 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -185,6 +185,7 @@ public:
int insertRow(int row);
void insertRows(int row, int count);
+ void removeRow(int row);
void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item);
void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout);
void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget);
@@ -947,6 +948,12 @@ void QFormLayoutPrivate::insertRows(int row, int count)
}
}
+void QFormLayoutPrivate::removeRow(int row)
+{
+ if (uint(row) < uint(m_matrix.rowCount()))
+ m_matrix.removeRow(row);
+}
+
void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item)
{
const bool fullRow = role == QFormLayout::SpanningRole;
@@ -1178,6 +1185,28 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
*/
/*!
+ \since 5.8
+
+ \struct QFormLayout::TakeRowResult
+
+ \brief Contains the result of a QFormLayout::takeRow() call.
+
+ \sa QFormLayout::takeRow()
+*/
+
+/*!
+ \variable QFormLayout::TakeRowResult::labelItem
+
+ Contains the layout item corresponding to the label of the row.
+*/
+
+/*!
+ \variable QFormLayout::TakeRowResult::fieldItem
+
+ Contains the layout item corresponding to the field of the row.
+*/
+
+/*!
Constructs a new form layout with the given \a parent widget.
\sa QWidget::setLayout()
@@ -1380,6 +1409,287 @@ void QFormLayout::insertRow(int row, QLayout *layout)
invalidate();
}
+static QLayoutItem *ownershipCleanedItem(QFormLayoutItem *item, QFormLayout *layout)
+{
+ if (!item)
+ return nullptr;
+
+ // grab ownership back from the QFormLayoutItem
+ QLayoutItem *i = item->item;
+ item->item = nullptr;
+ delete item;
+
+ if (QLayout *l = i->layout()) {
+ // sanity check in case the user passed something weird to QObject::setParent()
+ if (l->parent() == layout)
+ l->setParent(nullptr);
+ }
+
+ return i;
+}
+
+static void clearQLayoutItem(QLayoutItem *item)
+{
+ if (Q_LIKELY(item)) {
+ if (QLayout *layout = item->layout()) {
+ while (QLayoutItem *child = layout->takeAt(0)) {
+ clearQLayoutItem(child);
+ delete child;
+ }
+ delete layout;
+ }
+ delete item->widget();
+ delete item->spacerItem();
+ }
+}
+
+/*!
+ \since 5.8
+
+ Deletes row \a row from this form layout.
+
+ \a row must be non-negative and less than rowCount().
+
+ After this call, rowCount() is decremented by one. All widgets and
+ nested layouts that occupied this row are deleted. That includes both
+ the field widget(s) and the label, if any. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ flay->removeRow(2); // le == nullptr at this point
+ \endcode
+
+ If you want to remove the row from the layout without deleting the widgets, use takeRow() instead.
+
+ \sa takeRow()
+*/
+void QFormLayout::removeRow(int row)
+{
+ TakeRowResult result = takeRow(row);
+ clearQLayoutItem(result.labelItem);
+ clearQLayoutItem(result.fieldItem);
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Deletes the row corresponding to \a widget from this form layout.
+
+ After this call, rowCount() is decremented by one. All widgets and
+ nested layouts that occupied this row are deleted. That includes both
+ the field widget(s) and the label, if any. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ flay->removeRow(le); // le == nullptr at this point
+ \endcode
+
+ If you want to remove the row from the layout without deleting the widgets, use takeRow() instead.
+
+ \sa takeRow()
+*/
+void QFormLayout::removeRow(QWidget *widget)
+{
+ TakeRowResult result = takeRow(widget);
+ clearQLayoutItem(result.labelItem);
+ clearQLayoutItem(result.fieldItem);
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Deletes the row corresponding to \a layout from this form layout.
+
+ After this call, rowCount() is decremented by one. All widgets and
+ nested layouts that occupied this row are deleted. That includes both
+ the field widget(s) and the label, if any. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QVBoxLayout> vbl = new QVBoxLayout;
+ flay->insertRow(2, "User:", vbl);
+ // later:
+ flay->removeRow(layout); // vbl == nullptr at this point
+ \endcode
+
+ If you want to remove the row from the form layout without deleting the inserted layout,
+ use takeRow() instead.
+
+ \sa takeRow()
+*/
+void QFormLayout::removeRow(QLayout *layout)
+{
+ TakeRowResult result = takeRow(layout);
+ clearQLayoutItem(result.labelItem);
+ clearQLayoutItem(result.fieldItem);
+}
+
+/*!
+ \since 5.8
+
+ Removes the specified \a row from this form layout.
+
+ \a row must be non-negative and less than rowCount().
+
+ \note This function doesn't delete anything.
+
+ After this call, rowCount() is decremented by one. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ You can use this function to undo a previous addRow() or insertRow():
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ QFormLayout::TakeRowResult result = flay->takeRow(2);
+ \endcode
+
+ If you want to remove the row from the layout and delete the widgets, use removeRow() instead.
+
+ \return A structure containing both the widget and
+ corresponding label layout items
+
+ \sa removeRow()
+*/
+QFormLayout::TakeRowResult QFormLayout::takeRow(int row)
+{
+ Q_D(QFormLayout);
+
+ const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(row));
+ if (Q_UNLIKELY(storageIndex == -1)) {
+ qWarning("QFormLayout::takeRow: Invalid row %d", row);
+ return TakeRowResult();
+ }
+
+ int storageRow, dummy;
+ QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &storageRow, &dummy);
+ Q_ASSERT(d->m_matrix(storageRow, dummy));
+
+ QFormLayoutItem *label = d->m_matrix(storageRow, 0);
+ QFormLayoutItem *field = d->m_matrix(storageRow, 1);
+
+ Q_ASSERT(field);
+
+ d->m_things.removeOne(label);
+ d->m_things.removeOne(field);
+ d->m_matrix.removeRow(storageRow);
+
+ invalidate();
+
+ TakeRowResult result;
+ result.labelItem = ownershipCleanedItem(label, this);
+ result.fieldItem = ownershipCleanedItem(field, this);
+ return result;
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Removes the specified \a widget from this form layout.
+
+ \note This function doesn't delete anything.
+
+ After this call, rowCount() is decremented by one. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QLineEdit> le = new QLineEdit;
+ flay->insertRow(2, "User:", le);
+ // later:
+ QFormLayout::TakeRowResult result = flay->takeRow(widget);
+ \endcode
+
+ If you want to remove the row from the layout and delete the widgets, use removeRow() instead.
+
+ \return A structure containing both the widget and
+ corresponding label layout items
+
+ \sa removeRow()
+*/
+QFormLayout::TakeRowResult QFormLayout::takeRow(QWidget *widget)
+{
+ Q_D(QFormLayout);
+ if (Q_UNLIKELY(!d->checkWidget(widget)))
+ return TakeRowResult();
+
+ int row;
+ ItemRole role;
+ getWidgetPosition(widget, &row, &role);
+
+ if (Q_UNLIKELY(row < 0)) {
+ qWarning("QFormLayout::takeRow: Invalid widget");
+ return TakeRowResult();
+ }
+
+ return takeRow(row);
+}
+
+/*!
+ \since 5.8
+
+ \overload
+
+ Removes the specified \a layout from this form layout.
+
+ \note This function doesn't delete anything.
+
+ After this call, rowCount() is decremented by one. All following rows are shifted
+ up one row and the freed vertical space is redistributed amongst the remaining rows.
+
+ \code
+ QFormLayout *flay = ...;
+ QPointer<QVBoxLayout> vbl = new QVBoxLayout;
+ flay->insertRow(2, "User:", vbl);
+ // later:
+ QFormLayout::TakeRowResult result = flay->takeRow(widget);
+ \endcode
+
+ If you want to remove the row from the form layout and delete the inserted layout,
+ use removeRow() instead.
+
+ \return A structure containing both the widget and
+ corresponding label layout items
+
+ \sa removeRow()
+*/
+QFormLayout::TakeRowResult QFormLayout::takeRow(QLayout *layout)
+{
+ Q_D(QFormLayout);
+ if (Q_UNLIKELY(!d->checkLayout(layout)))
+ return TakeRowResult();
+
+ int row;
+ ItemRole role;
+ getLayoutPosition(layout, &row, &role);
+
+ if (Q_UNLIKELY(row < 0)) {
+ qWarning("QFormLayout::takeRow: Invalid layout");
+ return TakeRowResult();
+ }
+
+ return takeRow(row);
+}
+
/*!
\reimp
*/
@@ -1436,18 +1746,7 @@ QLayoutItem *QFormLayout::takeAt(int index)
invalidate();
- // grab ownership back from the QFormLayoutItem
- QLayoutItem *i = item->item;
- item->item = 0;
- delete item;
-
- if (QLayout *l = i->layout()) {
- // sanity check in case the user passed something weird to QObject::setParent()
- if (l->parent() == this)
- l->setParent(0);
- }
-
- return i;
+ return ownershipCleanedItem(item, this);
}
/*!
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index 8e4f7b7309..ca15ec6f9a 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -80,6 +80,11 @@ public:
};
Q_ENUM(ItemRole)
+ struct TakeRowResult {
+ QLayoutItem *labelItem;
+ QLayoutItem *fieldItem;
+ };
+
explicit QFormLayout(QWidget *parent = Q_NULLPTR);
~QFormLayout();
@@ -114,6 +119,14 @@ public:
void insertRow(int row, QWidget *widget);
void insertRow(int row, QLayout *layout);
+ void removeRow(int row);
+ void removeRow(QWidget *widget);
+ void removeRow(QLayout *layout);
+
+ TakeRowResult takeRow(int row);
+ TakeRowResult takeRow(QWidget *widget);
+ TakeRowResult takeRow(QLayout *layout);
+
void setItem(int row, ItemRole role, QLayoutItem *item);
void setWidget(int row, ItemRole role, QWidget *widget);
void setLayout(int row, ItemRole role, QLayout *layout);
@@ -153,6 +166,8 @@ private:
void resetFormAlignment();
};
+Q_DECLARE_TYPEINFO(QFormLayout::TakeRowResult, Q_PRIMITIVE_TYPE);
+
QT_END_NAMESPACE
#endif
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index df72c6c4d2..c901285d1a 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -75,7 +75,7 @@ static inline int panTouchPoints()
const int result = qEnvironmentVariableIntValue(panTouchPointVariable, &ok);
if (ok && result >= 1)
return result;
- qWarning() << "Ignoring invalid value of " << panTouchPointVariable;
+ qWarning("Ignoring invalid value of %s", panTouchPointVariable);
}
// Pan should use 1 finger on a touch screen and 2 fingers on touch pads etc.
// where 1 finger movements are used for mouse event synthetization. For now,
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index b58e7fdc9e..29df38f19c 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -746,9 +746,13 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain,
if (orientation == Qt::Vertical) {
QGridBox *sibling = vReversed ? previousBox : box;
if (sibling) {
- QWidget *wid = sibling->item()->widget();
- if (wid)
- spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() );
+ if (sibling->item()->isEmpty()) {
+ spacing = 0;
+ } else {
+ QWidget *wid = sibling->item()->widget();
+ if (wid)
+ spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top());
+ }
}
}
}
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 240f525722..86c1628e22 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -945,12 +945,7 @@ void QLayout::addChildWidget(QWidget *w)
void QLayout::setMenuBar(QWidget *widget)
{
Q_D(QLayout);
-
-#ifdef Q_OS_WINCE_WM
- if (widget && widget->size().height() > 0)
-#else
if (widget)
-#endif
addChildWidget(widget);
d->menubar = widget;
}
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index bf162249d0..7bd9e74924 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -456,12 +456,11 @@ QShortcut::QShortcut(QWidget *parent)
QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
const char *member, const char *ambiguousMember,
Qt::ShortcutContext context)
- : QObject(*new QShortcutPrivate, parent)
+ : QShortcut(parent)
{
QAPP_CHECK("QShortcut");
Q_D(QShortcut);
- Q_ASSERT(parent != 0);
d->sc_context = context;
d->sc_sequence = key;
d->redoGrab(qApp->d_func()->shortcutMap);
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 3544382944..6fa74b7cc6 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1108,11 +1108,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
if (customize)
; // don't modify window flags if the user explicitly set them.
else if (type == Qt::Dialog || type == Qt::Sheet)
-#ifndef Q_OS_WINCE
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
-#else
- flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
-#endif
else if (type == Qt::Tool)
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
else
@@ -2405,9 +2401,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush);
painter->restore();
} else {
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i)
- painter->fillRect(rects.at(i), brush);
+ for (const QRect &rect : rgn)
+ painter->fillRect(rect, brush);
}
}
@@ -4553,7 +4548,7 @@ const QPalette &QWidget::palette() const
if (!isEnabled()) {
data->pal.setCurrentColorGroup(QPalette::Disabled);
} else if ((!isVisible() || isActiveWindow())
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
&& !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this))
#endif
) {
@@ -8556,13 +8551,9 @@ QSize QWidgetPrivate::adjustedSize() const
#else // all others
QRect screen = QApplication::desktop()->screenGeometry(q->pos());
#endif
-#if defined (Q_OS_WINCE)
- s.setWidth(qMin(s.width(), screen.width()));
- s.setHeight(qMin(s.height(), screen.height()));
-#else
s.setWidth(qMin(s.width(), screen.width()*2/3));
s.setHeight(qMin(s.height(), screen.height()*2/3));
-#endif
+
if (QTLWExtra *extra = maybeTopData())
extra->sizeAdjusted = true;
}
@@ -9534,7 +9525,7 @@ void QWidget::focusOutEvent(QFocusEvent *)
if (focusPolicy() != Qt::NoFocus || !isWindow())
update();
-#ifndef Q_OS_IOS
+#if !defined(QT_PLATFORM_UIKIT)
// FIXME: revisit autoSIP logic, QTBUG-42906
if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled))
QGuiApplication::inputMethod()->hide();
@@ -10750,10 +10741,8 @@ void QWidget::scroll(int dx, int dy)
// Graphics View maintains its own dirty region as a list of rects;
// until we can connect item updates directly to the view, we must
// separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
- proxy->update(rect);
- }
+ for (const QRect &rect : d->dirty)
+ proxy->update(rect.translated(dx, dy));
proxy->scroll(dx, dy, proxy->subWidgetRect(this));
return;
}
@@ -10793,7 +10782,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
// until we can connect item updates directly to the view, we must
// separately add a translated dirty region.
if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
+ for (const QRect &rect : d->dirty.translated(dx, dy) & r)
proxy->update(rect);
}
proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index bb6f3316d6..ecaba584f2 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -158,7 +158,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion &region, int msec
}
i = (i + 1) & 3;
- foreach (const QRect &rect, region.rects()) {
+ for (const QRect &rect : region) {
RECT winRect;
SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom());
FillRect(hdc, &winRect, brush);
@@ -285,7 +285,7 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi
{
const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
const QRect tlwRect(QRect(pos, rect.size()));
- if (fullUpdatePending || dirty.intersects(tlwRect))
+ if (dirty.intersects(tlwRect))
return false; // We don't want to scroll junk.
return store->scroll(tlwRect, dx, dy);
}
@@ -354,7 +354,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const
const bool widgetDirty = widget && widget != tlw;
const QRect tlwRect(topLevelRect());
const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
- if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) {
+ if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) {
if (widgetDirty) {
const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size());
const QPoint offset(widget->mapTo(tlw, QPoint()));
@@ -532,13 +532,6 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget,
return;
}
- //### FIXME fullUpdatePending seems to be always false????
- if (fullUpdatePending) {
- if (updateTime == UpdateNow)
- sendUpdateRequest(tlw, updateTime);
- return;
- }
-
const QPoint offset = widget->mapTo(tlw, QPoint());
if (QWidgetPrivate::get(widget)->renderToTexture) {
@@ -631,12 +624,6 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget,
return;
}
- if (fullUpdatePending) {
- if (updateTime == UpdateNow)
- sendUpdateRequest(tlw, updateTime);
- return;
- }
-
if (QWidgetPrivate::get(widget)->renderToTexture) {
if (!widget->d_func()->inDirtyList)
addDirtyRenderToTextureWidget(widget);
@@ -773,7 +760,6 @@ void QWidgetBackingStore::updateLists(QWidget *cur)
QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel)
: tlw(topLevel),
dirtyOnScreenWidgets(0),
- fullUpdatePending(0),
updateRequestSent(0),
textureListWatcher(0),
perfFrames(0)
@@ -1152,7 +1138,6 @@ void QWidgetBackingStore::sync()
for (int i = 0; i < dirtyWidgets.size(); ++i)
resetWidget(dirtyWidgets.at(i));
dirtyWidgets.clear();
- fullUpdatePending = false;
}
return;
}
@@ -1169,7 +1154,7 @@ void QWidgetBackingStore::doSync()
const bool inTopLevelResize = tlw->d_func()->maybeTopData()->inTopLevelResize;
const QRect tlwRect(topLevelRect());
const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
- if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
+ if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
if (hasStaticContents() && !store->size().isEmpty() ) {
// Repaint existing dirty area and newly visible area.
const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
@@ -1265,7 +1250,6 @@ void QWidgetBackingStore::doSync()
tlwExtra->widgetTextures.clear();
findAllTextureWidgetsRecursively(tlw, tlw);
qt_window_private(tlw->windowHandle())->compositing = false; // will get updated in qt_flush()
- fullUpdatePending = false;
#endif
if (toClean.isEmpty()) {
@@ -1331,9 +1315,8 @@ void QWidgetBackingStore::doSync()
updateStaticContentsSize();
dirty = QRegion();
updateRequestSent = false;
- const QVector<QRect> rects(toClean.rects());
- for (int i = 0; i < rects.size(); ++i)
- tlw->d_func()->extra->proxyWidget->update(rects.at(i));
+ for (const QRect &rect : toClean)
+ tlw->d_func()->extra->proxyWidget->update(rect);
return;
}
#endif
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index fa2b934ff8..dc20446047 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -116,7 +116,7 @@ public:
inline bool isDirty() const
{
- return !(dirtyWidgets.isEmpty() && dirty.isEmpty() && !fullUpdatePending && dirtyRenderToTextureWidgets.isEmpty());
+ return !(dirtyWidgets.isEmpty() && dirty.isEmpty() && dirtyRenderToTextureWidgets.isEmpty());
}
// ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore).
@@ -135,7 +135,6 @@ private:
QVector<QWidget *> *dirtyOnScreenWidgets;
QList<QWidget *> staticWidgets;
QBackingStore *store;
- uint fullUpdatePending : 1;
uint updateRequestSent : 1;
QPoint tlwOffset;
diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.cpp b/src/widgets/kernel/qwidgetsfunctions_wince.cpp
deleted file mode 100644
index 2bf8c6563b..0000000000
--- a/src/widgets/kernel/qwidgetsfunctions_wince.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qwidgetsfunctions_wince.h"
-#include <shellapi.h>
-
-QT_USE_NAMESPACE
-
-#ifndef ShellExecute
-HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd)
-{
- SHELLEXECUTEINFO info;
- info.hwnd = hwnd;
- info.lpVerb = L"Open";
- info.lpFile = file;
- info.lpParameters = params;
- info.lpDirectory = dir;
- info.nShow = showCmd;
- info.cbSize = sizeof(info);
- ShellExecuteEx(&info);
- return info.hInstApp;
-}
-#endif
-
-// Internal Qt -----------------------------------------------------
-bool qt_wince_is_platform(const QString &platformString) {
- wchar_t tszPlatform[64];
- if (SystemParametersInfo(SPI_GETPLATFORMNAME, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0))
- if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform))
- return true;
- return false;
-}
-
-int qt_wince_get_build()
-{
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (GetVersionEx(&osvi))
- return osvi.dwBuildNumber;
- return 0;
-}
-
-int qt_wince_get_version()
-{
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (GetVersionEx(&osvi))
- return (osvi.dwMajorVersion * 10 + osvi.dwMinorVersion);
- return 0;
-}
-
-bool qt_wince_is_windows_mobile_65()
-{
- const DWORD dwFirstWM65BuildNumber = 21139;
- OSVERSIONINFO osvi;
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (!GetVersionEx(&osvi))
- return false;
- return osvi.dwMajorVersion > 5
- || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 ||
- (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber)));
-}
-
-bool qt_wince_is_pocket_pc() {
- return qt_wince_is_platform(QString::fromLatin1("PocketPC"));
-}
-
-bool qt_wince_is_smartphone() {
- return qt_wince_is_platform(QString::fromLatin1("Smartphone"));
-}
-bool qt_wince_is_mobile() {
- return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc());
-}
-
-bool qt_wince_is_high_dpi() {
- if (!qt_wince_is_pocket_pc())
- return false;
- HDC deviceContext = GetDC(0);
- int dpi = GetDeviceCaps(deviceContext, LOGPIXELSX);
- ReleaseDC(0, deviceContext);
- if ((dpi < 1000) && (dpi > 0))
- return dpi > 96;
- else
- return false;
-}
diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri
index e2d5afdeec..7cef2d14a8 100644
--- a/src/widgets/kernel/win.pri
+++ b/src/widgets/kernel/win.pri
@@ -2,6 +2,6 @@
# --------------------------------------------------------------------
INCLUDEPATH += ../3rdparty/wintab
-!wince:!winrt {
- LIBS_PRIVATE *= -lshell32
-}
+!winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi
+# Override MinGW's definition in _mingw.h
+mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index e8062e9f9e..6b9e5577a4 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -3724,6 +3724,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
btnOpt.state &= ~State_MouseOver;
int bsx = 0;
int bsy = 0;
+ const int buttonIconMetric = proxy()->pixelMetric(PM_TitleBarButtonIconSize, &btnOpt, widget);
+ const QSize buttonIconSize(buttonIconMetric, buttonIconMetric);
if (opt->subControls & QStyle::SC_MdiCloseButton) {
if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
@@ -3738,7 +3740,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
- QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), QSize(16, 16));
+ QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), buttonIconSize);
proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
}
if (opt->subControls & QStyle::SC_MdiNormalButton) {
@@ -3755,7 +3757,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
- QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), QSize(16, 16));
+ QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), buttonIconSize);
proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
}
if (opt->subControls & QStyle::SC_MdiMinButton) {
@@ -3772,7 +3774,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
- QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), QSize(16, 16));
+ QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), buttonIconSize);
proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
}
}
@@ -4393,6 +4395,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
}
break; }
+ case PM_TitleBarButtonSize:
+ ret = int(QStyleHelper::dpiScaled(16.));
+ break;
+ case PM_TitleBarButtonIconSize:
+ ret = int(QStyleHelper::dpiScaled(16.));
+ break;
+
case PM_ScrollBarSliderMin:
ret = int(QStyleHelper::dpiScaled(9.));
break;
@@ -4845,16 +4854,18 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
#endif // QT_NO_GROUPBOX
case CT_MdiControls:
if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
+ const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, styleOpt, widget);
int width = 1;
if (styleOpt->subControls & SC_MdiMinButton)
- width += 16 + 1;
+ width += buttonSize + 1;
if (styleOpt->subControls & SC_MdiNormalButton)
- width += 16 + 1;
+ width += buttonSize + 1;
if (styleOpt->subControls & SC_MdiCloseButton)
- width += 16 + 1;
- sz = QSize(width, 16);
+ width += buttonSize + 1;
+ sz = QSize(width, buttonSize);
} else {
- sz = QSize(52, 16);
+ const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, opt, widget);
+ sz = QSize(1 + 3 * (buttonSize + 1), buttonSize);
}
break;
#ifndef QT_NO_ITEMVIEWS
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 3a39441785..06c3101643 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3101,6 +3101,9 @@ int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, co
case PM_DockWidgetTitleBarButtonMargin:
val = 2;
break;
+ case PM_TitleBarButtonSize:
+ val = 19;
+ break;
case PM_MaximumDragDistance:
return -1; // Do not dpi-scale because the value is magic
case PM_TabCloseIndicatorWidth:
@@ -3224,18 +3227,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
newSize += QSize(4, 4);
break;
case CT_MdiControls:
- if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
- int width = 0;
- if (styleOpt->subControls & SC_MdiMinButton)
- width += 19 + 1;
- if (styleOpt->subControls & SC_MdiNormalButton)
- width += 19 + 1;
- if (styleOpt->subControls & SC_MdiCloseButton)
- width += 19 + 1;
- newSize = QSize(width, 19);
- } else {
- newSize = QSize(60, 19);
- }
+ newSize -= QSize(1, 0);
break;
default:
break;
@@ -3631,7 +3623,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW
case SH_Menu_SupportsSections:
return 1;
-#if defined(Q_OS_IOS)
+#if defined(QT_PLATFORM_UIKIT)
case SH_ComboBox_UseNativePopup:
return 1;
#endif
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 3a875f9372..56531b10de 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -587,7 +587,7 @@ HIMutableShapeRef qt_mac_toHIMutableShape(const QRegion &region)
CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height());
HIShapeUnionWithRect(shape, &cgRect);
} else {
- foreach (const QRect &qtRect, region.rects()) {
+ for (const QRect &qtRect : region) {
CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height());
HIShapeUnionWithRect(shape, &cgRect);
}
@@ -1400,7 +1400,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem
bdi->adornment = kThemeAdornmentFocus;
if (combo->activeSubControls & QStyle::SC_ComboBoxArrow)
bdi->state = kThemeStatePressed;
- else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9)
+ else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion < QSysInfo::MV_10_10)
bdi->state = kThemeStateActive;
else
bdi->state = tds;
@@ -1719,7 +1719,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
|| slider->tickPosition == QSlider::TicksBothSides;
tdi->bounds = qt_hirectForQRect(slider->rect);
- if (isScrollbar || QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9) {
+ if (isScrollbar || QSysInfo::MacintoshVersion < QSysInfo::MV_10_10) {
tdi->min = slider->minimum;
tdi->max = slider->maximum;
tdi->value = slider->sliderPosition;
@@ -2253,9 +2253,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
CGContextSaveGState(cg);
HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect rect(rects.at(i));
+ for (const QRect &rect : rgn) {
// Anchor the pattern to the top so it stays put when the window is resized.
CGContextSetPatternPhase(cg, CGSizeMake(rect.width(), rect.height()));
CGRect mac_rect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
@@ -4022,7 +4020,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
bool hasIcon = !btn.icon.isNull();
bool hasText = !btn.text.isEmpty();
- if (!hasMenu && QSysInfo::QSysInfo::MacintoshVersion > QSysInfo::MV_10_9) {
+ if (!hasMenu && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) {
if (tds == kThemeStatePressed
|| (tds == kThemeStateActive
&& ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton)
@@ -4127,8 +4125,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QStyleOptionComboBox comboCopy = *cb;
comboCopy.direction = Qt::LeftToRight;
if (opt->state & QStyle::State_Small)
- comboCopy.rect.translate(0, w ? (QSysInfo::macVersion() > QSysInfo::MV_10_8 ? 0 : -1) :
- (QSysInfo::macVersion() > QSysInfo::MV_10_9 ? 0 : -2)); // Supports Qt Quick Controls
+ comboCopy.rect.translate(0, w ? 0 : (QSysInfo::macVersion() >= QSysInfo::MV_10_10 ? 0 : -2)); // Supports Qt Quick Controls
else if (QSysInfo::macVersion() == QSysInfo::MV_10_9)
comboCopy.rect.translate(0, 1);
QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w);
@@ -5467,7 +5464,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
opacity = anim->currentValue();
}
- shouldExpand = (opt->activeSubControls || wasActive) && QSysInfo::macVersion() >= QSysInfo::MV_10_8;
+ shouldExpand = (opt->activeSubControls || wasActive);
if (shouldExpand) {
if (!anim && !oldActiveControls) {
// Start expand animation only once and when entering
@@ -5964,7 +5961,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
drawToolbarButtonArrow(tb->rect, tds, cg);
}
if (tb->state & State_On) {
- if (QSysInfo::MacintoshVersion > QSysInfo::MV_MAVERICKS) {
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) {
QWindow *window = 0;
if (widget && widget->window())
window = widget->window()->windowHandle();
@@ -6326,7 +6323,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
switch (sc) {
case SC_ComboBoxEditField:{
ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi);
- if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_9)
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10)
ret.setHeight(ret.height() - 1);
break; }
case SC_ComboBoxArrow:{
@@ -7115,11 +7112,11 @@ void qt_mac_scale_region(QRegion *region, qreal scaleFactor)
return;
QVector<QRect> scaledRects;
- scaledRects.reserve(region->rects().count());
+ scaledRects.reserve(region->rectCount());
- foreach (const QRect &rect, region->rects()) {
+ for (const QRect &rect : *region)
scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor));
- }
+
region->setRects(&scaledRects[0], scaledRects.count());
}
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index 182c974729..5739678932 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -131,16 +131,9 @@ QProxyStyle::QProxyStyle(QStyle *style) :
\sa QStyleFactory::create()
*/
-QProxyStyle::QProxyStyle(const QString &key) :
- QCommonStyle(*new QProxyStylePrivate())
+QProxyStyle::QProxyStyle(const QString &key)
+ : QProxyStyle(QStyleFactory::create(key))
{
- Q_D(QProxyStyle);
- QStyle *style = QStyleFactory::create(key);
- if (style) {
- d->baseStyle = style;
- style->setProxy(this);
- style->setParent(this); // Take ownership
- }
}
/*!
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 3e17b22102..d72a898ee9 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1494,6 +1494,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_HeaderDefaultSectionSizeVertical The default size of sections
in a vertical header. This enum value has been introduced in Qt 5.5.
+ \value PM_TitleBarButtonIconSize The size of button icons on a title bar.
+ This enum value has been introduced in Qt 5.8.
+ \value PM_TitleBarButtonSize The size of buttons on a title bar.
+ This enum value has been introduced in Qt 5.8.
+
\value PM_CustomBase Base value for custom pixel metrics. Custom
values must be greater than this value.
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index 0f1259160e..0c8805e7a5 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -570,6 +570,9 @@ public:
PM_HeaderDefaultSectionSizeHorizontal,
PM_HeaderDefaultSectionSizeVertical,
+ PM_TitleBarButtonIconSize,
+ PM_TitleBarButtonSize,
+
// do not add any values below/greater than this
PM_CustomBase = 0xf0000000
};
diff --git a/src/widgets/styles/qstyle_wince.qrc b/src/widgets/styles/qstyle_wince.qrc
deleted file mode 100644
index c3d643fac7..0000000000
--- a/src/widgets/styles/qstyle_wince.qrc
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/qt-project.org/styles/commonstyle">
-<file>images/filelink-16.png</file>
-<file>images/filelink-32.png</file>
-<file>images/file-16.png</file>
-<file>images/file-32.png</file>
-<file>images/newdirectory-16.png</file>
-<file>images/newdirectory-32.png</file>
-<file>images/parentdir-16.png</file>
-<file>images/parentdir-32.png</file>
-<file>images/dvd-16.png</file>
-<file>images/dvd-32.png</file>
-<file>images/cdr-16.png</file>
-<file>images/cdr-32.png</file>
-<file>images/floppy-16.png</file>
-<file>images/floppy-32.png</file>
-<file>images/harddrive-16.png</file>
-<file>images/harddrive-32.png</file>
-<file>images/trash-16.png</file>
-<file>images/trash-32.png</file>
-<file>images/networkdrive-16.png</file>
-<file>images/networkdrive-32.png</file>
-<file>images/computer-16.png</file>
-<file>images/computer-32.png</file>
-<file>images/desktop-16.png</file>
-<file>images/desktop-32.png</file>
-<file>images/dirclosed-16.png</file>
-<file>images/dirclosed-32.png</file>
-<file>images/dirlink-16.png</file>
-<file>images/dirlink-32.png</file>
-<file>images/diropen-16.png</file>
-<file>images/diropen-32.png</file>
-<file>images/left-16.png</file>
-<file>images/left-32.png</file>
-<file>images/right-16.png</file>
-<file>images/right-32.png</file>
-<file>images/up-16.png</file>
-<file>images/up-32.png</file>
-<file>images/down-16.png</file>
-<file>images/down-32.png</file>
-<file>images/filecontents-16.png</file>
-<file>images/filecontents-32.png</file>
-<file>images/fileinfo-16.png</file>
-<file>images/fileinfo-32.png</file>
-<file>images/viewdetailed-16.png</file>
-<file>images/viewdetailed-32.png</file>
-<file>images/viewlist-16.png</file>
-<file>images/viewlist-32.png</file>
-<file>images/fontbitmap-16.png</file>
-<file>images/fonttruetype-16.png</file>
-<file>images/standardbutton-apply-16.png</file>
-<file>images/standardbutton-apply-32.png</file>
-<file>images/standardbutton-cancel-16.png</file>
-<file>images/standardbutton-cancel-32.png</file>
-<file>images/standardbutton-clear-16.png</file>
-<file>images/standardbutton-clear-32.png</file>
-<file>images/standardbutton-close-16.png</file>
-<file>images/standardbutton-close-32.png</file>
-<file>images/standardbutton-delete-16.png</file>
-<file>images/standardbutton-delete-32.png</file>
-<file>images/standardbutton-help-16.png</file>
-<file>images/standardbutton-help-32.png</file>
-<file>images/standardbutton-no-16.png</file>
-<file>images/standardbutton-no-32.png</file>
-<file>images/standardbutton-ok-16.png</file>
-<file>images/standardbutton-ok-32.png</file>
-<file>images/standardbutton-open-16.png</file>
-<file>images/standardbutton-open-32.png</file>
-<file>images/standardbutton-save-16.png</file>
-<file>images/standardbutton-save-32.png</file>
-<file>images/standardbutton-yes-16.png</file>
-<file>images/standardbutton-yes-32.png</file>
-<file>images/standardbutton-closetab-16.png</file>
-<file>images/standardbutton-closetab-down-16.png</file>
-<file>images/standardbutton-closetab-hover-16.png</file>
-<file>images/refresh-24.png</file>
-<file>images/refresh-32.png</file>
-<file>images/stop-24.png</file>
-<file>images/stop-32.png</file>
-<file>images/media-stop-16.png</file>
-<file>images/media-stop-32.png</file>
-<file>images/media-play-16.png</file>
-<file>images/media-play-32.png</file>
-<file>images/media-pause-16.png</file>
-<file>images/media-pause-32.png</file>
-<file>images/media-seek-forward-16.png</file>
-<file>images/media-seek-forward-32.png</file>
-<file>images/media-seek-backward-16.png</file>
-<file>images/media-seek-backward-32.png</file>
-<file>images/media-skip-forward-16.png</file>
-<file>images/media-skip-forward-32.png</file>
-<file>images/media-skip-backward-16.png</file>
-<file>images/media-skip-backward-32.png</file>
-<file>images/media-volume-16.png</file>
-<file>images/media-volume-muted-16.png</file>
-</qresource>
-</RCC>
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index bebd322c9e..bb849c148f 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -56,12 +56,6 @@
#ifndef QT_NO_STYLE_WINDOWSVISTA
#include "qwindowsvistastyle_p.h"
#endif
-#ifndef QT_NO_STYLE_WINDOWSCE
-#include "qwindowscestyle_p.h"
-#endif
-#ifndef QT_NO_STYLE_WINDOWSMOBILE
-#include "qwindowsmobilestyle_p.h"
-#endif
#if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC)
# include "qmacstyle_mac_p.h"
@@ -114,16 +108,6 @@ QStyle *QStyleFactory::create(const QString& key)
ret = new QWindowsStyle;
else
#endif
-#ifndef QT_NO_STYLE_WINDOWSCE
- if (style == QLatin1String("windowsce"))
- ret = new QWindowsCEStyle;
- else
-#endif
-#ifndef QT_NO_STYLE_WINDOWSMOBILE
- if (style == QLatin1String("windowsmobile"))
- ret = new QWindowsMobileStyle;
- else
-#endif
#ifndef QT_NO_STYLE_WINDOWSXP
if (style == QLatin1String("windowsxp"))
ret = new QWindowsXPStyle;
@@ -180,14 +164,6 @@ QStringList QStyleFactory::keys()
if (!list.contains(QLatin1String("Windows")))
list << QLatin1String("Windows");
#endif
-#ifndef QT_NO_STYLE_WINDOWSCE
- if (!list.contains(QLatin1String("WindowsCE")))
- list << QLatin1String("WindowsCE");
-#endif
-#ifndef QT_NO_STYLE_WINDOWSMOBILE
- if (!list.contains(QLatin1String("WindowsMobile")))
- list << QLatin1String("WindowsMobile");
-#endif
#ifndef QT_NO_STYLE_WINDOWSXP
if (!list.contains(QLatin1String("WindowsXP")) &&
(QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
diff --git a/src/widgets/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp
deleted file mode 100644
index 4633659963..0000000000
--- a/src/widgets/styles/qwindowscestyle.cpp
+++ /dev/null
@@ -1,2429 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowscestyle_p.h"
-
-#if !defined(QT_NO_STYLE_WINDOWSCE) || defined(QT_PLUGIN)
-
-#include "qpainterpath.h"
-#include "qapplication.h"
-#include "qdockwidget.h"
-#include "qtoolbar.h"
-#include "qpaintengine.h"
-#include "qpainter.h"
-#include "qstyleoption.h"
-#include "qwindowscestyle_p_p.h"
-#include "qdebug.h"
-#include "qdrawutil.h"
-
-QT_BEGIN_NAMESPACE
-
-static const int windowsItemFrame = 2; // menu item frame width
-static const int windowsItemHMargin = 3; // menu item hor text margin
-static const int windowsItemVMargin = 2; // menu item ver text margin
-static const int windowsArrowHMargin = 6; // arrow horizontal margin
-static const int windowsRightBorder = 15; // right border on windows
-static const int windowsCheckMarkWidth = 14; // checkmarks width on windows
-
-static const int windowsCEitemViewCheckBoxSize = 14;
-static const int windowsCEFrameGroupBoxOffset = 9;
-static const int windowsCEIndicatorSize = 14;
-static const int windowsCEExclusiveIndicatorSize = 14;
-static const int windowsCESliderThickness = 24;
-static const int windowsCEIconSize = 16;
-
-static const QColor windowsCECheckBoxGradientColorBegin = QColor(222, 224, 214);
-static const QColor windowsCECheckBoxGradientColorEnd = QColor(255, 255, 255);
-
-enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
-
-QWindowsCEStyle::QWindowsCEStyle() : QWindowsStyle() {
- qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
- qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
-}
-
-QWindowsCEStyle::~QWindowsCEStyle()
-{
-}
-
-void QWindowsCEStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const {
-
- bool doRestore = false;
- QRect rect = option->rect;
-
- switch (element) {
- case PE_PanelButtonTool: {
- if (
-#ifndef QT_NO_TOOLBAR
- (widget && qobject_cast<QToolBar*>(widget->parentWidget())) ||
-#endif
-#ifndef QT_NO_DOCKWIDGET
- (widget && widget->inherits("QDockWidgetTitleButton")) ||
-#endif
- (option->state & (State_Sunken | State_On)))
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(0, 0, 0, 0),
- option->palette, option->state & (State_Sunken | State_On),
- &option->palette.button());
- if (option->state & (State_On)){
- QBrush fill = QBrush(option->palette.midlight().color(), Qt::Dense4Pattern);
- painter->fillRect(option->rect.adjusted(windowsItemFrame , windowsItemFrame ,
- -windowsItemFrame , -windowsItemFrame ), fill);
- }
- break; }
- case PE_IndicatorButtonDropDown:
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
- option->state & (State_Sunken | State_On),
- &option->palette.brush(QPalette::Button));
- break;
-#ifndef QT_NO_TABBAR
- case PE_IndicatorTabTear:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- bool rtl = tab->direction == Qt::RightToLeft;
- QRect rect = tab->rect;
- QPainterPath path;
- rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3));
- rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2));
- path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top()));
- int count = 3;
- for(int jags = 1; jags <= count; ++jags, rtl = !rtl)
- path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count));
-
- painter->setPen(QPen(tab->palette.light(), qreal(.8)));
- painter->setBrush(tab->palette.background());
- painter->setRenderHint(QPainter::Antialiasing);
- painter->drawPath(path);
- }
- break;
-#endif //QT_NO_TABBAR
-#ifndef QT_NO_TOOLBAR
- case PE_IndicatorToolBarSeparator:
- //nothing to draw on WindowsCE
- break;
- case PE_IndicatorToolBarHandle:
- painter->save();
- painter->translate(option->rect.x(), option->rect.y());
- if (option->state & State_Horizontal) {
- int x = option->rect.width() / 2 - 4;
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- x -= 2;
- if (option->rect.height() > 4) {
- QWindowsCEStylePrivate::drawWinCEButton(painter,x - 1, 0, 7, option->rect.height(),
- option->palette, false, 0);
- QWindowsCEStylePrivate::drawWinCEPanel(painter, x, 1, 3, option->rect.height() - 1,
- option->palette, false, 0);
- QWindowsCEStylePrivate::drawWinCEPanel(painter, x + 3, 1, 3, option->rect.height() - 1,
- option->palette, false, 0);
- painter->setPen(option->palette.button().color());
- painter->drawLine(x + 4, 2, x + 4,option->rect.height() - 2);
- }
- } else {
- if (option->rect.width() > 4) {
- int y = option->rect.height() / 2 - 4;
- QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y, option->rect.width() - 2, 3,
- option->palette, false, 0);
- QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y + 3, option->rect.width() - 2, 3,
- option->palette, false, 0);
- }
- }
- painter->restore();
- break;
-
-#endif // QT_NO_TOOLBAR
- case PE_FrameButtonTool: {
-#ifndef QT_NO_DOCKWIDGET
- if (widget && widget->inherits("QDockWidgetTitleButton")) {
- if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent()))
- if (dw->isFloating()){
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(1, 1, 0, 0),
- option->palette, option->state & (State_Sunken | State_On),
- &option->palette.button());
- return;
- }
- }
-#endif // QT_NO_DOCKWIDGET
- QBrush fill;
- bool stippled;
- bool panel = (element == PE_PanelButtonTool);
- if ((!(option->state & State_Sunken ))
- && (!(option->state & State_Enabled)
- || ((option->state & State_Enabled ) && !(option->state & State_MouseOver)))
- && (option->state & State_On)) {
- fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- stippled = true;
- } else {
- fill = option->palette.brush(QPalette::Button);
- stippled = false;
- }
- if (option->state & (State_Raised | State_Sunken | State_On)) {
- if (option->state & State_AutoRaise) {
- if(option->state & (State_Enabled | State_Sunken | State_On)){
- if (panel)
- QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette,
- option->state & (State_Sunken | State_On), &fill);
- else
- qDrawShadeRect(painter, option->rect, option->palette,
- option->state & (State_Sunken | State_On), 1);
- }
- if (stippled) {
- painter->setPen(option->palette.button().color());
- painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
- }
- } else {
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
- option->state & (State_Sunken | State_On), panel ? &fill : 0);
- }
- } else {
- painter->fillRect(option->rect, fill);
- }
- break; }
-
- case PE_PanelButtonBevel: {
- QBrush fill;
- bool panel = element != PE_FrameButtonBevel;
- painter->setBrushOrigin(option->rect.topLeft());
- if (!(option->state & State_Sunken) && (option->state & State_On))
- fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- else
- fill = option->palette.brush(QPalette::Button);
-
- if (option->state & (State_Raised | State_On | State_Sunken)) {
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
- option->state & (State_Sunken | State_On),
- panel ? &fill : 0); ;
- } else {
- if (panel)
- painter->fillRect(option->rect, fill);
- else
- painter->drawRect(option->rect);
- }
- break; }
-
- case PE_FrameGroupBox:
- if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- QRect fr = frame->rect;
- painter->setPen(frame->palette.shadow().color());
- painter->drawRect(fr.x(), fr.y(), fr.x() + fr.width() - 1,
- fr.y() + fr.height() - windowsCEFrameGroupBoxOffset);
- }
- break;
-
- case PE_IndicatorCheckBox: {
- QBrush fill;
- if (option->state & State_NoChange)
- fill = QBrush(option->palette.base().color(), Qt::Dense4Pattern);
- else if (option->state & State_Sunken)
- fill = option->palette.button();
- else if (option->state & State_Enabled)
- fill = option->palette.base();
- else
- fill = option->palette.background();
- painter->save();
- doRestore = true;
- painter->fillRect(option->rect,fill);
- painter->setPen(option->palette.dark().color());
- painter->drawRect(option->rect);
- painter->setPen(option->palette.shadow().color());
- painter->drawLine(option->rect.x() + 1,option->rect.y() + 1,
- option->rect.x() + option->rect.width() - 1, option->rect.y() + 1);
- painter->drawLine(option->rect.x() + 1,option->rect.y() + 1,
- option->rect.x() + 1, option->rect.y() + option->rect.height() - 1);
- //fall through...
- }
- case PE_IndicatorViewItemCheck: {
- if (!doRestore) {
- painter->save();
- doRestore = true;
- }
- int arrowSize= 2;
- if (element == PE_IndicatorViewItemCheck) {
- QLinearGradient linearGradient(QPoint(option->rect.x(),option->rect.y()), QPoint(option->rect.x()+option->rect.width(),
- option->rect.y()+option->rect.height()));
- linearGradient.setColorAt(0, windowsCECheckBoxGradientColorBegin);
- linearGradient.setColorAt(1, windowsCECheckBoxGradientColorEnd);
- painter->setBrush(linearGradient);
- painter->setPen(Qt::NoPen);
- if (option->state & State_NoChange)
- painter->setBrush(option->palette.brush(QPalette::Button));
- painter->setPen(option->palette.link().color());
- painter->drawRect(option->rect.x(), option->rect.y(), windowsCEitemViewCheckBoxSize, windowsCEitemViewCheckBoxSize);
- painter->setPen(option->palette.brightText().color());
- arrowSize= 3;
- }
- if (!(option->state & State_Off)) {
- QLineF lines[9];
- int i, xx, yy;
- xx = option->rect.x() + 4;
- yy = option->rect.y() + 6;
- for (i = 0; i < 4; ++i) {
- lines[i] = QLineF(xx, yy, xx, yy + arrowSize);
- ++xx;
- ++yy;
- }
- yy -= 2;
- for (i = 4; i < 9; ++i) {
- lines[i] = QLineF(xx, yy, xx, yy + arrowSize);
- ++xx;
- --yy;
- }
- painter->drawLines(lines, 9);
- }
- if (doRestore)
- painter->restore();
-
- break; }
- case PE_IndicatorRadioButton: {
- QRect ir = option->rect;
- painter->save();
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.light());
- painter->drawEllipse(option->rect);
- painter->setPen(option->palette.shadow().color());
- painter->setBrush(option->palette.shadow().color());
- painter->drawArc(option->rect, 0, 360 * 16);
- painter->drawArc(option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2,
- option->rect.height() - 2, 40 * 16, 180 * 16);
- painter->setPen(option->palette.light().color());
- painter->drawPoint(option->rect.x() + 11, option->rect.y() + 3);
- painter->drawPoint(option->rect.x() + 3,option->rect.y() + 3);
- painter->setPen(option->palette.shadow().color());
- painter->drawPoint(option->rect.x() +3,option->rect.y() + 12);
- if (option->state & (State_Sunken | State_On)) {
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.text());
- painter->drawEllipse(option->rect.x() +3,option->rect.y()+ 2,9,10);
- }
- painter->restore();
- break; }
- case PE_PanelMenuBar:
- painter->save();
- painter->setPen(option->palette.shadow().color());
- painter->drawRect(option->rect);
- painter->restore();
- break;
- case PE_PanelButtonCommand:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QBrush fill;
- State flags = option->state;
- QPalette pal = option->palette;
- QRect r = option->rect;
- if (! (flags & State_Sunken) && (flags & State_On))
- fill = QBrush(pal.light().color(), Qt::Dense4Pattern);
- else
- fill = pal.brush(QPalette::Button);
- if (btn->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) {
- painter->setPen(pal.dark().color());
- painter->setBrush(fill);
- painter->drawRect(r.adjusted(0, 0, -1, -1));
- } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) {
- QWindowsCEStylePrivate::drawWinCEButton(painter, r, pal, flags & (State_Sunken | State_On),
- &fill);
- } else {
- painter->fillRect(r, fill);
- }
-
- }
- break;
- case PE_FrameDefaultButton: {
- painter->setPen(option->palette.shadow().color());
- QRect rect = option->rect;
- rect.adjust(0, 0, -1, -1);
- painter->drawRect(rect);
- break; }
- case PE_IndicatorSpinPlus:
- case PE_IndicatorSpinMinus: {
- QRect r = option->rect;
- int fw = pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
- QRect br = r.adjusted(fw, fw, -fw, -fw);
- int offset = (option->state & State_Sunken) ? 1 : 0;
- int step = (br.width() + 4) / 5;
- painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2,
- br.width(), step,
- option->palette.buttonText());
- if (element == PE_IndicatorSpinPlus)
- painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4,
- step, br.height()-7,
- option->palette.buttonText());
- break; }
- case PE_IndicatorSpinUp:
- case PE_IndicatorSpinDown: {
- painter->save();
- QPoint points[7];
- switch (element) {
- case PE_IndicatorSpinUp:
- points[0] = QPoint(-2, -4);
- points[1] = QPoint(-2, 2);
- points[2] = QPoint(-1, -3);
- points[3] = QPoint(-1, 1);
- points[4] = QPoint(0, -2);
- points[5] = QPoint(0, 0);
- points[6] = QPoint(1, -1);
- break;
- case PE_IndicatorSpinDown:
- points[0] = QPoint(0, -4);
- points[1] = QPoint(0, 2);
- points[2] = QPoint(-1, -3);
- points[3] = QPoint(-1, 1);
- points[4] = QPoint(-2, -2);
- points[5] = QPoint(-2, 0);
- points[6] = QPoint(-3, -1);
- break;
- default:
- break;
- }
- if (option->state & State_Sunken)
- painter->translate(pixelMetric(PM_ButtonShiftHorizontal),
- pixelMetric(PM_ButtonShiftVertical));
- if (option->state & State_Enabled) {
- painter->translate(option->rect.x() + option->rect.width() / 2,
- option->rect.y() + option->rect.height() / 2);
- painter->setPen(option->palette.buttonText().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- } else {
- painter->translate(option->rect.x() + option->rect.width() / 2 + 1,
- option->rect.y() + option->rect.height() / 2 + 1);
- painter->setPen(option->palette.light().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- painter->translate(-1, -1);
- painter->setPen(option->palette.mid().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- }
-
- painter->restore();
- break; }
- case PE_IndicatorArrowUp:
- case PE_IndicatorArrowDown:
- case PE_IndicatorArrowRight:
- case PE_IndicatorArrowLeft: {
- painter->save();
- QPoint points[9];
- switch (element) {
- case PE_IndicatorArrowUp:
-
- points[0] = QPoint(-4, 2);
- points[1] = QPoint(4, 2);
- points[2] = QPoint(-3, 1);
- points[3] = QPoint(3, 1);
- points[4] = QPoint(-2, 0);
- points[5] = QPoint(2, 0);
- points[6] = QPoint(-1, -1);
- points[7] = QPoint(1, -1);
- points[8] = QPoint(0, -2);
- break;
- case PE_IndicatorArrowDown:
-
- points[0] = QPoint(-4, -2);
- points[1] = QPoint(4, -2);
- points[2] = QPoint(-3, -1);
- points[3] = QPoint(3, -1);
- points[4] = QPoint(-2, 0);
- points[5] = QPoint(2, 0);
- points[6] = QPoint(-1, 1);
- points[7] = QPoint(1, 1);
- points[8] = QPoint(0, 2);
- break;
- case PE_IndicatorArrowRight:
- points[0] = QPoint(-3, -4);
- points[1] = QPoint(-3, 4);
- points[2] = QPoint(-2, -3);
- points[3] = QPoint(-2, 3);
- points[4] = QPoint(-1, -2);
- points[5] = QPoint(-1, 2);
- points[6] = QPoint(0, -1);
- points[7] = QPoint(0, 1);
- points[8] = QPoint(1, 0);
- break;
- case PE_IndicatorArrowLeft:
- points[0] = QPoint(1, -4);
- points[1] = QPoint(1, 4);
- points[2] = QPoint(0, -3);
- points[3] = QPoint(0, 3);
- points[4] = QPoint(-1, -2);
- points[5] = QPoint(-1, 2);
- points[6] = QPoint(-2, -1);
- points[7] = QPoint(-2, 1);
- points[8] = QPoint(-3, 0);
- break;
- default:
- break;
- }
- if (option->state & State_Sunken)
- painter->translate(pixelMetric(PM_ButtonShiftHorizontal),
- pixelMetric(PM_ButtonShiftVertical));
- if (option->state & State_Enabled) {
- painter->translate(option->rect.x() + option->rect.width() / 2,
- option->rect.y() + option->rect.height() / 2);
- painter->setPen(option->palette.buttonText().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawLine(points[6], points[7]);
- painter->drawPoint(points[8]);
- } else {
- painter->translate(option->rect.x() + option->rect.width() / 2 + 1,
- option->rect.y() + option->rect.height() / 2 + 1);
- painter->setPen(option->palette.light().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawLine(points[6], points[7]);
- painter->drawPoint(points[8]);
- painter->translate(-1, -1);
- painter->setPen(option->palette.mid().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawLine(points[6], points[7]);
- painter->drawPoint(points[8]);
- }
- painter->restore();
- break; }
-
- case PE_FrameWindow: {
- QPalette popupPal = option->palette;
- popupPal.setColor(QPalette::Light, option->palette.background().color());
- popupPal.setColor(QPalette::Midlight, option->palette.light().color());
- QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, popupPal, option->state & State_Sunken);
- break; }
-
- case PE_Frame:
- case PE_FrameMenu:
- if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- QPalette popupPal = frame->palette;
- QRect r = frame->rect;
- qDrawPlainRect(painter, r, frame->palette.shadow().color(),1);
- }
- break;
- case PE_FrameStatusBar:
- QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, 0);
- break;
-
- case PE_FrameTabWidget: {
- QRect rect = option->rect;
- QPalette pal = option->palette;
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, false, 0);
- break; }
- default:
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
- break;
- }
-}
-
-void QWindowsCEStyle::drawControl(ControlElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const {
- switch (element) {
- #ifndef QT_NO_MENU
- case CE_MenuTearoff: {
- if(option->state & State_Selected) {
- if(pixelMetric(PM_MenuPanelWidth, option, widget) > 1)
- qDrawShadePanel(painter, option->rect.x(), option->rect.y(), option->rect.width(),
- option->rect.height(), option->palette, false, 2,
- &option->palette.brush(QPalette::Button));
- else
- qDrawShadePanel(painter, option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2,
- option->rect.height() - 2, option->palette, true, 1, &option->palette.brush(QPalette::Button));
- } else {
- painter->fillRect(option->rect, option->palette.brush(QPalette::Button));
- }
- painter->setPen(QPen(option->palette.dark().color(), 1, Qt::DashLine));
- painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2-1, option->rect.x()+option->rect.width()-4,
- option->rect.y()+option->rect.height()/2-1);
- painter->setPen(QPen(option->palette.light().color(), 1, Qt::DashLine));
- painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2, option->rect.x()+option->rect.width()-4,
- option->rect.y()+option->rect.height()/2);
- break; }
-
-
- case CE_MenuBarItem:
- if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- bool active = mbi->state & State_Selected;
- bool hasFocus = mbi->state & State_HasFocus;
- bool down = mbi->state & State_Sunken;
- QStyleOptionMenuItem newMbi = *mbi;
- if (active || hasFocus) {
- QBrush b = mbi->palette.brush(QPalette::Highlight);
- if (active && down) {
- painter->fillRect(mbi->rect.adjusted(0, 1, 0, -1), b);
- }
- }
- uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
- | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, mbi, widget))
- alignment |= Qt::TextHideMnemonic;
-
- painter->save();
- QFont f = painter->font();
- f.setBold(true);
- painter->setFont(f);
- QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize),
- (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
- if (!pix.isNull())
- drawItemPixmap(painter,mbi->rect, alignment, pix);
- else
- if (active && down)
- drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
- mbi->text, QPalette::Light);
- else
- drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
- mbi->text, QPalette::ButtonText);
- painter->restore();
- }
- break;
-
- case CE_MenuBarEmptyArea:
- painter->save();
- painter->setPen(option->palette.shadow().color());
- if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground)) {
- painter->eraseRect(option->rect);
- QRect r = option->rect;
- painter->drawLine(r.x() + 1, r.y() + 1, r.x()+ 1, r.y()+ r.height() - 2);
- painter->drawLine(r.x() - 2 + r.width(), r.y() + 1, r.x() - 2 + r.width(), r.y() + r.height() - 2);
- painter->drawLine(r.x() + 1, r.y() +1, r.x() - 1 + r.width(), r.y() + 1);
- painter->drawLine(r.x() + 1, r.y() + r.height()-2 , r.x() - 2 + r.width(), r.y() + r.height() - 2);
- }
- painter->restore();
- break;
-
- case CE_MenuItem:
- if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int x, y, w, h;
- menuitem->rect.getRect(&x, &y, &w, &h);
- int tab = menuitem->tabWidth;
- bool dis = !(menuitem->state & State_Enabled);
- bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable
- ? menuitem->checked : false;
- bool act = menuitem->state & State_Selected;
-
- // windows always has a check column, regardless whether we have an icon or not
- int checkcol = qMax(menuitem->maxIconWidth, windowsCheckMarkWidth);
- QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button);
- painter->fillRect(menuitem->rect.adjusted(1, 1, 0, 0), fill);
-
- if (menuitem->menuItemType == QStyleOptionMenuItem::Separator) {
- int yoff = y-1 + h / 2;
- painter->setPen(menuitem->palette.shadow().color());
- painter->drawLine(x + 4, yoff + 1, x + w - 8, yoff + 1);
- return;
- }
-
- QRect vCheckRect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x(),
- menuitem->rect.y(), checkcol, menuitem->rect.height()));
- if (checked) {
- if (act && !dis) {
- qDrawPlainRect(painter, vCheckRect,
- menuitem->palette.button().color(), 1,
- &menuitem->palette.brush(QPalette::Button));
- } else {
- QBrush fill(menuitem->palette.button().color(), Qt::Dense4Pattern);
- qDrawPlainRect(painter, vCheckRect,menuitem->palette.button().color(), 1, &fill);
- }
- } else if (!act) {
- painter->fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button));
- }
- // On Windows Style, if we have a checkable item and an icon we
- // draw the icon recessed to indicate an item is checked. If we
- // have no icon, we draw a checkmark instead.
- if (!menuitem->icon.isNull()) {
- QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
- if (act && !dis)
- mode = QIcon::Active;
- QPixmap pixmap;
- if (checked)
- pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On);
- else
- pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
- const int pixw = pixmap.width() / pixmap.devicePixelRatio();
- const int pixh = pixmap.height() / pixmap.devicePixelRatio();
- if (act && !dis && !checked)
- qDrawPlainRect(painter, vCheckRect, menuitem->palette.button().color(), 1,
- &menuitem->palette.brush(QPalette::Button));
- QRect pmr(0, 0, pixw, pixh);
- pmr.moveCenter(vCheckRect.center());
- painter->setPen(menuitem->palette.text().color());
- painter->drawPixmap(pmr.topLeft(), pixmap);
- } else if (checked) {
- QStyleOptionMenuItem newMi = *menuitem;
- newMi.state = State_None;
- if (!dis)
- newMi.state |= State_Enabled;
- if (act)
- newMi.state |= State_On;
- newMi.rect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x()
- + windowsItemFrame, menuitem->rect.y() + windowsItemFrame,
- checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame));
- drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, painter, widget);
- }
- painter->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());
-
- QColor discol;
- if (dis) {
- discol = menuitem->palette.text().color();
- painter->setPen(discol);
- }
- int xm = windowsItemFrame + checkcol + windowsItemHMargin;
- int xpos = menuitem->rect.x() + xm;
- QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
- QRect vTextRect = visualRect(option->direction, menuitem->rect, textRect);
- QString s = menuitem->text;
- if (!s.isEmpty()) { // draw text
- painter->save();
- int t = s.indexOf(QLatin1Char('\t'));
- int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
- text_flags |= Qt::TextHideMnemonic;
- text_flags |= Qt::AlignLeft;
- if (t >= 0) {
- QRect vShortcutRect = visualRect(option->direction, menuitem->rect,
- QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
- if (dis && !act)
- painter->setPen(discol);
- painter->drawText(vShortcutRect, text_flags, s.mid(t + 1));
- s = s.left(t);
- }
- QFont font = menuitem->font;
- if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
- font.setBold(true);
- painter->setFont(font);
- if (dis && !act)
- painter->setPen(discol);
- painter->drawText(vTextRect, text_flags, s.left(t));
- painter->restore();
- }
- if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
- int dim = (h - 2 * windowsItemFrame) / 2;
- PrimitiveElement arrow;
- arrow = (option->direction == Qt::RightToLeft) ? PE_IndicatorSpinDown : PE_IndicatorSpinUp;
- xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim;
- QRect vSubMenuRect = visualRect(option->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim));
- QStyleOptionMenuItem newMI = *menuitem;
- newMI.rect = vSubMenuRect;
- newMI.state = dis ? State_None : State_Enabled;
- if (act)
- newMI.palette.setColor(QPalette::ButtonText,
- newMI.palette.highlightedText().color());
- drawPrimitive(arrow, &newMI, painter, widget);
- }
- }
- break;
-#endif // QT_NO_MENU
- case CE_MenuVMargin:
- painter->fillRect(option->rect, Qt::white);
- break;
- case CE_MenuEmptyArea:
- QWindowsStyle::drawControl(element,option, painter, widget);
- break;
-
-#ifndef QT_NO_TABBAR
- case CE_TabBarTab:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- drawControl(CE_TabBarTabShape, tab, painter, widget);
- drawControl(CE_TabBarTabLabel, tab, painter, widget);
- }
- break;
- case CE_TabBarTabShape:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- bool rtlHorTabs = (tab->direction == Qt::RightToLeft
- && (tab->shape == QTabBar::RoundedNorth
- || tab->shape == QTabBar::RoundedSouth));
- bool selected = tab->state & State_Selected;
- bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
- || (rtlHorTabs
- && tab->position == QStyleOptionTab::Beginning));
- bool firstTab = ((!rtlHorTabs
- && tab->position == QStyleOptionTab::Beginning)
- || (rtlHorTabs
- && tab->position == QStyleOptionTab::End));
- bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
- bool previousSelected =
- ((!rtlHorTabs
- && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)
- || (rtlHorTabs
- && tab->selectedPosition == QStyleOptionTab::NextIsSelected));
- bool nextSelected =
- ((!rtlHorTabs
- && tab->selectedPosition == QStyleOptionTab::NextIsSelected)
- || (rtlHorTabs
- && tab->selectedPosition
- == QStyleOptionTab::PreviousIsSelected));
- int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget);
- bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
- || (rtlHorTabs
- && tabBarAlignment == Qt::AlignRight);
-
- bool rightAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignRight)
- || (rtlHorTabs
- && tabBarAlignment == Qt::AlignLeft);
- QColor light = tab->palette.light().color();
- QColor midlight = tab->palette.midlight().color();
- QColor dark = tab->palette.dark().color();
- QColor shadow = tab->palette.shadow().color();
- QColor background = tab->palette.background().color();
- int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
- if (selected)
- borderThinkness /= 2;
- QRect r2(option->rect);
- int x1 = r2.left();
- int x2 = r2.right();
- int y1 = r2.top();
- int y2 = r2.bottom();
- switch (tab->shape) {
- default:
- QCommonStyle::drawControl(element, tab, painter, widget);
- break;
- case QTabBar::RoundedNorth: {
- if (!selected) {
- y1 += 2;
- x1 += firstTab ? borderThinkness : 0;
- x2 -= lastTab ? borderThinkness : 0;
- }
-
- painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background());
-
- // Delete border
- if (selected) {
- painter->setPen(background);
- painter->drawLine(x1, y2 - 1, x2, y2 - 1);
- painter->drawLine(x1, y2 + 1, x2, y2 + 1);
- painter->drawLine(x1, y2, x2, y2);
- }
- // Left
- if (firstTab || selected || onlyOne || !previousSelected) {
- painter->setPen(dark);
- painter->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- painter->drawPoint(x1 + 1, y1 + 1);
- painter->setPen(midlight);
- painter->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 -
- ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
-
- }
- // Top
- {
- int beg = x1 + (previousSelected ? 0 : 2);
- int end = x2 - (nextSelected ? 0 : 2);
- painter->setPen(dark);
- painter->drawLine(beg, y1, end, y1);
-
- painter->setPen(midlight);
- painter->drawLine(beg, y1 + 1, end, y1 + 1);
-
- }
- // Right
- if (lastTab || selected || onlyOne || !nextSelected) {
- painter->setPen(shadow);
- painter->drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
- painter->drawPoint(x2 - 1, y1 + 1);
- painter->setPen(dark);
- painter->drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
- }
- break; }
- case QTabBar::RoundedSouth: {
- if (!selected) {
- y2 -= 2;
- x1 += firstTab ? borderThinkness : 0;
- x2 -= lastTab ? borderThinkness : 0;
- }
-
- painter->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());
-
- // Delete border
- if (selected) {
- painter->setPen(background);
- painter->drawLine(x1, y1 + 1, x2 - 1, y1 + 1);
- painter->drawLine(x1, y1 - 1, x2 - 1, y1 - 1);
- painter->drawLine(x1, y1, x2 - 1, y1);
- }
- // Left
- if (firstTab || selected || onlyOne || !previousSelected) {
- painter->setPen(dark);
- painter->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- painter->drawPoint(x1 + 1, y2 - 1);
- painter->setPen(midlight);
- painter->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- }
- // Bottom
- {
- int beg = x1 + (previousSelected ? 0 : 2);
- int end = x2 - (nextSelected ? 0 : 2);
- painter->setPen(shadow);
- painter->drawLine(beg, y2, end, y2);
- painter->setPen(dark);
- painter->drawLine(beg, y2 - 1, end, y2 - 1);
- }
- // Right
- if (lastTab || selected || onlyOne || !nextSelected) {
- painter->setPen(shadow);
- painter->drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected &&
- rightAligned ? 0 : borderThinkness));
- painter->drawPoint(x2 - 1, y2 - 1);
- painter->setPen(dark);
- painter->drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected &&
- rightAligned ? 0 : borderThinkness));
- }
- break; }
- case QTabBar::RoundedWest: {
- if (!selected) {
- x1 += 2;
- y1 += firstTab ? borderThinkness : 0;
- y2 -= lastTab ? borderThinkness : 0;
- }
-
- painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background());
-
- // Delete border
- if (selected) {
- painter->setPen(background);
- painter->drawLine(x2 - 1, y1, x2 - 1, y2);
- painter->drawLine(x2, y1, x2, y2);
- }
- // Top
- if (firstTab || selected || onlyOne || !previousSelected) {
- painter->setPen(dark);
- painter->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected &&
- leftAligned ? 0 : borderThinkness), y1);
- painter->drawPoint(x1 + 1, y1 + 1);
- painter->setPen(midlight);
- painter->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected &&
- leftAligned ? 0 : borderThinkness), y1 + 1);
- }
- // Left
- {
- int beg = y1 + (previousSelected ? 0 : 2);
- int end = y2 - (nextSelected ? 0 : 2);
- painter->setPen(dark);
- painter->drawLine(x1, beg, x1, end);
- painter->setPen(midlight);
- painter->drawLine(x1 + 1, beg, x1 + 1, end);
- }
- // Bottom
- if (lastTab || selected || onlyOne || !nextSelected) {
- painter->setPen(shadow);
- painter->drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected &&
- rightAligned ? 0 : borderThinkness), y2);
- painter->drawPoint(x1 + 2, y2 - 1);
- painter->setPen(dark);
- painter->drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected &&
- rightAligned ? 0 : borderThinkness), y2 - 1);
- painter->drawPoint(x1 + 1, y2 - 1);
- painter->drawPoint(x1 + 2, y2);
- }
- break; }
- case QTabBar::RoundedEast: {
- if (!selected) {
- x2 -= 2;
- y1 += firstTab ? borderThinkness : 0;
- y2 -= lastTab ? borderThinkness : 0;
- }
-
- painter->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());
-
- // Delete border
- if (selected) {
- painter->setPen(background);
- painter->drawLine(x1 + 1, y1, x1 + 1, y2 - 1);
- painter->drawLine(x1, y1, x1, y2 - 1);
- }
- // Top
- if (firstTab || selected || onlyOne || !previousSelected) {
- painter->setPen(dark);
- painter->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected &&
- leftAligned ? 0 : borderThinkness), y1);
- painter->drawPoint(x2 - 1, y1 + 1);
- painter->setPen(midlight);
- painter->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) &&
- selected && leftAligned ? 0 : borderThinkness), y1 + 1);
- painter->drawPoint(x2 - 1, y1);
-
- }
- // Right
- {
- int beg = y1 + (previousSelected ? 0 : 2);
- int end = y2 - (nextSelected ? 0 : 2);
- painter->setPen(shadow);
- painter->drawLine(x2, beg, x2, end);
- painter->setPen(dark);
- painter->drawLine(x2 - 1, beg, x2 - 1, end);
- }
- // Bottom
- if (lastTab || selected || onlyOne || !nextSelected) {
- painter->setPen(shadow);
- painter->drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) &&
- selected && rightAligned ? 0 : borderThinkness), y2);
- painter->drawPoint(x2 - 1, y2 - 1);
- painter->setPen(dark);
- painter->drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) &&
- selected && rightAligned ? 0 : borderThinkness), y2 - 1);
- }
- break; }
- }
- }
- break;
-#endif // QT_NO_TABBAR
-
- case CE_ToolBar: {
- QRect rect = option->rect;
- painter->setPen(QPen(option->palette.dark().color()));
- painter->drawLine(rect.topRight().x()-1,
- rect.topRight().y(),
- rect.bottomRight().x()-1,
- rect.bottomRight().y());
- painter->drawLine(rect.bottomLeft().x(),
- rect.bottomLeft().y(),
- rect.bottomRight().x(),
- rect.bottomRight().y());
- painter->setPen(QPen(option->palette.light().color()));
- painter->drawLine(rect.topRight().x(),
- rect.topRight().y(),
- rect.bottomRight().x(),
- rect.bottomRight().y());
- painter->drawLine(rect.topLeft().x(),
- rect.topLeft().y(),
- rect.topRight().x(),
- rect.topRight().y());
-
- break; }
-#ifndef QT_NO_SCROLLBAR
- case CE_ScrollBarSubLine:
- case CE_ScrollBarAddLine: {
- if (option->state & State_Sunken) {
- QStyleOption buttonOpt = *option;
-
- drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
- } else {
- QStyleOption buttonOpt = *option;
- if (!(buttonOpt.state & State_Sunken))
- buttonOpt.state |= State_Raised;
- drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
- }
- PrimitiveElement arrow;
- if (option->state & State_Horizontal) {
- if (element == CE_ScrollBarAddLine)
- arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft;
- else
- arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
- } else {
- if (element == CE_ScrollBarAddLine)
- arrow = PE_IndicatorArrowDown;
- else
- arrow = PE_IndicatorArrowUp;
- }
- drawPrimitive(arrow, option, painter, widget);
- break; }
- case CE_ScrollBarAddPage:
- case CE_ScrollBarSubPage: {
- QBrush br;
- QBrush bg = painter->background();
- Qt::BGMode bg_mode = painter->backgroundMode();
- painter->setPen(Qt::NoPen);
- painter->setBackgroundMode(Qt::OpaqueMode);
-
- if (option->state & State_Sunken) {
- br = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern);
- painter->setBackground(option->palette.dark().color());
- painter->setBrush(br);
- } else {
- QPixmap pm = option->palette.brush(QPalette::Light).texture();
- if (option->state & State_Enabled)
- br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.button().color(), Qt::Dense4Pattern);
- else
- br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- painter->setBackground(option->palette.base().color());
- painter->setBrush(br);
- }
- painter->drawRect(option->rect);
- painter->setBackground(bg);
- painter->setBackgroundMode(bg_mode);
- break; }
- case CE_ScrollBarSlider:
- if (!(option->state & State_Enabled)) {
- QStyleOptionButton buttonOpt;
- buttonOpt.QStyleOption::operator=(*option);
- buttonOpt.state = State_Enabled | State_Raised;
- drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
- QPixmap pm = option->palette.brush(QPalette::Light).texture();
- QBrush br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- painter->setPen(Qt::NoPen);
- painter->setBrush(br);
- painter->setBackgroundMode(Qt::OpaqueMode);
- painter->drawRect(option->rect.adjusted(2, 2, -2, -2));
- } else {
- QStyleOptionButton buttonOpt;
- buttonOpt.QStyleOption::operator=(*option);
- buttonOpt.state = State_Enabled | State_Raised;
- drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget);
- }
- break;
-#endif // QT_NO_SCROLLBAR
- case CE_HeaderSection: {
- QBrush fill;
- if (option->state & State_On)
- fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- else
- fill = option->palette.brush(QPalette::Button);
-
- if (option->state & (State_Raised | State_Sunken)) {
- QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette,
- option->state & State_Sunken, &fill);
- } else {
- painter->fillRect(option->rect, fill);
- }
- break; }
-
- case CE_DockWidgetTitle:
- QWindowsStyle::drawControl(element,option, painter, widget);
- break;
-
- case CE_PushButtonLabel:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- painter->save();
- QFont f = painter->font();
- f.setBold(true);
- painter->setFont(f);
- QRect ir = btn->rect;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, btn, widget))
- tf |= Qt::TextHideMnemonic;
-
- if (btn->state & (State_On | State_Sunken))
- ir.translate(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
- pixelMetric(PM_ButtonShiftVertical, option, widget));
- if (!btn->icon.isNull()) {
- QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal
- : QIcon::Disabled;
- if (mode == QIcon::Normal && btn->state & State_HasFocus)
- mode = QIcon::Active;
- QIcon::State state = QIcon::Off;
- if (btn->state & State_On)
- state = QIcon::On;
- QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state);
- int pixw = pixmap.width();
- int pixh = pixmap.height();
- //Center the icon if there is no text
-
- QPoint point;
- if (btn->text.isEmpty()) {
- point = QPoint(ir.x() + ir.width() / 2 - pixw / 2,
- ir.y() + ir.height() / 2 - pixh / 2);
- } else {
- point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2);
- }
- if (btn->direction == Qt::RightToLeft)
- point.rx() += pixw;
-
- if ((btn->state & (State_On | State_Sunken)) && btn->direction == Qt::RightToLeft)
- point.rx() -= pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
-
- painter->drawPixmap(visualPos(btn->direction, btn->rect, point), pixmap);
-
- if (btn->direction == Qt::RightToLeft)
- ir.translate(-4, 0);
- else
- ir.translate(pixw + 4, 0);
- ir.setWidth(ir.width() - (pixw + 4));
- // left-align text if there is
- if (!btn->text.isEmpty())
- tf |= Qt::AlignLeft;
- } else {
- tf |= Qt::AlignHCenter;
- }
- drawItemText(painter, ir, tf, btn->palette, (btn->state & State_Enabled),
- btn->text, QPalette::ButtonText);
- painter->restore();
- }
- break;
- default:
- QWindowsStyle::drawControl(element, option, painter, widget);
- break;
- }
-}
-
-void QWindowsCEStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const {
- switch (control) {
- #ifndef QT_NO_SLIDER
- case CC_Slider:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
- int len = pixelMetric(PM_SliderLength, slider, widget);
- int ticks = slider->tickPosition;
- QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
-
- if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
- int mid = thickness / 2;
- if (ticks & QSlider::TicksAbove)
- mid += len / 8;
- if (ticks & QSlider::TicksBelow)
- mid -= len / 8;
-
- painter->setPen(slider->palette.shadow().color());
- if (slider->orientation == Qt::Horizontal) {
- QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x(), groove.y() + mid - 2,
- groove.width(), 4, option->palette, true);
- painter->drawLine(groove.x() + 1, groove.y() + mid - 1,
- groove.x() + groove.width() - 3, groove.y() + mid - 1);
- } else {
- QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x() + mid - 2, groove.y(),
- 4, groove.height(), option->palette, true);
- painter->drawLine(groove.x() + mid - 1, groove.y() + 1,
- groove.x() + mid - 1, groove.y() + groove.height() - 3);
- }
- }
- if (slider->subControls & SC_SliderTickmarks) {
- QStyleOptionSlider tmpSlider = *slider;
- tmpSlider.subControls = SC_SliderTickmarks;
- QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget);
- }
-
- if (slider->subControls & SC_SliderHandle) {
- // 4444440
- // 4333310
- // 4322210
- // 4322210
- // 4322210
- // 4322210
- // *43210*
- // **440**
- // ***0***
- const QColor c0 = slider->palette.shadow().color();
- const QColor c1 = slider->palette.dark().color();
- // const QColor c2 = g.button();
- const QColor c3 = slider->palette.midlight().color();
- const QColor c4 = slider->palette.dark().color();
- QBrush handleBrush;
-
- if (slider->state & State_Enabled) {
- handleBrush = slider->palette.color(QPalette::Button);
- } else {
- handleBrush = QBrush(slider->palette.color(QPalette::Button),
- Qt::Dense4Pattern);
- }
-
- int x = handle.x(), y = handle.y(),
- wi = handle.width(), he = handle.height();
-
- int x1 = x;
- int x2 = x + wi - 1;
- int y1 = y;
- int y2 = y + he - 1;
-
- Qt::Orientation orient = slider->orientation;
- bool tickAbove = slider->tickPosition == QSlider::TicksAbove;
- bool tickBelow = slider->tickPosition == QSlider::TicksBelow;
-
- if (slider->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*slider);
- fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
- Qt::BGMode oldMode = painter->backgroundMode();
- painter->setBackgroundMode(Qt::OpaqueMode);
- QWindowsCEStylePrivate::drawWinCEButton(painter, QRect(x, y, wi, he), slider->palette, false,
- &handleBrush);
- painter->setBackgroundMode(oldMode);
- QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill);
- return;
- }
- QSliderDirection dir;
- if (orient == Qt::Horizontal)
- if (tickAbove)
- dir = SlUp;
- else
- dir = SlDown;
- else
- if (tickAbove)
- dir = SlLeft;
- else
- dir = SlRight;
- QPolygon a;
- int d = 0;
- switch (dir) {
- case SlUp:
- x2++;
- y1 = y1 + wi / 2;
- d = (wi + 1) / 2 - 1;
- a.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d, y1 - d);
- break;
- case SlDown:
- x2++;
- y2 = y2 - wi / 2;
- d = (wi + 1) / 2 - 1;
- a.setPoints(5, x1, y1, x1, y2, x1 + d, y2+d, x2, y2, x2, y1);
- break;
- case SlLeft:
- d = (he + 1) / 2 - 1;
- x1 = x1 + he / 2;
- a.setPoints(5, x1, y1, x1 - d, y1 + d, x1, y2, x2, y2, x2, y1);
- y1--;
- break;
- case SlRight:
- d = (he + 1) / 2 - 1;
- x2 = x2 - he / 2;
- a.setPoints(5, x1, y1, x1, y2, x2, y2, x2 + d, y1 + d, x2, y1);
- y1--;
- break;
- }
- QBrush oldBrush = painter->brush();
- painter->setPen(Qt::NoPen);
- painter->setBrush(handleBrush);
- Qt::BGMode oldMode = painter->backgroundMode();
- painter->setBackgroundMode(Qt::OpaqueMode);
- painter->drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
- painter->drawPolygon(a);
- QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill);
- painter->setBrush(oldBrush);
- painter->setBackgroundMode(oldMode);
-
- if (dir != SlUp) {
- painter->setPen(c4);
- painter->drawLine(x1, y1, x2, y1);
- painter->setPen(c3);
- painter->drawLine(x1, y1 + 1, x2, y1 + 1);
- }
- if (dir != SlLeft) {
- painter->setPen(c3);
- painter->drawLine(x1 + 1, y1 + 1, x1 + 1, y2);
- painter->setPen(c4);
- painter->drawLine(x1, y1, x1, y2);
- }
- if (dir != SlRight) {
- painter->setPen(c0);
- painter->drawLine(x2, y1, x2, y2);
- painter->setPen(c1);
- painter->drawLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1);
- }
- if (dir != SlDown) {
- painter->setPen(c0);
- painter->drawLine(x1, y2, x2, y2);
- painter->setPen(c1);
- painter->drawLine(x1+1, y2 - 1, x2 - 1, y2 - 1);
- }
-
- switch (dir) {
- case SlUp:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4,y1), fill);
- painter->setPen(c4);
- painter->drawLine(x1, y1, x1 + d, y1 - d);
- painter->setPen(c0);
- d = wi - d - 1;
- painter->drawLine(x2, y1, x2 - d, y1 - d);
- d--;
- painter->setPen(c3);
- painter->drawLine(x1 + 1, y1, x1 + 1 + d-1, y1 - d + 1);
- painter->setPen(c1);
- painter->drawLine(x2 - 1, y1, x2-1 - d, y1 - d);
- break;
- case SlDown:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 + 3, y2 - d, x2 - x1 - 4,y2 - 8), fill);
- painter->setPen(c4);
- painter->drawLine(x1, y2, x1 + d, y2 + d);
- painter->setPen(c0);
- d = wi - d - 1;
- painter->drawLine(x2, y2, x2 - d, y2 + d);
- d--;
- painter->setPen(c3);
- painter->drawLine(x1 + 1, y2, x1 + 1 + d - 1, y2 + d - 1);
- painter->setPen(c1);
- painter->drawLine(x2 - 1, y2, x2 - 1 - d, y2 + d);
- break;
- case SlLeft:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1,y2 - y1 - 3), fill);
- painter->setPen(c4);
- painter->drawLine(x1, y1, x1 - d, y1 + d);
- painter->setPen(c0);
- d = he - d - 1;
- painter->drawLine(x1, y2, x1 - d, y2 - d);
- d--;
- painter->setPen(c3);
- painter->drawLine(x1, y1 + 1, x1 - d + 1, y1 + 1 + d - 1);
- painter->setPen(c1);
- painter->drawLine(x1, y2 - 1, x1 - d, y2 - 1 - d);
- break;
- case SlRight:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3), fill);
- painter->setPen(c4);
- painter->drawLine(x2, y1, x2 + d, y1 + d);
- painter->setPen(c0);
- d = he - d - 1;
- painter->drawLine(x2, y2, x2 + d, y2 - d);
- d--;
- painter->setPen(c3);
- painter->drawLine(x2, y1 + 1, x2 + d - 1, y1 + 1 + d - 1);
- painter->setPen(c1);
- painter->drawLine(x2, y2 - 1, x2 + d, y2 - 1 - d);
- break;
- }
- }
- }
- break;
-#endif // QT_NO_SLIDER
- case CC_ToolButton:
- if (const QStyleOptionToolButton *toolbutton
- = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- QRect button, menuarea;
-
-#ifndef QT_NO_TOOLBAR
- bool flat = !(widget ? qobject_cast<QToolBar*>(widget->parentWidget()) : 0);
-#else
- bool flat = true;
-#endif
-
- button = subControlRect(control, toolbutton, SC_ToolButton, widget);
- menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
-
- if (flat && (toolbutton->subControls & SC_ToolButtonMenu)) {
- menuarea.setLeft(menuarea.left() - 4);
- button.setRight(button.right() - 4);
- }
-
- State bflags = toolbutton->state;
-
- if (bflags & State_AutoRaise)
- if (!(bflags & State_MouseOver)) {
- bflags &= ~State_Raised;
- }
- State mflags = bflags;
-
- if (toolbutton->activeSubControls & SC_ToolButton)
- bflags |= State_Sunken;
- if (toolbutton->activeSubControls & SC_ToolButtonMenu)
- mflags |= State_Sunken;
-
- QStyleOption tool = *toolbutton;
- if (toolbutton->subControls & SC_ToolButton) {
- tool.rect = button;
- tool.state = bflags;
- drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
- }
-
- if (toolbutton->subControls & SC_ToolButtonMenu) {
- tool.rect = menuarea;
- tool.state = mflags;
- tool.state = bflags;
- drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget);
-
- if (!flat) {
-
- //connect buttons
- painter->save();
- painter->setPen(tool.palette.button().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() - 2, tool.rect.y() + tool.rect.height());
- painter->drawLine(tool.rect.x() - 1, tool.rect.y(), tool.rect.x() - 1, tool.rect.y() + tool.rect.height());
- painter->drawLine(tool.rect.x(), tool.rect.y(), tool.rect.x(), tool.rect.y() + tool.rect.height());
- painter->drawLine(tool.rect.x() + 1, tool.rect.y(), tool.rect.x() + 1, tool.rect.y() + tool.rect.height());
-
- if (tool.state & State_Sunken)
- {
- painter->setPen(tool.palette.midlight().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 2,
- tool.rect.x() + 1, tool.rect.y() + tool.rect.height() -2 );
- painter->setPen(tool.palette.shadow().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1);
- painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() + 1, tool.rect.y());
- painter->setPen(tool.palette.light().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1,
- tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1);
- }
- else
- {
- painter->setPen(tool.palette.dark().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y(),tool.rect.x() + 1, tool.rect.y());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y()+tool.rect.height() - 2,tool.rect.x() + 1,
- tool.rect.y() + tool.rect.height() - 2);
- painter->setPen(tool.palette.midlight().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1);
- painter->setPen(tool.palette.shadow().color());
- painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1,
- tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1);
- }
- painter->restore();
- }
-
-
- if (!flat) {
- tool.rect.adjust(-3,0,-3,0);
- painter->save();
- painter->setPen(tool.palette.button().color());
- if (tool.state & State_Sunken)
- painter->drawLine(tool.rect.x() + 2, tool.rect.y() + 10,
- tool.rect.x() + tool.rect.width(), tool.rect.y() + 10);
- else
- painter->drawLine(tool.rect.x() + 1, tool.rect.y() + 9, tool.rect.x() +
- tool.rect.width() - 1, tool.rect.y() + 9);
- painter->restore();
- } else {
- tool.rect.adjust(-1,0,-1,0);
- }
-
- drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
- }
-
- if (toolbutton->state & State_HasFocus) {
- QStyleOptionFocusRect fr;
- fr.QStyleOption::operator=(*toolbutton);
- fr.rect.adjust(3, 3, -3, -3);
- if (toolbutton->features & QStyleOptionToolButton::Menu)
- fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
- toolbutton, widget), 0);
- drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
- }
- QStyleOptionToolButton label = *toolbutton;
- int fw = pixelMetric(PM_DefaultFrameWidth, option, widget);
- label.rect = button.adjusted(fw, fw, -fw, -fw);
- drawControl(CE_ToolButtonLabel, &label, painter, widget);
- }
- break;
-
-#ifndef QT_NO_GROUPBOX
- case CC_GroupBox:
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- // Draw frame
- painter->save();
- QFont f = painter->font();
- f.setBold(true);
- painter->setFont(f);
- QStyleOptionGroupBox groupBoxFont = *groupBox;
- groupBoxFont.fontMetrics = QFontMetrics(f);
- QRect textRect = subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget);
- if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
- QStyleOptionFrame frame;
- frame.QStyleOption::operator=(*groupBox);
- frame.features = groupBox->features;
- frame.lineWidth = groupBox->lineWidth;
- frame.midLineWidth = groupBox->midLineWidth;
- frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
- painter->save();
-
- QRegion region(groupBox->rect);
- if (!groupBox->text.isEmpty()) {
- bool ltr = groupBox->direction == Qt::LeftToRight;
- QRect finalRect = checkBoxRect.united(textRect);
- if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)
- finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
- region -= finalRect;
- }
- painter->setClipRegion(region);
- drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
- painter->restore();
- }
-
- // Draw title
- if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
- QColor textColor = groupBox->textColor;
- if (textColor.isValid())
- painter->setPen(textColor);
- int alignment = int(groupBox->textAlignment);
- if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget))
- alignment |= Qt::TextHideMnemonic;
-
- drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
- groupBox->palette, groupBox->state & State_Enabled, groupBox->text,
- textColor.isValid() ? QPalette::NoRole : QPalette::WindowText);
-
- if (groupBox->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*groupBox);
- fropt.rect = textRect;
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- }
- // Draw checkbox
- if (groupBox->subControls & SC_GroupBoxCheckBox) {
- QStyleOptionButton box;
- box.QStyleOption::operator=(*groupBox);
- box.rect = checkBoxRect;
- drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
- }
- painter->restore();
- }
- break;
-#endif //QT_NO_GROUPBOX
-#ifndef QT_NO_COMBOBOX
- case CC_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- QBrush editBrush = cmb->palette.brush(QPalette::Base);
- if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame)
- QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, &editBrush);
- else
- painter->fillRect(option->rect, editBrush);
-
- if (cmb->subControls & SC_ComboBoxArrow) {
- State flags = State_None;
-
- QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
- if (cmb->activeSubControls == SC_ComboBoxArrow) {
- painter->setPen(cmb->palette.dark().color());
- painter->setBrush(cmb->palette.brush(QPalette::Button));
- painter->drawRect(ar.adjusted(0, 0, -1, -1));
- QWindowsCEStylePrivate::drawWinCEButton(painter, ar.adjusted(0, 0, -1, -1), option->palette, true,
- &cmb->palette.brush(QPalette::Button));
- } else {
- // Make qDrawWinButton use the right colors for drawing the shade of the button
-
- QWindowsCEStylePrivate::drawWinCEButton(painter, ar, option->palette, false,
- &cmb->palette.brush(QPalette::Button));
- }
-
- ar.adjust(2, 2, -2, -2);
- if (option->state & State_Enabled)
- flags |= State_Enabled;
-
- if (cmb->activeSubControls == SC_ComboBoxArrow)
- flags |= State_Sunken;
- QStyleOption arrowOpt = *cmb;
- arrowOpt.rect = ar;
- arrowOpt.state = flags;
- drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
- }
- if (cmb->subControls & SC_ComboBoxEditField) {
- QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
- if (cmb->state & State_HasFocus && !cmb->editable)
- painter->fillRect(re.x(), re.y(), re.width(), re.height(),
- cmb->palette.brush(QPalette::Highlight));
- if (cmb->state & State_HasFocus) {
- painter->setPen(cmb->palette.highlightedText().color());
- painter->setBackground(cmb->palette.highlight());
- } else {
- painter->setPen(cmb->palette.text().color());
- painter->setBackground(cmb->palette.background());
- }
- if (cmb->state & State_HasFocus && !cmb->editable) {
- QStyleOptionFocusRect focus;
- focus.QStyleOption::operator=(*cmb);
- focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget);
- focus.state |= State_FocusAtBorder;
- focus.backgroundColor = cmb->palette.highlight().color();
- drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
- }
- }
- }
- break;
-#endif // QT_NO_COMBOBOX
-#ifndef QT_NO_SPINBOX
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QStyleOptionSpinBox copy = *sb;
- PrimitiveElement pe;
-
- if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
- QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
- QWindowsCEStylePrivate::drawWinCEPanel(painter, r, option->palette, true);
- }
- QPalette shadePal(option->palette);
- shadePal.setColor(QPalette::Button, option->palette.light().color());
- shadePal.setColor(QPalette::Light, option->palette.button().color());
-
- bool reverse = QApplication::layoutDirection() == Qt::RightToLeft;
-
- if (sb->subControls & SC_SpinBoxUp) {
- copy.subControls = SC_SpinBoxUp;
- QPalette pal2 = sb->palette;
- if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
- pal2.setCurrentColorGroup(QPalette::Disabled);
- copy.state &= ~State_Enabled;
- }
- copy.palette = pal2;
- if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) {
- copy.state |= State_On;
- copy.state |= State_Sunken;
- } else {
- copy.state |= State_Raised;
- copy.state &= ~State_Sunken;
- }
- if (reverse)
- pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
- : PE_IndicatorSpinDown);
- else
- pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
- : PE_IndicatorSpinUp);
- copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
- QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, option->palette, copy.state & (State_Sunken | State_On),
- &copy.palette.brush(QPalette::Button));
- copy.rect.adjust(3, 0, -4, 0);
- drawPrimitive(pe, &copy, painter, widget);
- }
- if (sb->subControls & SC_SpinBoxDown) {
- copy.subControls = SC_SpinBoxDown;
- copy.state = sb->state;
- QPalette pal2 = sb->palette;
- if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
- pal2.setCurrentColorGroup(QPalette::Disabled);
- copy.state &= ~State_Enabled;
- }
- copy.palette = pal2;
-
- if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) {
- copy.state |= State_On;
- copy.state |= State_Sunken;
- } else {
- copy.state |= State_Raised;
- copy.state &= ~State_Sunken;
- }
- if (reverse)
- pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
- : PE_IndicatorSpinUp);
- else
- pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
- : PE_IndicatorSpinDown);
- copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
- QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
- &copy.palette.brush(QPalette::Button));
-
- copy.rect.adjust(3, 0, -4, 0);
- if (pe == PE_IndicatorArrowUp || pe == PE_IndicatorArrowDown) {
- copy.rect = copy.rect.adjusted(1, 1, -1, -1);
- drawPrimitive(pe, &copy, painter, widget);
- }
- else {
- drawPrimitive(pe, &copy, painter, widget);
- }
- if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
- QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget);
- painter->save();
- painter->setPen(option->palette.light().color());
- painter->drawLine(r.x() + 1 + r.width(), r.y() - 2, r.x() + 1 + r.width(), r.y() + r.height() + 1);
- painter->setPen(option->palette.midlight().color());
- painter->drawLine(r.x() + r.width(), r.y() - 1, r.x() + r.width(), r.y() + r.height());
- painter->restore();
- }
- }
- }
- break;
-#endif // QT_NO_SPINBOX
-
- default:
- QWindowsStyle::drawComplexControl(control, option, painter, widget);
- break;
- }
-}
-
-void QWindowsCEStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
- bool enabled, const QString& text, QPalette::ColorRole textRole) const {
- if (text.isEmpty())
- return;
- QPen savedPen;
- if (textRole != QPalette::NoRole) {
- savedPen = painter->pen();
- painter->setPen(pal.color(textRole));
- }
- if (!enabled) {
- QPen pen = painter->pen();
- painter->setPen(pal.light().color());
- //painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text);
- painter->setPen(pen);
- }
- painter->drawText(rect, alignment, text);
- if (textRole != QPalette::NoRole)
- painter->setPen(savedPen);
-}
-
-
-QSize QWindowsCEStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const {
- QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
- switch (type) {
- case CT_PushButton:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
- int w = newSize.width(),
- h = newSize.height();
- int defwidth = 0;
- if (btn->features & QStyleOptionButton::AutoDefaultButton)
- defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
- if (w < 75 + defwidth && btn->icon.isNull())
- w = 75 + defwidth;
- if (h < 23 + defwidth)
- h = 23 + defwidth;
- newSize = QSize(w+14, h);
- }
- break;
-
- case CT_RadioButton:
- case CT_CheckBox:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- bool isRadio = (type == CT_RadioButton);
- QRect irect = visualRect(btn->direction, btn->rect,
- subElementRect(isRadio ? SE_RadioButtonIndicator
- : SE_CheckBoxIndicator, btn, widget));
- int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
- : PM_IndicatorHeight, btn, widget);
- int margins = (!btn->icon.isNull() && btn->text.isEmpty()) ? 0 : 10;
- newSize += QSize(irect.right() + margins, 4);
- newSize.setHeight(qMax(newSize.height(), h));
- }
- break;
- case CT_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
- newSize = QSize(newSize.width() + fw -1, qMax(24, newSize.height() + fw-1));
- }
- break;
-#ifndef QT_NO_SPINBOX
- case CT_SpinBox:
- if (const QStyleOptionSpinBox *spnb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- int fw = spnb->frame ? pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
- newSize = QSize(newSize.width() + fw - 5, newSize.height() + fw - 6);
- }
- break;
-#endif
- case CT_LineEdit:
- newSize += QSize(0,1);
- break;
- case CT_MenuBarItem:
- newSize += QSize(5, 1);
- break;
- case CT_MenuItem:
- newSize += QSize(0, -2);
- break;
- case CT_MenuBar:
- newSize += QSize(0, -1);
- break;
- case CT_ToolButton:
- if (const QStyleOptionToolButton *b = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- if (b->toolButtonStyle != Qt::ToolButtonIconOnly)
- newSize = QSize(newSize.width() + 1, newSize.height() - 1);
- else
- newSize = QSize(newSize.width() + 1, newSize.height());
- }
- break;
-
- default:
- break;
- }
- return newSize;
-}
-
-QRect QWindowsCEStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const {
- QRect rect = QWindowsStyle::subElementRect(element, option, widget);
- switch (element) {
-#ifndef QT_NO_COMBOBOX
- case SE_ComboBoxFocusRect:
- if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int margin = cb->frame ? 3 : 0;
- rect.setRect(margin, margin, option->rect.width() - 2*margin - 20, option->rect.height() - 2*margin);
- rect = visualRect(option->direction, option->rect, rect);
- }
- break;
-#endif // QT_NO_COMBOBOX
- default:
- break;
- }
- return rect;
-}
-
-QRect QWindowsCEStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
- SubControl subControl, const QWidget *widget) const {
- QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
- switch (control) {
-#ifndef QT_NO_SLIDER
- case CC_Slider:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
-
- switch (subControl) {
- case SC_SliderHandle: {
- int sliderPos = 0;
- int len = pixelMetric(PM_SliderLength, slider, widget);
- bool horizontal = slider->orientation == Qt::Horizontal;
- sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
- slider->sliderPosition,
- (horizontal ? slider->rect.width()
- : slider->rect.height()) - len,
- slider->upsideDown);
- if (horizontal)
- rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness);
- else
- rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len);
- break; }
- default:
- break;
- }
- rect = visualRect(slider->direction, slider->rect, rect);
- }
- break;
-#endif //QT_NO_SLIDER
-#ifndef QT_NO_COMBOBOX
- case CC_ComboBox:
- if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int x = cb->rect.x(),
- y = cb->rect.y(),
- wi = cb->rect.width(),
- he = cb->rect.height();
- int xpos = x;
- int margin = cb->frame ? 3 : 0;
- int bmarg = cb->frame ? 2 : 0;
- xpos += wi - (he - 2*bmarg) - bmarg;
- switch (subControl) {
- case SC_ComboBoxArrow:
- rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg);
- break;
- case SC_ComboBoxEditField:
- rect.setRect(x + margin, y + margin, wi - 2 * margin - (he - 2*bmarg), he - 2 * margin);
- break;
- case SC_ComboBoxListBoxPopup:
- rect = cb->rect;
- break;
- case SC_ComboBoxFrame:
- rect = cb->rect;
- break;
- default:
- break;
- }
- rect = visualRect(cb->direction, cb->rect, rect);
- }
-#endif //QT_NO_COMBOBOX
-#ifndef QT_NO_SPINBOX
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QSize bs;
- int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
- bs.setWidth(qMax(18, (spinbox->rect.height() / 2 - fw + 1)));
- // 1.6 -approximate golden mean
- bs.setHeight(qMax(18, qMin((bs.height() * 8 / 5), (spinbox->rect.width() / 4))));
- bs = bs.expandedTo(QApplication::globalStrut());
- int y = fw;
- int x, lx, rx;
- x = spinbox->rect.width() - y - bs.width() * 2;
- lx = fw;
- rx = x - fw;
- switch (subControl) {
- case SC_SpinBoxUp:
- rect = QRect(x + bs.width(), y, bs.width(), bs.height());
- break;
- case SC_SpinBoxDown:
- rect = QRect(x, y , bs.width(), bs.height());
- break;
- case SC_SpinBoxEditField:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
- rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw);
- } else {
- rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
- }
- break;
- case SC_SpinBoxFrame:
- rect = spinbox->rect;
- default:
- break;
- }
- rect = visualRect(spinbox->direction, spinbox->rect, rect);
- }
- break;
-#endif // Qt_NO_SPINBOX
-#ifndef QT_NO_GROUPBOX
- case CC_GroupBox: {
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- switch (subControl) {
- case SC_GroupBoxFrame:
- // FALL THROUGH
- case SC_GroupBoxContents: {
- int topMargin = 0;
- int topHeight = 0;
- int bottomMargin = 0;
- int noLabelMargin = 0;
- QRect frameRect = groupBox->rect;
- int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
- if (groupBox->text.size()) {
- topHeight = groupBox->fontMetrics.height();
- if (verticalAlignment & Qt::AlignVCenter)
- topMargin = topHeight / 2;
- else if (verticalAlignment & Qt::AlignTop)
- topMargin = -topHeight/2;
- }
- else {
- topHeight = groupBox->fontMetrics.height();
- noLabelMargin = topHeight / 2;
- if (verticalAlignment & Qt::AlignVCenter) {
- topMargin = topHeight / 4 - 4;
- bottomMargin = topHeight / 4 - 4;
- }
- else if (verticalAlignment & Qt::AlignTop) {
- topMargin = topHeight/2 - 4;
- bottomMargin = topHeight/2 - 4;
- }
- }
-
- if (subControl == SC_GroupBoxFrame) {
- frameRect.setTop(topMargin);
- frameRect.setBottom(frameRect.height() + bottomMargin);
- rect = frameRect;
- break;
- }
-
- int frameWidth = 0;
- if ((groupBox->features & QStyleOptionFrame::Flat) == 0)
- frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
- rect = frameRect.adjusted(frameWidth, frameWidth + topHeight, -frameWidth, -frameWidth - noLabelMargin);
- break;
- }
- case SC_GroupBoxCheckBox:
- // FALL THROUGH
- case SC_GroupBoxLabel: {
- QFontMetrics fontMetrics = groupBox->fontMetrics;
- int h = fontMetrics.height();
- int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width();
- const int marg = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 8;
- rect = groupBox->rect.adjusted(marg, 0, -marg, 0);
- rect.setHeight(h);
-
- int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
- int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
- bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
- int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
-
- // Adjusted rect for label + indicatorWidth + indicatorSpace
- QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment,
- QSize(tw + checkBoxSize, h), rect);
-
- // Adjust totalRect if checkbox is set
- if (hasCheckBox) {
- bool ltr = groupBox->direction == Qt::LeftToRight;
- int left = 0;
- // Adjust for check box
- if (subControl == SC_GroupBoxCheckBox) {
- int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
- left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
- int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
- totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
- // Adjust for label
- } else {
- left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
- totalRect.setRect(left, totalRect.top(),
- totalRect.width() - checkBoxSize, totalRect.height());
- }
- }
- rect = totalRect;
- break;
- }
- default:
- break;
- }
- }
- break;
- }
-#endif // QT_NO_GROUPBOX
- default:
- break;
- }
- return rect;
-}
-
-QStyle::SubControl QWindowsCEStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- const QPoint &pos, const QWidget *widget) const {
- /*switch (control) {
- default:
- break;
- }*/
- return QWindowsStyle::hitTestComplexControl(control, option, pos, widget);
-}
-
-
-QPalette QWindowsCEStyle::standardPalette() const {
- QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ),
- QColor(132, 130, 132), QColor(198, 195, 198) , Qt::black, Qt::white, Qt::white, QColor(198, 195, 198));
- palette.setColor(QPalette::Window, QColor(198, 195, 198));
- palette.setColor(QPalette::Base, Qt::white);
- palette.setColor(QPalette::Button, QColor(198, 195, 198));
- palette.setColor(QPalette::Highlight, QColor(0, 0, 132));
- palette.setColor(QPalette::Light, Qt::white);
- palette.setColor(QPalette::Midlight, QColor(222, 223, 222 ));
- palette.setColor(QPalette::Dark, QColor(132, 130, 132));
- palette.setColor(QPalette::Mid, QColor(132, 130, 132));
- palette.setColor(QPalette::Shadow, QColor(0, 0, 0));
- palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow)
- palette.setColor(QPalette::Link, QColor(24,81,132)); // color for the box around the ItemView indicator
-
- return palette;
-}
-
-void QWindowsCEStyle::polish(QApplication *app) {
- QWindowsStyle::polish(app);
-}
-
-void QWindowsCEStyle::polish(QWidget *widget) {
- QWindowsStyle::polish(widget);
-}
-
-void QWindowsCEStyle::polish(QPalette &palette) {
- QWindowsStyle::polish(palette);
-}
-
-int QWindowsCEStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const {
- int ret;
-
- switch (pm) {
- case PM_DefaultFrameWidth:
- ret = 1;
- break;
-
- case PM_MenuBarHMargin:
- ret = 2;
- break;
- case PM_MenuBarVMargin:
- ret = 2;
- break;
- /*case PM_MenuBarItemSpacing:
- ret = 2;
- break;*/
-
- case PM_MenuButtonIndicator:
- ret = 10;
- break;
-
- case PM_SpinBoxFrameWidth:
- ret = 2;
- break;
- case PM_ButtonDefaultIndicator:
- case PM_ButtonShiftHorizontal:
- case PM_ButtonShiftVertical:
- ret = 1;
- break;
-#ifndef QT_NO_TABBAR
- case PM_TabBarTabShiftHorizontal:
- ret = 0;
- break;
- case PM_TabBarTabShiftVertical:
- ret = 6;
- break;
-#endif
- case PM_MaximumDragDistance:
- ret = 60;
- break;
-
- case PM_IndicatorWidth:
- ret = windowsCEIndicatorSize;
- break;
-
- case PM_IndicatorHeight:
- ret = windowsCEIndicatorSize;
- break;
-
- case PM_ExclusiveIndicatorWidth:
- ret = windowsCEExclusiveIndicatorSize;
- break;
-
- case PM_ExclusiveIndicatorHeight:
- ret = windowsCEExclusiveIndicatorSize;;
- break;
-
-#ifndef QT_NO_SLIDER
- case PM_SliderLength:
- ret = 12;
- break;
- case PM_SliderThickness:
- ret = windowsCESliderThickness;
- break;
-
- case PM_TabBarScrollButtonWidth:
- ret = 18;
- break;
-
- // Returns the number of pixels to use for the business part of the
- // slider (i.e., the non-tickmark portion). The remaining space is shared
- // equally between the tickmark regions.
- case PM_SliderControlThickness:
- if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
- int ticks = sl->tickPosition;
- int n = 0;
- if (ticks & QSlider::TicksAbove)
- ++n;
- if (ticks & QSlider::TicksBelow)
- ++n;
- if (!n) {
- ret = space;
- break;
- }
- int thick = 12;
- if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
- thick += pixelMetric(PM_SliderLength, sl, widget) / 4;
-
- space -= thick;
- if (space > 0)
- thick += (space * 2) / (n + 2);
- ret = thick;
- } else {
- ret = 0;
- }
- break;
-#endif // QT_NO_SLIDER
-
-#ifndef QT_NO_MENU
-
- case PM_SmallIconSize:
- ret = windowsCEIconSize;
- break;
- case PM_ButtonMargin:
- ret = 6;
- break;
-
- case PM_LargeIconSize:
- ret = 32;
- break;
-
- case PM_IconViewIconSize:
- ret = pixelMetric(PM_LargeIconSize, opt, widget);
- break;
-
- case PM_ToolBarIconSize:
- ret = windowsCEIconSize;
- break;
- case PM_DockWidgetTitleMargin:
- ret = 2;
- break;
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
-// case PM_DockWidgetFrameWidth:
-// ret = GetSystemMetrics(SM_CXFRAME);
-// break;
-#else
- case PM_DockWidgetFrameWidth:
- ret = 4;
- break;
-#endif // Q_DEAD_CODE_FROM_QT4_WIN
- break;
-
-#endif // QT_NO_MENU
-
- case PM_TitleBarHeight:
- ret = 30;
- break;
- case PM_ScrollBarExtent:
- ret = 19;
- break;
- case PM_SplitterWidth:
- ret = qMax(4, QApplication::globalStrut().width());
- break;
-
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
- case PM_MDIFrameWidth:
- ret = 3;
- break;
-#endif
- case PM_ToolBarItemMargin:
- ret = 1;
- break;
- case PM_ToolBarItemSpacing:
- ret = 0;
- break;
- case PM_ToolBarHandleExtent:
- ret = 10;
- break;
- case PM_ButtonIconSize:
- ret = 22;
- break;
- default:
- ret = QWindowsStyle::pixelMetric(pm, opt, widget);
- break;
- }
- return ret;
-}
-
-QPixmap QWindowsCEStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
- const QWidget *widget) const {
-#ifndef QT_NO_IMAGEFORMAT_XPM
- /*switch (standardPixmap) {
-
- default:
- break;
- }*/
-#endif //QT_NO_IMAGEFORMAT_XPM
- return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
-}
-
-int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget,
- QStyleHintReturn *returnData) const {
- int ret;
- switch (hint) {
- case SH_TabBar_ElideMode:
- ret = Qt::ElideMiddle;
- break;
- case SH_EtchDisabledText:
- ret = false;
- break;
- case SH_RequestSoftwareInputPanel:
- ret = RSIP_OnMouseClick;
- break;
- default:
- ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
- break;
- }
- return ret;
-}
-
-void QWindowsCEStylePrivate::drawWinShades(QPainter *p,
- int x, int y, int w, int h,
- const QColor &c1, const QColor &c2,
- const QColor &c3, const QColor &c4,
- const QBrush *fill) {
- if (w < 2 || h < 2) // can't do anything with that
- return;
- QPen oldPen = p->pen();
- QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) };
- p->setPen(c1);
- p->drawPolyline(a, 3);
- QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) };
- p->setPen(c2);
- p->drawPolyline(b, 3);
- if (w > 4 && h > 4) {
- QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) };
- p->setPen(c3);
- p->drawPolyline(c, 3);
- QPoint d[3] = { QPoint(x+1, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y+1) };
- p->setPen(c4);
- p->drawPolyline(d, 3);
- if (fill)
- p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
- }
- p->setPen(oldPen);
-}
-
-void QWindowsCEStylePrivate::drawWinCEShades(QPainter *p,
- int x, int y, int w, int h,
- const QColor &c1, const QColor &c2,
- const QColor &c3, const QColor &c4,
- const QBrush *fill) {
- if (w < 2 || h < 2) // can't do anything with that
- return;
- QPen oldPen = p->pen();
- QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) };
- p->setPen(c2);
- p->drawPolyline(b, 3);
- if (w > 4 && h > 4) {
- QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) };
- p->setPen(c3);
- p->drawPolyline(c, 3);
- QPoint d[5] = { QPoint(x, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y), QPoint(x, y), QPoint(x, y+h-2) };
- p->setPen(c4);
- p->drawPolyline(d, 5);
- if (fill)
- p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
- }
- QPoint a[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) };
- p->setPen(c1);
- p->drawPolyline(a, 3);
- p->setPen(oldPen);
-}
-
-void QWindowsCEStylePrivate::drawWinCEShadesSunken(QPainter *p,
- int x, int y, int w, int h,
- const QColor &c1, const QColor &c2,
- const QColor &c3, const QColor &c4,
- const QBrush *fill) {
- if (w < 2 || h < 2) // can't do anything with that
- return;
- QPen oldPen = p->pen();
-
- QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) };
- p->setPen(c2);
- p->drawPolyline(b, 3);
- if (w > 4 && h > 4) {
- QPoint d[3] = { QPoint(x, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y) };
- p->setPen(c4);
- p->drawPolyline(d, 3);
- QPoint c[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) };
- p->setPen(c3);
- p->drawPolyline(c, 3);
- if (fill)
- p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
- }
- QPoint a[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) };
- p->setPen(c1);
- p->drawPolyline(a, 3);
- p->setPen(oldPen);
-}
-
-
-void QWindowsCEStylePrivate::drawWinCEButton(QPainter *p, int x, int y, int w, int h,
- const QPalette &pal, bool sunken,
- const QBrush *fill) {
- if (sunken)
- drawWinCEShadesSunken(p, x, y, w, h,
- pal.shadow().color(), pal.light().color(), pal.shadow().color(),
- pal.midlight().color(), fill);
- else
- drawWinCEShades(p, x, y, w, h,
- pal.midlight().color(), pal.shadow().color(), pal.button().color(),
- pal.dark().color(), fill);
-}
-
-void QWindowsCEStylePrivate::drawWinCEPanel(QPainter *p, int x, int y, int w, int h,
- const QPalette &pal, bool sunken,
- const QBrush *fill) {
- if (sunken)
- drawWinShades(p, x, y, w, h,
- pal.dark().color(), pal.light().color(), pal.shadow().color(),
- pal.midlight().color(), fill);
- else
- drawWinShades(p, x, y, w, h,
- pal.light().color(), pal.shadow().color(), pal.button().color(),
- pal.midlight().color(), fill);
-}
-
-void QWindowsCEStylePrivate::drawWinCEButton(QPainter *p, const QRect &r,
- const QPalette &pal, bool sunken, const QBrush *fill) {
- drawWinCEButton(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill);
-}
-
-void QWindowsCEStylePrivate::drawWinCEPanel(QPainter *p, const QRect &r,
- const QPalette &pal, bool sunken, const QBrush *fill) {
- drawWinCEPanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_WINDOWSCE
diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h
deleted file mode 100644
index 1530fdcf0f..0000000000
--- a/src/widgets/styles/qwindowscestyle_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSCESTYLE_P_H
-#define QWINDOWSCESTYLE_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 <private/qwindowsstyle_p.h>
-
-QT_BEGIN_NAMESPACE
-
-
-#if !defined(QT_NO_STYLE_WINDOWSCE)
-
-class QWindowsCEStyle : public QWindowsStyle
-{
- Q_OBJECT
-public:
- QWindowsCEStyle();
- ~QWindowsCEStyle();
-
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget = 0) const;
-
- void drawControl(ControlElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
-
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const;
-
- virtual void drawItemText(QPainter *painter, const QRect &rect,
- int flags, const QPalette &pal, bool enabled,
- const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
-
- QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const;
-
- QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
- QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget) const;
-
- SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- const QPoint &pos, const QWidget *widget = 0) const;
-
- QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
- const QWidget *widget = 0) const;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
-
- int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const;
-
- void polish(QWidget *widget);
- void polish(QPalette &palette);
- void polish(QApplication *app);
- QPalette standardPalette() const;
-};
-
-#endif // QT_NO_STYLE_WINDOWSCE
-
-QT_END_NAMESPACE
-
-#endif // QWINDOWSCESTYLE_P_H
diff --git a/src/widgets/styles/qwindowscestyle_p_p.h b/src/widgets/styles/qwindowscestyle_p_p.h
deleted file mode 100644
index 2920413287..0000000000
--- a/src/widgets/styles/qwindowscestyle_p_p.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSCESTYLE_P_P_H
-#define QWINDOWSCESTYLE_P_P_H
-
-#include "qwindowscestyle_p.h"
-#include <private/qwindowsstyle_p_p.h>
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
-// file may change from version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_NAMESPACE
-
-class QPainter;
-class QPalette;
-class QPoint;
-class QColor;
-class QBrush;
-class QRect;
-
-// Private class
-class QWindowsCEStylePrivate : public QWindowsStylePrivate
-{
- Q_DECLARE_PUBLIC(QWindowsCEStyle)
-public:
- inline QWindowsCEStylePrivate()
- { }
-
-
-static void drawWinCEButton(QPainter *p, int x, int y, int w, int h,
- const QPalette &pal, bool sunken = false,
- const QBrush *fill = 0);
-
-static void drawWinCEButton(QPainter *p, const QRect &r,
- const QPalette &pal, bool sunken = false,
- const QBrush *fill = 0);
-
-static void drawWinCEPanel(QPainter *p, int x, int y, int w, int h,
- const QPalette &pal, bool sunken = false,
- const QBrush *fill = 0);
-
-static void drawWinCEPanel(QPainter *p, const QRect &r,
- const QPalette &pal, bool sunken = false,
- const QBrush *fill = 0);
-
-static void drawWinShades(QPainter *p,
- int x, int y, int w, int h,
- const QColor &c1, const QColor &c2,
- const QColor &c3, const QColor &c4,
- const QBrush *fill);
-
-static void drawWinCEShades(QPainter *p,
- int x, int y, int w, int h,
- const QColor &c1, const QColor &c2,
- const QColor &c3, const QColor &c4,
- const QBrush *fill);
-
-static void drawWinCEShadesSunken(QPainter *p,
- int x, int y, int w, int h,
- const QColor &c1, const QColor &c2,
- const QColor &c3, const QColor &c4,
- const QBrush *fill);
-
-
-
-
-};
-
-QT_END_NAMESPACE
-
-#endif //QWINDOWSCESTYLE_P_P_H
diff --git a/src/widgets/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp
deleted file mode 100644
index e1609e040c..0000000000
--- a/src/widgets/styles/qwindowsmobilestyle.cpp
+++ /dev/null
@@ -1,7272 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindowsmobilestyle_p.h"
-#include "qwindowsmobilestyle_p_p.h"
-
-#if !defined(QT_NO_STYLE_WINDOWSMOBILE) || defined(QT_PLUGIN)
-
-#include "qpainterpath.h"
-#include "qapplication.h"
-#include "qdesktopwidget.h"
-#include "qwidget.h"
-#include "qdockwidget.h"
-#include "qframe.h"
-#include "qmenu.h"
-#include "qpaintengine.h"
-#include "qpainter.h"
-#include "qgroupbox.h"
-#include "qstyleoption.h"
-#include "qlistview.h"
-#include "qdrawutil.h"
-#include "qtoolbar.h"
-#include "qabstractscrollarea.h"
-#include "qabstractbutton.h"
-#include "qcombobox.h"
-#include "qscrollbar.h"
-#include "qabstractitemview.h"
-#include "qmenubar.h"
-#include "qtoolbutton.h"
-#include "qtextedit.h"
-#include "qdialog.h"
-#include "qdebug.h"
-#include "qtabwidget.h"
-
-#ifdef Q_OS_WINCE
-#include "qt_windows.h"
-extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp
-#endif // Q_OS_WINCE
-
-#include "qstylehelper_p.h"
-
-QT_BEGIN_NAMESPACE
-
-static const int windowsItemFrame = 1; // menu item frame width
-
-static const int windowsMobileitemViewCheckBoxSize = 13;
-static const int windowsMobileFrameGroupBoxOffset = 9;
-static const int windowsMobileIndicatorSize = 14;
-static const int windowsMobileExclusiveIndicatorSize = 14;
-static const int windowsMobileSliderThickness = 6;
-static const int windowsMobileIconSize = 16;
-static const int PE_IndicatorArrowUpBig = 0xf000101;
-static const int PE_IndicatorArrowDownBig = 0xf000102;
-static const int PE_IndicatorArrowLeftBig = 0xf000103;
-static const int PE_IndicatorArrowRightBig = 0xf000104;
-
-/* XPM */
-static const char *const radiobutton_xpm[] = {
- "30 30 2 1",
- " c None",
- ". c #000000",
- " ........ ",
- " .............. ",
- " .... .... ",
- " .... .... ",
- " ... ... ",
- " ... ... ",
- " .. .. ",
- " .. .. ",
- " ... ... ",
- " .. .. ",
- " .. .. ",
- ".. ..",
- ".. ..",
- ".. ..",
- ".. ..",
- ".. ..",
- ".. ..",
- ".. ..",
- ".. ..",
- " .. .. ",
- " .. .. ",
- " ... ... ",
- " .. .. ",
- " .. .. ",
- " ... ... ",
- " ... ... ",
- " .... .... ",
- " .... .... ",
- " .............. ",
- " ........ "};
-
-/* XPM */
-static const char * const radiobutton_low_xpm[] = {
- "15 15 2 1",
- " c None",
- ". c #000000",
- " ..... ",
- " .. .. ",
- " . . ",
- " . . ",
- " . . ",
- ". .",
- ". .",
- ". .",
- ". .",
- ". .",
- " . . ",
- " . . ",
- " . . ",
- " .. .. ",
- " ..... "};
-
-/* XPM */
- static const char * const arrowleft_big_xpm[] = {
- "9 17 2 1",
- " c None",
- ". c #000000",
- " .",
- " ..",
- " ...",
- " ....",
- " .....",
- " ......",
- " .......",
- " ........",
- ".........",
- " ........",
- " .......",
- " ......",
- " .....",
- " ....",
- " ...",
- " ..",
- " ."};
-
-/* XPM */
- static const char * const arrowleft_xpm[] = {
- "8 15 2 1",
- " c None",
- ". c #000000",
- " .",
- " ..",
- " ...",
- " ....",
- " .....",
- " ......",
- " .......",
- "........",
- " .......",
- " ......",
- " .....",
- " ....",
- " ...",
- " ..",
- " ."};
-
-
-
-/* XPM */
-static const char *const horlines_xpm[] = {
- "2 2 2 1",
- " c None",
- ". c #000000",
- " ",
- ".."};
-
-/* XPM */
-static const char *const vertlines_xpm[] = {
- "2 2 2 1",
- " c None",
- ". c #000000",
- ". ",
- ". "};
-
-/* XPM */
-static const char *const radiochecked_xpm[] = {
- "18 18 2 1",
- " c None",
- ". c #000000",
- " ...... ",
- " .......... ",
- " .............. ",
- " .............. ",
- " ................ ",
- " ................ ",
- "..................",
- "..................",
- "..................",
- "..................",
- "..................",
- "..................",
- " ................ ",
- " ................ ",
- " .............. ",
- " .............. ",
- " .......... ",
- " ...... "};
-
-/* XPM */
-static const char * const radiochecked_low_xpm[] = {
- "9 9 2 1",
- " c None",
- ". c #000000",
- " ... ",
- " ....... ",
- " ....... ",
- ".........",
- ".........",
- ".........",
- " ....... ",
- " ....... ",
- " ... "};
-
-static const char *const arrowdown_xpm[] = {
- "15 8 2 1",
- " c None",
- ". c #000000",
- "...............",
- " ............. ",
- " ........... ",
- " ......... ",
- " ....... ",
- " ..... ",
- " ... ",
- " . "};
-
-
-static const char *const arrowdown_big_xpm[] = {
- "17 9 2 1",
- " c None",
- ". c #000000",
- ".................",
- " ............... ",
- " ............. ",
- " ........... ",
- " ......... ",
- " ....... ",
- " ..... ",
- " ... ",
- " . "};
-
-
-/* XPM */
-static const char *const checkedlight_xpm[] = {
- "24 24 2 1",
- " c None",
- ". c #000000",
- " ",
- " ",
- " ",
- " ",
- " ",
- " . ",
- " .. ",
- " ... ",
- " .... ",
- " ..... ",
- " ...... ",
- " . ...... ",
- " .. ...... ",
- " ... ...... ",
- " .... ...... ",
- " .......... ",
- " ......... ",
- " ....... ",
- " ..... ",
- " ... ",
- " . ",
- " ",
- " ",
- " "};
-
-
-/* XPM */
-static const char *const checkedbold_xpm[] = {
- "26 26 2 1",
- " c None",
- ". c #000000",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " .. ",
- " ... ",
- " .... ",
- " ..... ",
- " .. ...... ",
- " ... ....... ",
- " .... ....... ",
- " ..... ....... ",
- " ...... ....... ",
- " .............. ",
- " ............ ",
- " .......... ",
- " ........ ",
- " ...... ",
- " .... ",
- " .. ",
- " ",
- " ",
- " ",
- " "};
-
-/* XPM */
-static const char * const checkedbold_low_xpm[] = {
- "9 8 2 1",
- " c None",
- ". c #000000",
- " .",
- " ..",
- ". ...",
- ".. ... ",
- "... ... ",
- " ..... ",
- " ... ",
- " . "};
-
-/* XPM */
-static const char * const checkedlight_low_xpm[] = {
- "8 8 2 1",
- " c None",
- ". c #000000",
- " .",
- " ..",
- " ...",
- ". ... ",
- ".. ... ",
- "..... ",
- " ... ",
- " . "};
-
-/* XPM */
-static const char * const highlightedradiobutton_xpm[] = {
- "30 30 3 1",
- " c None",
- ". c #000000",
- "+ c #0078CC",
- " ........ ",
- " .............. ",
- " ....++++++++.... ",
- " ....++++++++++++.... ",
- " ...++++ ++++... ",
- " ...+++ +++... ",
- " ..++ ++.. ",
- " ..++ ++.. ",
- " ...++ ++... ",
- " ..++ ++.. ",
- " ..++ ++.. ",
- "..++ ++..",
- "..++ ++..",
- "..++ ++..",
- "..++ ++..",
- "..++ ++..",
- "..++ ++..",
- "..++ ++..",
- "..++ ++..",
- " ..++ ++.. ",
- " ..++ ++.. ",
- " ...++ ++... ",
- " ..++ ++.. ",
- " ..++ ++.. ",
- " ...+++ +++... ",
- " ...++++ ++++... ",
- " ....++++++++++++.... ",
- " ....++++++++.... ",
- " .............. ",
- " ........ "};
-
-/* XPM */
-static const char * const highlightedradiobutton_low_xpm[] = {
- "15 15 3 1",
- " c None",
- ". c #000000",
- "+ c #3192D6",
- " ..... ",
- " ..+++++.. ",
- " .++ ++. ",
- " .+ +. ",
- " .+ +. ",
- ".+ +.",
- ".+ +.",
- ".+ +.",
- ".+ +.",
- ".+ +.",
- " .+ +. ",
- " .+ +. ",
- " .++ ++. ",
- " ..+++++.. ",
- " ..... "};
-
-/* XPM */
-static const char * const cross_big_xpm[] = {
-"28 28 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FDFFFC",
-" ",
-" ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++..@@@..........@@@..++ ",
-" ++..@@@@........@@@@..++ ",
-" ++..@@@@@......@@@@@..++ ",
-" ++...@@@@@....@@@@@...++ ",
-" ++....@@@@@..@@@@@....++ ",
-" ++.....@@@@@@@@@@.....++ ",
-" ++......@@@@@@@@......++ ",
-" ++.......@@@@@@.......++ ",
-" ++.......@@@@@@.......++ ",
-" ++......@@@@@@@@......++ ",
-" ++.....@@@@@@@@@@.....++ ",
-" ++....@@@@@..@@@@@....++ ",
-" ++...@@@@@....@@@@@...++ ",
-" ++..@@@@@......@@@@@..++ ",
-" ++..@@@@........@@@@..++ ",
-" ++..@@@..........@@@..++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ",
-" "};
-
-/* XPM */
-static const char * const cross_small_xpm[] = {
-"14 14 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FCFFFC",
-" ",
-" ++++++++++++ ",
-" +..........+ ",
-" +.@@....@@.+ ",
-" +.@@@..@@@.+ ",
-" +..@@@@@@..+ ",
-" +...@@@@...+ ",
-" +...@@@@...+ ",
-" +..@@@@@@..+ ",
-" +.@@@..@@@.+ ",
-" +.@@....@@.+ ",
-" +..........+ ",
-" ++++++++++++ ",
-" "};
-
-/* XPM */
-static const char * const max_big_xpm[] = {
-"28 28 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FDFFFC",
-" ",
-" ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ",
-" "};
-
-/* XPM */
-static const char * const max_small_xpm[] = {
-"14 14 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FCFFFC",
-" ",
-" ++++++++++++ ",
-" +..........+ ",
-" +..........+ ",
-" +.@@@@@@@@.+ ",
-" +.@@@@@@@@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@@@@@@@@.+ ",
-" +..........+ ",
-" +..........+ ",
-" ++++++++++++ ",
-" "};
-
-/* XPM */
-static const char * const normal_big_xpm[] = {
-"28 28 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FDFFFC",
-" ",
-" ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@............@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ",
-" "};
-
-/* XPM */
-static const char * const normal_small_xpm[] = {
-"14 14 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FCFFFC",
-" ",
-" ++++++++++++ ",
-" +..........+ ",
-" +.@@@@@@@@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@......@.+ ",
-" +.@@@@@@@@.+ ",
-" +..........+ ",
-" ++++++++++++ ",
-" "};
-
-
-/* XPM */
-static const char * const min_big_xpm[] = {
-"28 28 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FDFFFC",
-" ",
-" ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++..@@@@@@@@@@@@@@@@..++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++....................++ ",
-" ++++++++++++++++++++++++ ",
-" ++++++++++++++++++++++++ ",
-" ",
-" "};
-
-/* XPM */
-static const char * const min_small_xpm[] = {
-"14 14 4 1",
-" c #09454A",
-". c #218C98",
-"+ c #47D8E5",
-"@ c #FCFFFC",
-" ",
-" ++++++++++++ ",
-" +..........+ ",
-" +..........+ ",
-" +..........+ ",
-" +..........+ ",
-" +..........+ ",
-" +..........+ ",
-" +..........+ ",
-" +.@@@@@@@@.+ ",
-" +..........+ ",
-" +..........+ ",
-" ++++++++++++ ",
-" "};
-
-#ifdef Q_OS_WINCE_WM
-
-static char * sbhandleup_xpm[] = {
-"26 41 45 1",
-" c None",
-". c #000000",
-"+ c #E7E7E7",
-"@ c #D6D7D6",
-"# c #949294",
-"$ c #737573",
-"% c #636563",
-"& c #636163",
-"* c #5A5D5A",
-"= c #5A595A",
-"- c #525552",
-"; c #525152",
-"> c #4A4D4A",
-", c #7B797B",
-"' c #CECFCE",
-") c #CED3CE",
-"! c #6B6D6B",
-"~ c #6B696B",
-"{ c #737173",
-"] c #7B7D7B",
-"^ c #848684",
-"/ c #848284",
-"( c #8C8A8C",
-"_ c #8C8E8C",
-": c #B5B2B5",
-"< c #FFFFFF",
-"[ c #949694",
-"} c #B5B6B5",
-"| c #9C9A9C",
-"1 c #ADAEAD",
-"2 c #9C9E9C",
-"3 c #BDBABD",
-"4 c #BDBEBD",
-"5 c #F7F3F7",
-"6 c #C6C3C6",
-"7 c #C6C7C6",
-"8 c #A5A2A5",
-"9 c #CECBCE",
-"0 c #FFFBFF",
-"a c #ADAAAD",
-"b c #A5A6A5",
-"c c #D6D3D6",
-"d c #B5BAB5",
-"e c #DEDFDE",
-"f c #DEDBDE",
-"..........................",
-"+@#$%%&&&**===---;;;;>=,'+",
-"+@#$%%&&&**===---;;;;>=$'+",
-")$!!~~%%&&&**===---;;;;>;'",
-"#{$]],,$${{{!!~~%%%&&&*-;]",
-"#{$]],,$${{{!!~~%%%&&&*-;]",
-",$^//]],,$${{{!!~~%%%&&*;*",
-",,(^^//]],$${!!!!!~~%%%&-*",
-",,(^^//]],$${!!!!!~~%%%&-*",
-"]]_((^^//]$!%%~!{{!!~~%%-*",
-"//#__((^^]{:<<:~!{{{!!~~=*",
-"//#__((^^]{:<<:~!{{{!!~~=&",
-"//###__(/$:<<<<:~{${{!!~*&",
-"^^[[##_^]:<<<<<<}!{$${{!*%",
-"^^[[##_^]:<<<<<<}!{$${{!*%",
-"((|[[#_/:<<<<<<<<}!$$${{&~",
-"((||[#^1<<<<1:<<<<}!$$$$&~",
-"((||[#^1<<<<1:<<<<}!$$$$&~",
-"__2|#(1<<<<}],}<<<<}{$,$%~",
-"##2|_1<<<<}^((]3<<<<}{$,~!",
-"##2|_1<<<<}^((]3<<<<}{$,~!",
-"##2#1<<<<3^###(/4<<<<}{,~{",
-"##2#1<<<<3^###(/4<<<<}{,~!",
-"[[2_5<<<4(#|[[#_/6<<<<,,!{",
-"[|2_5<<4_[||||[[_/7<<<,]{$",
-"[|2_5<<4_[||||[[_/7<<<,]{$",
-"||8_5<6#|2222|||[_/9<<,]{$",
-"228#06[28888222||[_/'<,/$,",
-"228#06[28888222||[_/'<,/$,",
-"22a|6[8bbbb88822||[(/c](,]",
-"881b8baaabbbb88222|[(^(_,]",
-"881b8baaabbbb88222|[(^(_,]",
-"88111111aaabbb88822|[###]/",
-"bb:::11111aaabbb8822||[[/^",
-"bb:::11111aaabbb8822||[[//",
-"bb:::::1111aaabbb8822||[/(",
-"3a1::::::1111aaabb8822|_^8",
-"da1::::::1111aaabb8822|_^8",
-"e1aaabbbb888822||[[##__((@",
-"+e4:aaabbbb88822||[[[#[b@+",
-"+e4:aaabbbb88822||[[[#[bf+"};
-
-static char * sbhandledown_xpm[] = {
-"26 40 46 1",
-" c None",
-". c #E7E7E7",
-"+ c #DEDFDE",
-"@ c #BDBEBD",
-"# c #B5B2B5",
-"$ c #ADAAAD",
-"% c #A5A6A5",
-"& c #A5A2A5",
-"* c #9C9E9C",
-"= c #9C9A9C",
-"- c #949694",
-"; c #949294",
-"> c #D6D7D6",
-", c #DEDBDE",
-"' c #D6DBD6",
-") c #ADAEAD",
-"! c #8C8E8C",
-"~ c #8C8A8C",
-"{ c #BDBABD",
-"] c #848684",
-"^ c #B5BAB5",
-"/ c #848284",
-"( c #848A84",
-"_ c #7B7D7B",
-": c #7B797B",
-"< c #C6C3C6",
-"[ c #D6D3D6",
-"} c #FFFBFF",
-"| c #CECFCE",
-"1 c #FFFFFF",
-"2 c #737573",
-"3 c #F7F3F7",
-"4 c #CECBCE",
-"5 c #737173",
-"6 c #C6C7C6",
-"7 c #6B6D6B",
-"8 c #B5B6B5",
-"9 c #6B696B",
-"0 c #636563",
-"a c #636163",
-"b c #5A5D5A",
-"c c #5A595A",
-"d c #525552",
-"e c #525152",
-"f c #4A4D4A",
-"g c #C6CBC6",
-".+@#$$$%%%%&&&**==---;-%>.",
-".+@#$$$%%%%&&&**==---;-%,.",
-"')$$$%%%%&&&&**==--;;!!~~>",
-"{$)######))))$$$%%&&**=!]&",
-"^$)######))))$$$%%&&**=!]&",
-"%%#####))))$$$%%%&&**==-/(",
-"%%###)))))$$$%%%&&**==--/]",
-"%%###)))))$$$%%%&&**==--//",
-"&&))))))$$$%%%&&&**=-;;;_/",
-"&&)%&%$$$%%%%&&***=-~]~!:_",
-"&&)%&%$$$%%%%&&***=-~]~!:_",
-"**$=<-&%%%%&&&**==-~/[_~:_",
-"**&;}<-*&&&&***==-!/|1:/2:",
-"**&;}<-*&&&&***==-!/|1:/2:",
-"==&!31<;=****===-!/411:_5:",
-"-=*!311@!-====--!/6111:_52",
-"-=*!311@!-====--!/6111:_52",
-"--*!3111@~;=--;!/<1111::75",
-";;*;)1111{];;;~/@111185:95",
-";;*;)1111{];;;~/@111185:97",
-";;*=!)11118]~~_{1111852:97",
-";;*=!)11118]~~_{1111852:97",
-"!!*=;~)11118_:81111852:207",
-"~~==-;])1111)#1111872222a9",
-"~~==-;])1111)#1111872222a9",
-"~~=--;!/#111111118722255a0",
-"]]--;;!]_#11111187522557b0",
-"]]--;;!]_#11111187522557b0",
-"//;;;!!~/2#1111#95255779ba",
-"//;!!~~]]_5#11#975557799cb",
-"//;!!~~]]_5#11#975557799ca",
-"__!~~]]//_27009755779900db",
-"::~]]//__:2257777799000adb",
-"::~]]//__:2257777799000adb",
-":2]//__::225557799000aabeb",
-";52__::225557799000aaabde_",
-";52__::225557799000aaabde_",
-"[2779900aaabbcccdddeeeefeg",
-".>;200aaabbcccdddeeeefc:|.",
-".>;200aaabbcccdddeeeefc2|."};
-
-static char * sbgripdown_xpm[] = {
-"26 34 39 1",
-" c None",
-". c #949294",
-"+ c #9C9E9C",
-"@ c #9C9A9C",
-"# c #949694",
-"$ c #8C8E8C",
-"% c #8C8A8C",
-"& c #848684",
-"* c #848284",
-"= c #7B7D7B",
-"- c #7B797B",
-"; c #6B696B",
-"> c #636563",
-", c #737573",
-"' c #636163",
-") c #737173",
-"! c #5A5D5A",
-"~ c #6B6D6B",
-"{ c #5A595A",
-"] c #B5B6B5",
-"^ c #BDBEBD",
-"/ c #ADAEAD",
-"( c #BDBABD",
-"_ c #525552",
-": c #313031",
-"< c #525152",
-"[ c #ADAAAD",
-"} c #BDBAB5",
-"| c #4A4D4A",
-"1 c #4A494A",
-"2 c #C6C3C6",
-"3 c #C6CBC6",
-"4 c #E7E7E7",
-"5 c #DEDFDE",
-"6 c #E7E3E7",
-"7 c #DEE3DE",
-"8 c #CECBCE",
-"9 c #8C928C",
-"0 c #CECFCE",
-"..+++@@@###...$$%&&**==-;>",
-"$.++@@@@##...$$%%&**==-->>",
-"$$+@@@@###..$$%%&&*==--,>>",
-"$$@@@@###..$$%%&&**==-,,>'",
-"%%@@@###..$$$%&&**==--,,''",
-"%%@@###..$$$%&&**==--,,)''",
-"%%@###...$$%%&&*==--,,))'!",
-"&&###...$$%%&&**==--,)))!!",
-"&&##...$$%%&&**==--,,))~!!",
-"&&#...$$%%&&**==--,,))~~!{",
-"**...$$%%&&**==--,,))~~;!{",
-"**..$$%%&&**===--,)))~~;{{",
-"**.$$%%&]^&===//,,))~~;;{{",
-"==$$%%&&]^*==-((,))~~;;>{_",
-"==$%%&&***::--,,::~~;;;>__",
-"==%%&&&**=::-,,)::~~;;>>__",
-"--%&&&**==--,,)))~~;;>>>__",
-"--&&&**==--,,)))~~;;>>>'_<",
-",-&&**==]^-,))[[~;;>>>''<<",
-",,&**==-]^-)))}};;>>>'''<<",
-",,**==--,,::)~~;::>>'''!<<",
-"))*==--,,)::~~;;::>'''!!<|",
-"))==--,,)))~~;;;>>'''!!!||",
-"))=--,,)))~~;;;>>'''!!!{||",
-"~~--,,)))~~;;;>>'''!!!{{||",
-"~~-,,)))~~;;>>>'''!!!{{{|1",
-";;,,)))~~;;>>>'''!!!{{{_1<",
-"~;,)))~~;;>>>'''!!!{{{__1'",
-"%>~))~~;;>>>'''!!!{{{__|1$",
-"2>>~~~;;>>>''!!!{{{{__<113",
-"4%'';;;>>>''!!!{{{{__<11%4",
-"45-!!'>>>''!!!{{{{_<|11)64",
-"447+!{{___<<<||||1111|+444",
-"444489~__<<<||||111>$04444"};
-
-static char * sbgripup_xpm[] = {
-"26 34 38 1",
-" c None",
-". c #E7E7E7",
-"+ c #D6DBD6",
-"@ c #C6C7C6",
-"# c #B5B6B5",
-"$ c #ADAEAD",
-"% c #ADAAAD",
-"& c #A5A6A5",
-"* c #A5A2A5",
-"= c #BDBEBD",
-"- c #DEDFDE",
-"; c #C6CBC6",
-"> c #9C9E9C",
-", c #E7E3E7",
-"' c #BDBABD",
-") c #B5B2B5",
-"! c #9C9A9C",
-"~ c #DEE3DE",
-"{ c #949694",
-"] c #D6D7D6",
-"^ c #949294",
-"/ c #DEDBDE",
-"( c #8C8E8C",
-"_ c #8C8A8C",
-": c #848684",
-"< c #D6D3CE",
-"[ c #CECBCE",
-"} c #D6D3D6",
-"| c #848284",
-"1 c #313031",
-"2 c #7B7D7B",
-"3 c #CECFCE",
-"4 c #CECBC6",
-"5 c #7B797B",
-"6 c #737573",
-"7 c #737173",
-"8 c #6B6D6B",
-"9 c #6B696B",
-"....+@#$$%%%%&&&***$=-....",
-"...;$$$$$%%%&&&&**>>>>@...",
-".,'$$)#'#####)))$$$%*!!$~.",
-".=$)#'''####))))$$$%%*!{'.",
-"]$$''''#####)))$$$%%%&*{^/",
-"=$#'''#####)))$$$$%%&&&!^#",
-"$$'''#####))))$$$%%%&&*>(!",
-"$$''#####))))$$$%%%&&&*>(^",
-"$$######))))$$$$%%&&&**>(_",
-"%$#####))))$$$$%%%&&***>__",
-"%$####))))$$$$%%%&&&**>>__",
-"%%###)))))$$$%%%&&&**>>>_:",
-"%%##))))<])$$%[[&&***>>!::",
-"%%#)))))<]$$%%}<&&**>>!!:|",
-"&%)))))$$$11%%&&11*>>>!!:|",
-"&&))))$$$$11%&&&11*>>!!{||",
-"&&)))$$$$$%%%&&&**>>!!!{|2",
-"&&))$$$$$%%%&&&**>>>!!{{|2",
-"*&)$$$$$3]%&&&4@*>>!!{{{22",
-"**$$$$$%3]%&&&<<>>!!!{{^25",
-"**$$$$%%%%11&**>11!!{{^^25",
-"**$$$%%%%&11***>11!!{{^^55",
-"**$$%%%%&&&***>>!!!{{^^(55",
-">>$%%%%&&&***>>>!!{{^^((56",
-">>%%%%&&&&***>>!!!{{^^((66",
-">>%%%&&&&***>>!!!{{^^((_67",
-"!>%%&&&&***>>>!!{{{^^(__67",
-"!!%&&&&***>>>!!!{{^^((_:77",
-"!!&&&&***>>>!!!{{^^((__:77",
-"!!&&&****>>!!!{{^^^(__::78",
-"{!&&****>>>!!{{{^^((_::|88",
-"{{&****>>>!!!{{^^((__:||88",
-"{{****>>>!!!{{^^^(__::|289",
-"{{***>>>!!!{{{^^((_::||289"};
-
-static char * sbgripmiddle_xpm[] = {
-"26 2 12 1",
-" c None",
-". c #949294",
-"+ c #A5A2A5",
-"@ c #9C9E9C",
-"# c #9C9A9C",
-"$ c #949694",
-"% c #8C8E8C",
-"& c #8C8A8C",
-"* c #848684",
-"= c #848284",
-"- c #7B7D7B",
-"; c #6B696B",
-"..++@@@###$$$..%%&&*==--;;",
-"..++@@@###$$$..%%&&*==--;;"};
-
-
-static char * listviewhighmiddle_xpm[] = {
-"8 46 197 2",
-" c None",
-". c #66759E",
-"+ c #6C789D",
-"@ c #6A789E",
-"# c #6B789E",
-"$ c #6A779D",
-"% c #6C789C",
-"& c #6F7D9B",
-"* c #6F7D9A",
-"= c #9DB6EE",
-"- c #9DB6ED",
-"; c #9CB6ED",
-"> c #A1B6EF",
-", c #A2B6F0",
-"' c #93AAE9",
-") c #95ABEA",
-"! c #94ABEA",
-"~ c #94A9E8",
-"{ c #8BA8EA",
-"] c #8BA7EA",
-"^ c #8AA7EA",
-"/ c #8EAAE8",
-"( c #8FAAE8",
-"_ c #88A2E7",
-": c #8CA3E8",
-"< c #8BA3E7",
-"[ c #8BA3E8",
-"} c #8BA2E7",
-"| c #8CA2E7",
-"1 c #8DA2E7",
-"2 c #87A1E8",
-"3 c #87A1E9",
-"4 c #86A0E8",
-"5 c #86A1E7",
-"6 c #87A2E7",
-"7 c #859EE9",
-"8 c #849DE9",
-"9 c #869EE9",
-"0 c #869FE9",
-"a c #7C9BEA",
-"b c #7C9CEA",
-"c c #7B9CEA",
-"d c #7C9BE9",
-"e c #7E9CE9",
-"f c #7B9AEA",
-"g c #7C99E9",
-"h c #7C9AEA",
-"i c #7B9AE8",
-"j c #7A9AEA",
-"k c #7996E1",
-"l c #7C96E4",
-"m c #7B96E3",
-"n c #7B95E3",
-"o c #7E95E5",
-"p c #7E95E6",
-"q c #7292E1",
-"r c #7490DF",
-"s c #7591E0",
-"t c #7590DF",
-"u c #7392E1",
-"v c #6D8CDE",
-"w c #6F8EDD",
-"x c #6E8DDD",
-"y c #6E8DDE",
-"z c #6F8EDE",
-"A c #6E8EDE",
-"B c #718EDD",
-"C c #728EDD",
-"D c #6B89E0",
-"E c #6C89DF",
-"F c #6D89E0",
-"G c #6D89DF",
-"H c #6C88DF",
-"I c #6D88DF",
-"J c #6D86DD",
-"K c #6086E0",
-"L c #6686E0",
-"M c #6586E0",
-"N c #6486E0",
-"O c #6485E0",
-"P c #6786DF",
-"Q c #5F85E0",
-"R c #6583DE",
-"S c #6683DE",
-"T c #6682DD",
-"U c #6086DF",
-"V c #5F86E0",
-"W c #567ED7",
-"X c #567ED8",
-"Y c #557DD7",
-"Z c #5A7FD8",
-"` c #6281DA",
-" . c #5379D9",
-".. c #5278D9",
-"+. c #547BD8",
-"@. c #4C73D7",
-"#. c #4B72D2",
-"$. c #4C73D4",
-"%. c #4C73D3",
-"&. c #4B72D4",
-"*. c #4F75D3",
-"=. c #5074D2",
-"-. c #4971D0",
-";. c #4871D0",
-">. c #335ECF",
-",. c #325ECB",
-"'. c #335ECD",
-"). c #335ECE",
-"!. c #325DCD",
-"~. c #2E59C9",
-"{. c #3059C9",
-"]. c #2F59C9",
-"^. c #2F59C8",
-"/. c #2B59CA",
-"(. c #3355C6",
-"_. c #3354C5",
-":. c #3156C7",
-"<. c #3056C7",
-"[. c #3355C7",
-"}. c #3355C5",
-"|. c #254EBF",
-"1. c #1F51C1",
-"2. c #234FC0",
-"3. c #234FBF",
-"4. c #2350C0",
-"5. c #1E50BE",
-"6. c #1D50C0",
-"7. c #264DBE",
-"8. c #264CBD",
-"9. c #254DBE",
-"0. c #244EBF",
-"a. c #254DBF",
-"b. c #234CBF",
-"c. c #244CC0",
-"d. c #244BC0",
-"e. c #234BC0",
-"f. c #234BBF",
-"g. c #234CBE",
-"h. c #2049B7",
-"i. c #2A49B5",
-"j. c #2749B5",
-"k. c #2749B6",
-"l. c #2D49B4",
-"m. c #2649B6",
-"n. c #2946B5",
-"o. c #2A48B6",
-"p. c #2947B5",
-"q. c #2946B6",
-"r. c #2848B6",
-"s. c #2549B5",
-"t. c #2648B6",
-"u. c #2744B5",
-"v. c #2744B4",
-"w. c #2744AF",
-"x. c #2543B4",
-"y. c #2543B2",
-"z. c #2442B2",
-"A. c #2442B3",
-"B. c #2442B5",
-"C. c #2543B3",
-"D. c #1F40B1",
-"E. c #1E40B1",
-"F. c #243EAE",
-"G. c #273BAC",
-"H. c #263DAC",
-"I. c #253CAB",
-"J. c #273CAB",
-"K. c #273CAC",
-"L. c #263BAA",
-"M. c #253CAE",
-"N. c #263BA6",
-"O. c #253BA5",
-"P. c #253AA5",
-"Q. c #253BA6",
-"R. c #253CA7",
-"S. c #263AA6",
-"T. c #243CA6",
-"U. c #253CA5",
-"V. c #273BA8",
-"W. c #2F4DA4",
-"X. c #2F4DA3",
-"Y. c #1B2F85",
-"Z. c #B5B5B6",
-"`. c #B5B5B5",
-" + c #B5B6B6",
-".+ c #B5B4B6",
-"++ c #C2C3C5",
-"@+ c #C0C3C3",
-"#+ c #C1C3C4",
-"$+ c #E3E3E3",
-"%+ c #E3E3E4",
-"&+ c #E4E3E4",
-"*+ c #E2E3E4",
-"=+ c #ECEEEB",
-"-+ c #EBEDEA",
-";+ c #EEF0ED",
-">+ c #EFF0EE",
-". + @ @ # # $ % ",
-"& & * & & & & & ",
-"= = - = = ; > , ",
-"' ) ! ! ! ) ' ~ ",
-"{ ] { { { ^ / ( ",
-"_ : < [ : } | 1 ",
-"2 2 2 3 2 4 5 6 ",
-"7 7 7 7 7 8 9 0 ",
-"a b a a a c d e ",
-"f g h h h h i j ",
-"k l m m m n o p ",
-"q q q q q q q q ",
-"r r s s s t q u ",
-"v w x y z A B C ",
-"D E F F G F H I ",
-"J K L M N O P Q ",
-"R R S S S T U V ",
-"W W X X X Y Z ` ",
-" . . . . ...+.W ",
-" . . . . ..... .",
-"@.#.$.$.%.&.*.=.",
-"-.-.;.-.-.-.-.-.",
-">.,.'.).).!.!.>.",
-"~.{.].^.].^././.",
-"(.(.(.(.(._.:.<.",
-"(.(.[.[.[.[.(.}.",
-"|.1.2.3.3.4.5.6.",
-"7.7.7.7.7.8.9.0.",
-"a.b.c.d.c.e.f.g.",
-"h.i.j.k.j.k.l.m.",
-"n.o.p.q.r.p.s.t.",
-"u.u.v.u.u.u.u.u.",
-"w.x.y.z.A.y.B.C.",
-"D.D.E.D.D.D.D.D.",
-"D.D.E.D.D.D.D.D.",
-"F.G.H.I.J.K.L.M.",
-"N.N.O.N.N.P.Q.R.",
-"N.N.S.N.N.N.N.N.",
-"T.N.T.T.T.U.N.V.",
-"W.W.X.W.W.W.W.W.",
-"W.W.W.W.W.W.W.W.",
-"Y.Y.Y.Y.Y.Y.Y.Y.",
-"Z.`. + +.+Z.`.`.",
-"++@+#+#+#+#+@+@+",
-"$+%+&+&+*+%+%+%+",
-"=+-+;+-+-+>+-+-+"};
-
-
-
-static char * listviewhighcornerleft_xpm[] = {
-"100 46 1475 2",
-" c None",
-". c #FBFBFC",
-"+ c #E8EAE7",
-"@ c #758DC3",
-"# c #42599E",
-"$ c #28418A",
-"% c #19418F",
-"& c #3F5695",
-"* c #415896",
-"= c #435A98",
-"- c #445C99",
-"; c #465E9B",
-"> c #48609B",
-", c #49629C",
-"' c #4A639D",
-") c #49639D",
-"! c #4A629D",
-"~ c #4B639D",
-"{ c #4B649D",
-"] c #4C659D",
-"^ c #4D669D",
-"/ c #4E689D",
-"( c #506A9D",
-"_ c #516A9D",
-": c #536B9C",
-"< c #546C9C",
-"[ c #566D9B",
-"} c #576D9B",
-"| c #586E9C",
-"1 c #5B6F9D",
-"2 c #61739D",
-"3 c #63749E",
-"4 c #64749E",
-"5 c #68769E",
-"6 c #6A779E",
-"7 c #6B789E",
-"8 c #66759E",
-"9 c #6C789D",
-"0 c #EEF0ED",
-"a c #D0D3DC",
-"b c #3E51A3",
-"c c #28428B",
-"d c #29428C",
-"e c #425996",
-"f c #455C99",
-"g c #485F9C",
-"h c #49619E",
-"i c #4A63A0",
-"j c #4B64A1",
-"k c #4B65A1",
-"l c #4C66A2",
-"m c #4D67A2",
-"n c #4F69A1",
-"o c #516AA1",
-"p c #536CA0",
-"q c #556DA1",
-"r c #576EA0",
-"s c #586F9F",
-"t c #586E9F",
-"u c #596F9E",
-"v c #5A6F9E",
-"w c #5C709E",
-"x c #5E719E",
-"y c #5F729F",
-"z c #62739F",
-"A c #63739E",
-"B c #64749D",
-"C c #65749E",
-"D c #69769D",
-"E c #6C799E",
-"F c #6D799F",
-"G c #707D9F",
-"H c #717F9E",
-"I c #6E7AA1",
-"J c #6C789E",
-"K c #6F7C9C",
-"L c #6F7D9B",
-"M c #2A4AA0",
-"N c #4971D0",
-"O c #4C72D8",
-"P c #5472C0",
-"Q c #5573BF",
-"R c #5774BF",
-"S c #5875BF",
-"T c #5976C1",
-"U c #5A76C1",
-"V c #5C78C2",
-"W c #5E7AC2",
-"X c #607CC3",
-"Y c #627EC3",
-"Z c #637FC4",
-"` c #6581C5",
-" . c #6682C6",
-".. c #6783C7",
-"+. c #6984C8",
-"@. c #6B85C9",
-"#. c #6D87CA",
-"$. c #6F89CB",
-"%. c #718CCD",
-"&. c #748ECF",
-"*. c #7690D0",
-"=. c #7992D2",
-"-. c #7A93D3",
-";. c #7C95D5",
-">. c #7F98D7",
-",. c #8099D8",
-"'. c #859CDB",
-"). c #8AA0DD",
-"!. c #8DA3DF",
-"~. c #8FA5E0",
-"{. c #90A5E0",
-"]. c #91A6E1",
-"^. c #91A5E1",
-"/. c #90A4E0",
-"(. c #8EA3DE",
-"_. c #92A6E2",
-":. c #8FA4DF",
-"<. c #90A5DE",
-"[. c #90A5DC",
-"}. c #90A6DB",
-"|. c #91A6E0",
-"1. c #93A7E2",
-"2. c #95AAE6",
-"3. c #99AEEA",
-"4. c #9AB2EA",
-"5. c #99B1E9",
-"6. c #99B1E7",
-"7. c #98AFE6",
-"8. c #93A8E2",
-"9. c #97ACE7",
-"0. c #9AB3EB",
-"a. c #9DB5ED",
-"b. c #9DB6EE",
-"c. c #375095",
-"d. c #4056AD",
-"e. c #506DCD",
-"f. c #4360CC",
-"g. c #345ED6",
-"h. c #335ECF",
-"i. c #355ED6",
-"j. c #355FD6",
-"k. c #365FD6",
-"l. c #355FD0",
-"m. c #3760D5",
-"n. c #3A63D4",
-"o. c #3C63D1",
-"p. c #3B63CD",
-"q. c #3B63C9",
-"r. c #3B62C9",
-"s. c #3D63C8",
-"t. c #4065C5",
-"u. c #4567C5",
-"v. c #496BC5",
-"w. c #4F70C7",
-"x. c #5273C8",
-"y. c #5475CA",
-"z. c #5777CB",
-"A. c #5879CD",
-"B. c #5A7BCE",
-"C. c #5D7DCF",
-"D. c #5F7ECF",
-"E. c #617FD0",
-"F. c #6381D1",
-"G. c #6583D2",
-"H. c #6785D2",
-"I. c #6886D3",
-"J. c #6A88D4",
-"K. c #6C89D5",
-"L. c #6E8BD6",
-"M. c #708CD7",
-"N. c #718DD8",
-"O. c #738EDA",
-"P. c #748FDB",
-"Q. c #7691DC",
-"R. c #7893DD",
-"S. c #7994DD",
-"T. c #7A96DE",
-"U. c #7B97DF",
-"V. c #7C98E0",
-"W. c #7E9AE2",
-"X. c #7F9BE3",
-"Y. c #829DE4",
-"Z. c #849FE5",
-"`. c #87A0E6",
-" + c #88A1E7",
-".+ c #89A2E6",
-"++ c #8CA3E7",
-"@+ c #8EA5E9",
-"#+ c #8EA6E9",
-"$+ c #8FA7E9",
-"%+ c #8FA8E8",
-"&+ c #8FA9E8",
-"*+ c #91A9E8",
-"=+ c #90A7E8",
-"-+ c #8FA8EA",
-";+ c #90AAEA",
-">+ c #93ABEA",
-",+ c #95ABEA",
-"'+ c #93ABE9",
-")+ c #94ABEA",
-"!+ c #90A9EA",
-"~+ c #93AAE9",
-"{+ c #273E7E",
-"]+ c #345ED5",
-"^+ c #3D60CE",
-"/+ c #3D60CF",
-"(+ c #345ECF",
-"_+ c #335ED0",
-":+ c #355FD3",
-"<+ c #3A60CE",
-"[+ c #3A5FCB",
-"}+ c #385FC9",
-"|+ c #3B60C8",
-"1+ c #3C63CB",
-"2+ c #3E64CB",
-"3+ c #4166CA",
-"4+ c #4568C9",
-"5+ c #4A6CC7",
-"6+ c #4F71C8",
-"7+ c #5172CA",
-"8+ c #5475CE",
-"9+ c #5678D3",
-"0+ c #597CD6",
-"a+ c #5C7ED7",
-"b+ c #5E7FD8",
-"c+ c #6181D9",
-"d+ c #6383DA",
-"e+ c #6585DA",
-"f+ c #6786DB",
-"g+ c #6988DC",
-"h+ c #6B8ADD",
-"i+ c #6D8BDE",
-"j+ c #6F8DDE",
-"k+ c #718EDF",
-"l+ c #728FE0",
-"m+ c #7390E1",
-"n+ c #7390E2",
-"o+ c #7491E3",
-"p+ c #7592E4",
-"q+ c #7693E4",
-"r+ c #7794E5",
-"s+ c #7894E5",
-"t+ c #7995E6",
-"u+ c #7B96E6",
-"v+ c #7C97E7",
-"w+ c #7D9AE8",
-"x+ c #7F9CE9",
-"y+ c #829DE9",
-"z+ c #849EE9",
-"A+ c #859EE9",
-"B+ c #87A0E7",
-"C+ c #8AA2E7",
-"D+ c #8BA3E8",
-"E+ c #89A2E7",
-"F+ c #8CA6EA",
-"G+ c #8BA6EA",
-"H+ c #8BA7EA",
-"I+ c #8CA3E8",
-"J+ c #8BA8EA",
-"K+ c #8CA7EA",
-"L+ c #8CA8EA",
-"M+ c #4659C7",
-"N+ c #355ECF",
-"O+ c #3660CF",
-"P+ c #3860CE",
-"Q+ c #3961CD",
-"R+ c #3B61CB",
-"S+ c #3B61CA",
-"T+ c #3D62CA",
-"U+ c #3D63CA",
-"V+ c #4165CB",
-"W+ c #456ACB",
-"X+ c #4B6FCD",
-"Y+ c #5174CE",
-"Z+ c #5275D1",
-"`+ c #5477D4",
-" @ c #5678D9",
-".@ c #587ADB",
-"+@ c #597BDB",
-"@@ c #5B7DDC",
-"#@ c #5E7FDC",
-"$@ c #6081DD",
-"%@ c #6283DE",
-"&@ c #6484DF",
-"*@ c #6787E0",
-"=@ c #6989E1",
-"-@ c #6B8BE1",
-";@ c #6D8DE2",
-">@ c #6F8EE3",
-",@ c #718FE4",
-"'@ c #7290E4",
-")@ c #7491E5",
-"!@ c #7692E6",
-"~@ c #7793E5",
-"{@ c #7894E6",
-"]@ c #7895E7",
-"^@ c #7996E8",
-"/@ c #7A97E8",
-"(@ c #7B98E9",
-"_@ c #7D99E8",
-":@ c #7F9AE8",
-"<@ c #7F9BE9",
-"[@ c #7F9CEA",
-"}@ c #859EE8",
-"|@ c #859FE8",
-"1@ c #85A0E9",
-"2@ c #869FE9",
-"3@ c #86A1E7",
-"4@ c #86A0E9",
-"5@ c #87A1E7",
-"6@ c #88A2E7",
-"7@ c #87A1E9",
-"8@ c #5A6FCA",
-"9@ c #365FCF",
-"0@ c #345ED0",
-"a@ c #385FCC",
-"b@ c #385FCE",
-"c@ c #3A61CC",
-"d@ c #3B62CD",
-"e@ c #3E64CD",
-"f@ c #4167CF",
-"g@ c #4469CF",
-"h@ c #486CD1",
-"i@ c #4D71D2",
-"j@ c #5175D4",
-"k@ c #5376D6",
-"l@ c #5578DA",
-"m@ c #5679DC",
-"n@ c #587BDD",
-"o@ c #5A7DDE",
-"p@ c #5D80DE",
-"q@ c #5F82DF",
-"r@ c #6284DF",
-"s@ c #6585E0",
-"t@ c #6787E1",
-"u@ c #6988E2",
-"v@ c #6B8AE2",
-"w@ c #6D8CE3",
-"x@ c #6E8DE3",
-"y@ c #708EE4",
-"z@ c #718FE3",
-"A@ c #7391E4",
-"B@ c #7592E5",
-"C@ c #7895E5",
-"D@ c #7996E6",
-"E@ c #7A97E6",
-"F@ c #7B98E7",
-"G@ c #7A98E8",
-"H@ c #7B99E9",
-"I@ c #7E9AE9",
-"J@ c #7D9AE9",
-"K@ c #7E9AEA",
-"L@ c #809CE9",
-"M@ c #819DE8",
-"N@ c #7F9BEA",
-"O@ c #819DE9",
-"P@ c #819CE9",
-"Q@ c #839EE9",
-"R@ c #839EE8",
-"S@ c #839DEA",
-"T@ c #859FE9",
-"U@ c #87A0E8",
-"V@ c #86A0E8",
-"W@ c #87A1E8",
-"X@ c #3760CF",
-"Y@ c #3A61CE",
-"Z@ c #3A62CD",
-"`@ c #3F66CE",
-" # c #4368D0",
-".# c #466CD2",
-"+# c #496DD5",
-"@# c #4E72D6",
-"## c #5175D8",
-"$# c #5276DA",
-"%# c #5578DC",
-"&# c #577ADC",
-"*# c #597CDD",
-"=# c #5B7DDD",
-"-# c #5D7FDE",
-";# c #5E81DE",
-"># c #6183DF",
-",# c #6386DF",
-"'# c #6687E0",
-")# c #6888E0",
-"!# c #6A89E1",
-"~# c #6C8AE1",
-"{# c #6E8CE2",
-"]# c #6F8DE2",
-"^# c #7390E4",
-"/# c #7390E3",
-"(# c #7491E4",
-"_# c #7693E5",
-":# c #7895E6",
-"<# c #7896E6",
-"[# c #7997E7",
-"}# c #7B97E7",
-"|# c #7B98E8",
-"1# c #7C98E8",
-"2# c #7E9BE9",
-"3# c #809CEA",
-"4# c #819CEA",
-"5# c #839DE9",
-"6# c #365FD0",
-"7# c #3660D0",
-"8# c #3961CF",
-"9# c #3B63CF",
-"0# c #3D64D0",
-"a# c #4067D0",
-"b# c #4469D2",
-"c# c #466BD3",
-"d# c #496ED5",
-"e# c #4C71D6",
-"f# c #4E72D8",
-"g# c #5074D9",
-"h# c #5376DB",
-"i# c #5578DB",
-"j# c #587ADC",
-"k# c #5B7CDC",
-"l# c #5D7EDD",
-"m# c #5F80DD",
-"n# c #6081DE",
-"o# c #6383DE",
-"p# c #6686DF",
-"q# c #6887E0",
-"r# c #6988E0",
-"s# c #6B89E1",
-"t# c #6C8AE0",
-"u# c #6E8CE1",
-"v# c #708EE2",
-"w# c #718FE2",
-"x# c #7290E3",
-"y# c #7391E2",
-"z# c #7492E1",
-"A# c #7592E2",
-"B# c #7691E3",
-"C# c #7591E3",
-"D# c #7692E3",
-"E# c #7693E3",
-"F# c #7793E4",
-"G# c #7893E4",
-"H# c #7994E5",
-"I# c #7D97E8",
-"J# c #7E98E8",
-"K# c #7D98E8",
-"L# c #7D99E9",
-"M# c #7D9BEA",
-"N# c #7D9CEA",
-"O# c #7E99E8",
-"P# c #7D9AEA",
-"Q# c #7C9BEA",
-"R# c #7C9CEA",
-"S# c #355FCF",
-"T# c #3860D0",
-"U# c #3A62D0",
-"V# c #3C64D1",
-"W# c #4167D1",
-"X# c #4369D3",
-"Y# c #466BD4",
-"Z# c #486DD5",
-"`# c #4A6ED7",
-" $ c #4C70D8",
-".$ c #5478D9",
-"+$ c #577BDA",
-"@$ c #597DDB",
-"#$ c #5B7EDB",
-"$$ c #5D7FDC",
-"%$ c #6182DE",
-"&$ c #6284DE",
-"*$ c #6485DF",
-"=$ c #6586DF",
-"-$ c #6787DF",
-";$ c #6888DF",
-">$ c #6A8ADF",
-",$ c #6C8BE0",
-"'$ c #6D8CE0",
-")$ c #6E8DE1",
-"!$ c #6F8DE1",
-"~$ c #708EE1",
-"{$ c #718FE0",
-"]$ c #728FE1",
-"^$ c #7390E0",
-"/$ c #738FE0",
-"($ c #7490E1",
-"_$ c #7590E1",
-":$ c #7591E1",
-"<$ c #7592E1",
-"[$ c #7692E2",
-"}$ c #7794E2",
-"|$ c #7894E3",
-"1$ c #7996E3",
-"2$ c #7A96E5",
-"3$ c #7B98E6",
-"4$ c #7B9AE8",
-"5$ c #7C99E8",
-"6$ c #7C96E5",
-"7$ c #7D97E7",
-"8$ c #7C99E9",
-"9$ c #7B9AE9",
-"0$ c #7B9AEA",
-"a$ c #5B6DCF",
-"b$ c #305EC8",
-"c$ c #335ECE",
-"d$ c #305ECA",
-"e$ c #345FCF",
-"f$ c #3761D0",
-"g$ c #3A62D1",
-"h$ c #3C64D2",
-"i$ c #4066D3",
-"j$ c #466BD5",
-"k$ c #486ED6",
-"l$ c #4A6ED6",
-"m$ c #4D71D8",
-"n$ c #4F72D9",
-"o$ c #5073D9",
-"p$ c #4F72D8",
-"q$ c #5074D8",
-"r$ c #5276D9",
-"s$ c #587ADA",
-"t$ c #5B7CDB",
-"u$ c #5D7EDC",
-"v$ c #5F7FDD",
-"w$ c #6081DC",
-"x$ c #6182DD",
-"y$ c #6283DD",
-"z$ c #6484DE",
-"A$ c #6585DD",
-"B$ c #6787DE",
-"C$ c #6988DF",
-"D$ c #6A89DE",
-"E$ c #6C8ADF",
-"F$ c #6D8BDF",
-"G$ c #6E8CE0",
-"H$ c #6F8DE0",
-"I$ c #718EE0",
-"J$ c #728FDF",
-"K$ c #728FDE",
-"L$ c #7290E0",
-"M$ c #7190E0",
-"N$ c #7291E0",
-"O$ c #7191E0",
-"P$ c #7392E1",
-"Q$ c #7493E1",
-"R$ c #7594E1",
-"S$ c #7594E2",
-"T$ c #7694E2",
-"U$ c #7695E2",
-"V$ c #7A96E4",
-"W$ c #7895E2",
-"X$ c #7A96E2",
-"Y$ c #7A96E3",
-"Z$ c #7B96E3",
-"`$ c #7996E1",
-" % c #7C96E4",
-".% c #305EC9",
-"+% c #315ECC",
-"@% c #325ECE",
-"#% c #3760D0",
-"$% c #3962D1",
-"%% c #3E66D3",
-"&% c #4268D4",
-"*% c #446BD5",
-"=% c #476CD6",
-"-% c #496ED7",
-";% c #4B6FD7",
-">% c #4C70D7",
-",% c #4E71D7",
-"'% c #5074D7",
-")% c #5276D8",
-"!% c #5376D8",
-"~% c #5779DA",
-"{% c #597ADA",
-"]% c #5A7BDB",
-"^% c #5B7CDA",
-"/% c #5D7EDB",
-"(% c #5E7FDB",
-"_% c #6182DB",
-":% c #6384DC",
-"<% c #6586DD",
-"[% c #6686DC",
-"}% c #6887DD",
-"|% c #6988DD",
-"1% c #6A8ADE",
-"2% c #6B8BDE",
-"3% c #6C8CDE",
-"4% c #6E8DDF",
-"5% c #6E8CDF",
-"6% c #6D8DDF",
-"7% c #6C8BDF",
-"8% c #6F8DDF",
-"9% c #718FDF",
-"0% c #7290DF",
-"a% c #7391E0",
-"b% c #7491E0",
-"c% c #7292E1",
-"d% c #3959C5",
-"e% c #345BC5",
-"f% c #315EC8",
-"g% c #355BC5",
-"h% c #325EC8",
-"i% c #315ECB",
-"j% c #345DCC",
-"k% c #335ECD",
-"l% c #345ECD",
-"m% c #355FCE",
-"n% c #3862D0",
-"o% c #3E66D2",
-"p% c #456BD5",
-"q% c #476CD5",
-"r% c #4B6ED7",
-"s% c #4B6FD6",
-"t% c #4B6FD5",
-"u% c #4D71D6",
-"v% c #5073D7",
-"w% c #5174D7",
-"x% c #5275D8",
-"y% c #5577D8",
-"z% c #5678D8",
-"A% c #5779D9",
-"B% c #587AD8",
-"C% c #597CD9",
-"D% c #5B7DD9",
-"E% c #5D7FDA",
-"F% c #5F80DB",
-"G% c #6182DC",
-"H% c #6484DC",
-"I% c #6585DC",
-"J% c #6787DD",
-"K% c #6988DE",
-"L% c #6B8ADE",
-"M% c #6B8ADF",
-"N% c #6989DE",
-"O% c #6B89DE",
-"P% c #6E8BDF",
-"Q% c #708CDE",
-"R% c #708DDF",
-"S% c #708FDF",
-"T% c #728EDF",
-"U% c #6F8EDD",
-"V% c #728EDD",
-"W% c #7390DF",
-"X% c #7490DF",
-"Y% c #335DC8",
-"Z% c #3759C5",
-"`% c #3859C5",
-" & c #335EC8",
-".& c #325DCA",
-"+& c #345CCB",
-"@& c #335DCC",
-"#& c #345DCD",
-"$& c #355FCD",
-"%& c #3861D0",
-"&& c #3B64D1",
-"*& c #3E65D2",
-"=& c #4168D3",
-"-& c #456AD5",
-";& c #4B6ED5",
-">& c #4C6FD4",
-",& c #4D70D5",
-"'& c #4F72D6",
-")& c #5173D6",
-"!& c #5375D7",
-"~& c #5476D8",
-"{& c #5577D7",
-"]& c #5477D8",
-"^& c #5677D8",
-"/& c #5879D9",
-"(& c #597AD9",
-"_& c #5C7DDA",
-":& c #6080DC",
-"<& c #6080DB",
-"[& c #6181DC",
-"}& c #6282DC",
-"|& c #6383DD",
-"1& c #6484DD",
-"2& c #6686DE",
-"3& c #6685DE",
-"4& c #6786DE",
-"5& c #6687DE",
-"6& c #6887DE",
-"7& c #6987DE",
-"8& c #6788DF",
-"9& c #6785DF",
-"0& c #6B89DF",
-"a& c #6C89DF",
-"b& c #6F8DDD",
-"c& c #6D8CDE",
-"d& c #445BBB",
-"e& c #3759BE",
-"f& c #375AC6",
-"g& c #355CC8",
-"h& c #345CCA",
-"i& c #355ECC",
-"j& c #365FCD",
-"k& c #3761CE",
-"l& c #3A63D0",
-"m& c #3D65D1",
-"n& c #466AD4",
-"o& c #476BD4",
-"p& c #486CD3",
-"q& c #4A6ED4",
-"r& c #4B6ED4",
-"s& c #4E71D6",
-"t& c #4F71D5",
-"u& c #5072D6",
-"v& c #5274D7",
-"w& c #5273D7",
-"x& c #5274D6",
-"y& c #5476D7",
-"z& c #5779D8",
-"A& c #587AD9",
-"B& c #5A7CDA",
-"C& c #5C7DDB",
-"D& c #5D7EDA",
-"E& c #6081DA",
-"F& c #6181DB",
-"G& c #6283DC",
-"H& c #6483DD",
-"I& c #6483DE",
-"J& c #6585DE",
-"K& c #6786DF",
-"L& c #6886DE",
-"M& c #6887DF",
-"N& c #6987DF",
-"O& c #6A88DF",
-"P& c #6786E0",
-"Q& c #6A86DE",
-"R& c #6B89E0",
-"S& c #365BC8",
-"T& c #365CC8",
-"U& c #375DCA",
-"V& c #375FCB",
-"W& c #3860CD",
-"X& c #3C63D0",
-"Y& c #4167D2",
-"Z& c #4268D2",
-"`& c #4368D2",
-" * c #4367D2",
-".* c #4568D2",
-"+* c #466AD2",
-"@* c #496CD3",
-"#* c #4A6DD3",
-"$* c #4A6DD4",
-"%* c #4D70D4",
-"&* c #4F72D5",
-"** c #4C70D4",
-"=* c #4E72D5",
-"-* c #5173D5",
-";* c #5375D6",
-">* c #597BDA",
-",* c #5B7DDA",
-"'* c #5C7EDB",
-")* c #5D7FDB",
-"!* c #5E80DB",
-"~* c #5E81DA",
-"{* c #5F81DB",
-"]* c #5F82DB",
-"^* c #6384DD",
-"/* c #6384DE",
-"(* c #6585DF",
-"_* c #6486E0",
-":* c #6583DD",
-"<* c #6386E0",
-"[* c #6686E0",
-"}* c #6B86DD",
-"|* c #6D86DD",
-"1* c #6086E0",
-"2* c #5573CD",
-"3* c #3959C3",
-"4* c #3959C4",
-"5* c #3759C0",
-"6* c #375BC7",
-"7* c #365CC7",
-"8* c #395FCC",
-"9* c #3B62CE",
-"0* c #3E64D0",
-"a* c #4066D1",
-"b* c #4166D1",
-"c* c #4064CF",
-"d* c #4065CF",
-"e* c #4266D0",
-"f* c #4468D1",
-"g* c #4569D1",
-"h* c #476BD2",
-"i* c #466AD1",
-"j* c #476AD2",
-"k* c #456AD1",
-"l* c #496DD2",
-"m* c #4A6FD3",
-"n* c #496ED2",
-"o* c #4B70D4",
-"p* c #4D71D4",
-"q* c #4E72D4",
-"r* c #5073D4",
-"s* c #5174D5",
-"t* c #5175D5",
-"u* c #5276D6",
-"v* c #5377D6",
-"w* c #5478D7",
-"x* c #5579D7",
-"y* c #567AD8",
-"z* c #577BD9",
-"A* c #597CD8",
-"B* c #5A7DD9",
-"C* c #5A7ED9",
-"D* c #5B7FDA",
-"E* c #5C80DA",
-"F* c #5D80DA",
-"G* c #5E81DB",
-"H* c #5D80DB",
-"I* c #6082DC",
-"J* c #6183DD",
-"K* c #6183DE",
-"L* c #6082DB",
-"M* c #6282DE",
-"N* c #6682DE",
-"O* c #6583DE",
-"P* c #3759BF",
-"Q* c #375AC2",
-"R* c #375AC1",
-"S* c #375AC4",
-"T* c #395DCA",
-"U* c #3A5ECA",
-"V* c #3C60CC",
-"W* c #3D61CD",
-"X* c #3D61CC",
-"Y* c #3C61CD",
-"Z* c #3E62CD",
-"`* c #3F64CE",
-" = c #4266CF",
-".= c #4468D0",
-"+= c #4267CF",
-"@= c #4166CE",
-"#= c #4065CE",
-"$= c #4166CD",
-"%= c #4267CE",
-"&= c #456AD0",
-"*= c #4368CE",
-"== c #4468CF",
-"-= c #4569D0",
-";= c #486BD1",
-">= c #4B6FD3",
-",= c #4C70D3",
-"'= c #4F73D4",
-")= c #5275D5",
-"!= c #5477D6",
-"~= c #577BD7",
-"{= c #587CD8",
-"]= c #577CD8",
-"^= c #597DD9",
-"/= c #5A7DDA",
-"(= c #597DDA",
-"_= c #587CDA",
-":= c #5A7EDA",
-"<= c #567BD8",
-"[= c #557AD9",
-"}= c #567BD9",
-"|= c #577CD9",
-"1= c #587DD9",
-"2= c #587ED9",
-"3= c #577ED8",
-"4= c #587DD8",
-"5= c #587ED8",
-"6= c #567ED7",
-"7= c #526ABD",
-"8= c #3759C1",
-"9= c #385BC7",
-"0= c #395CC8",
-"a= c #3B5DC9",
-"b= c #3B5ECA",
-"c= c #3A5FCA",
-"d= c #3B60CC",
-"e= c #3C61CC",
-"f= c #3D62CD",
-"g= c #3E63CD",
-"h= c #3C61CB",
-"i= c #3C61CA",
-"j= c #3D62CB",
-"k= c #3F64CC",
-"l= c #4065CD",
-"m= c #4669D0",
-"n= c #476AD0",
-"o= c #496BD1",
-"p= c #4A6DD2",
-"q= c #4B6ED2",
-"r= c #4D71D3",
-"s= c #4E73D4",
-"t= c #4F74D4",
-"u= c #5075D5",
-"v= c #5276D5",
-"w= c #5377D7",
-"x= c #5278D7",
-"y= c #5277D6",
-"z= c #5378D7",
-"A= c #5379D8",
-"B= c #5379D9",
-"C= c #5278D8",
-"D= c #5178D7",
-"E= c #3355C0",
-"F= c #3556C1",
-"G= c #395AC6",
-"H= c #385AC7",
-"I= c #395BC7",
-"J= c #395EC9",
-"K= c #395FCA",
-"L= c #3B60CA",
-"M= c #3B60CB",
-"N= c #375DC7",
-"O= c #385EC8",
-"P= c #395FC9",
-"Q= c #3A60CA",
-"R= c #3D63CC",
-"S= c #4367CF",
-"T= c #476BD1",
-"U= c #4A6ED2",
-"V= c #4B6FD2",
-"W= c #4C6FD2",
-"X= c #4D70D1",
-"Y= c #4E71D2",
-"Z= c #4E72D2",
-"`= c #4E74D4",
-" - c #4E75D5",
-".- c #4E75D4",
-"+- c #4F75D3",
-"@- c #5075D2",
-"#- c #5075D3",
-"$- c #5177D7",
-"%- c #5178D8",
-"&- c #4F75D5",
-"*- c #5076D5",
-"=- c #4F76D6",
-"-- c #5279D9",
-";- c #3C52B1",
-">- c #3656C3",
-",- c #3757C5",
-"'- c #3758C6",
-")- c #3759C6",
-"!- c #375BC6",
-"~- c #385CC7",
-"{- c #385DC8",
-"]- c #365CC6",
-"^- c #355BC6",
-"/- c #355CC6",
-"(- c #365DC7",
-"_- c #375EC8",
-":- c #375CC6",
-"<- c #385EC6",
-"[- c #3A5FC7",
-"}- c #3C60C8",
-"|- c #3D61C9",
-"1- c #3E62CA",
-"2- c #4063CC",
-"3- c #4165CE",
-"4- c #4268D0",
-"5- c #4269D1",
-"6- c #436AD2",
-"7- c #446AD2",
-"8- c #456BD2",
-"9- c #496CD1",
-"0- c #4C6CD0",
-"a- c #4D6CCF",
-"b- c #4E6DD0",
-"c- c #4F6ECF",
-"d- c #4E6FCF",
-"e- c #4C70CF",
-"f- c #4A71D0",
-"g- c #4F6FCF",
-"h- c #4B71D0",
-"i- c #4A72D1",
-"j- c #4B73D4",
-"k- c #4F70D0",
-"l- c #4C73D3",
-"m- c #4C73D6",
-"n- c #4B72D2",
-"o- c #4B71D1",
-"p- c #4C73D7",
-"q- c #3354C0",
-"r- c #3152BE",
-"s- c #3052BE",
-"t- c #3051BF",
-"u- c #2E4FBF",
-"v- c #2E4FBE",
-"w- c #2E50BF",
-"x- c #2F50BF",
-"y- c #3156C4",
-"z- c #2F56C5",
-"A- c #2E57C5",
-"B- c #2F57C5",
-"C- c #3057C6",
-"D- c #3258C6",
-"E- c #3459C7",
-"F- c #365AC7",
-"G- c #385BC8",
-"H- c #3B5DCA",
-"I- c #3B5DCB",
-"J- c #3C5ECC",
-"K- c #3C60CD",
-"L- c #3C62CE",
-"M- c #3D65D0",
-"N- c #3D66D1",
-"O- c #4166D2",
-"P- c #4667D2",
-"Q- c #4A67D1",
-"R- c #4C68D0",
-"S- c #4C69CF",
-"T- c #4D6BCE",
-"U- c #4E6DCD",
-"V- c #4E6ECE",
-"W- c #4E6DCE",
-"X- c #4970D0",
-"Y- c #4770D0",
-"Z- c #4B6BCE",
-"`- c #4A6CCE",
-" ; c #496DCF",
-".; c #476FD0",
-"+; c #4870D0",
-"@; c #486DCF",
-"#; c #242F79",
-"$; c #2F41AC",
-"%; c #2040B8",
-"&; c #2041B8",
-"*; c #2243B3",
-"=; c #2243B8",
-"-; c #2343B8",
-";; c #2444B8",
-">; c #2445B8",
-",; c #2445B6",
-"'; c #2445B7",
-"); c #2444B9",
-"!; c #2949BE",
-"~; c #2649BF",
-"{; c #234BBF",
-"]; c #224CBF",
-"^; c #224AC0",
-"/; c #244CC0",
-"(; c #254DC0",
-"_; c #254DC1",
-":; c #264DC2",
-"<; c #274EC3",
-"[; c #274CC3",
-"}; c #274DC4",
-"|; c #254DC5",
-"1; c #214EC5",
-"2; c #204FC6",
-"3; c #1F50C8",
-"4; c #2151C9",
-"5; c #2B53C8",
-"6; c #3154C7",
-"7; c #3255C6",
-"8; c #2F57C7",
-"9; c #2C58C9",
-"0; c #2D59CA",
-"a; c #2D58C9",
-"b; c #2E5BCC",
-"c; c #325ECC",
-"d; c #325ECB",
-"e; c #1F40B1",
-"f; c #1F40B2",
-"g; c #1F40B3",
-"h; c #2A44BD",
-"i; c #2845BE",
-"j; c #2745BE",
-"k; c #2646BF",
-"l; c #2546BE",
-"m; c #2347BF",
-"n; c #2147BF",
-"o; c #2048C0",
-"p; c #1D48C0",
-"q; c #1C48C0",
-"r; c #1B47C0",
-"s; c #1C48BF",
-"t; c #1E49BE",
-"u; c #214ABD",
-"v; c #244CBD",
-"w; c #264DBE",
-"x; c #254EC0",
-"y; c #214FC2",
-"z; c #1B51C5",
-"A; c #1C51C7",
-"B; c #2250C8",
-"C; c #2A52C8",
-"D; c #3254C6",
-"E; c #3355C5",
-"F; c #3154C8",
-"G; c #3355C6",
-"H; c #2F57C8",
-"I; c #2E58C9",
-"J; c #2E59C9",
-"K; c #3059C9",
-"L; c #2040B6",
-"M; c #2743BB",
-"N; c #2844BC",
-"O; c #2743BD",
-"P; c #2844BE",
-"Q; c #2844BD",
-"R; c #2346BE",
-"S; c #2047BF",
-"T; c #1E48C0",
-"U; c #1D47C0",
-"V; c #1D49BF",
-"W; c #1F49BF",
-"X; c #204ABE",
-"Y; c #254DBF",
-"Z; c #234EC0",
-"`; c #2050C1",
-" > c #1C51C3",
-".> c #1F51C6",
-"+> c #2651C8",
-"@> c #2D53C7",
-"#> c #3155C6",
-"$> c #3155C7",
-"%> c #3355C7",
-"&> c #3254C7",
-"*> c #1E40B1",
-"=> c #2141B8",
-"-> c #2442B9",
-";> c #2744BB",
-">> c #2945BB",
-",> c #2A45BB",
-"'> c #2944BA",
-")> c #2745BB",
-"!> c #2545BC",
-"~> c #2246BD",
-"{> c #2047BE",
-"]> c #1F47BD",
-"^> c #1D48BE",
-"/> c #1E49C0",
-"(> c #1F4AC0",
-"_> c #214BBF",
-":> c #244CBE",
-"<> c #254DBE",
-"[> c #244DBE",
-"}> c #224FBF",
-"|> c #2051C1",
-"1> c #2151C3",
-"2> c #2252C5",
-"3> c #2151C1",
-"4> c #2851C6",
-"5> c #2A50C6",
-"6> c #2E54C6",
-"7> c #1F51C2",
-"8> c #1D52C5",
-"9> c #2651C9",
-"0> c #2950C7",
-"a> c #2D40A5",
-"b> c #2040B0",
-"c> c #1F40B0",
-"d> c #223CAE",
-"e> c #233CAE",
-"f> c #253BAC",
-"g> c #253BAD",
-"h> c #233CB0",
-"i> c #213EB2",
-"j> c #1F3FB4",
-"k> c #1E40B6",
-"l> c #1F3FB7",
-"m> c #1E3EB8",
-"n> c #1F3FB8",
-"o> c #2040B7",
-"p> c #2141B6",
-"q> c #2140B7",
-"r> c #2241B6",
-"s> c #2342B5",
-"t> c #2442B6",
-"u> c #2543B5",
-"v> c #2643B4",
-"w> c #2544B6",
-"x> c #2346B8",
-"y> c #2247B9",
-"z> c #2048BC",
-"A> c #1F48BF",
-"B> c #2049C0",
-"C> c #214AC0",
-"D> c #224BBF",
-"E> c #234CBE",
-"F> c #244DBF",
-"G> c #234CBF",
-"H> c #264DC0",
-"I> c #274EBF",
-"J> c #264DBF",
-"K> c #254EBF",
-"L> c #2050C0",
-"M> c #1F51C1",
-"N> c #1E42A4",
-"O> c #263BA6",
-"P> c #253BA7",
-"Q> c #253CA7",
-"R> c #1E41A5",
-"S> c #1F40AF",
-"T> c #273AAC",
-"U> c #1E40B0",
-"V> c #1F40B5",
-"W> c #1F40B6",
-"X> c #1F40B8",
-"Y> c #1E40B8",
-"Z> c #1F3EB8",
-"`> c #203FB7",
-" , c #2240B6",
-"., c #2341B7",
-"+, c #2345B9",
-"@, c #2147BB",
-"#, c #2148BA",
-"$, c #2049BB",
-"%, c #2049BD",
-"&, c #2049BF",
-"*, c #224BBE",
-"=, c #244DBD",
-"-, c #244CBF",
-";, c #182969",
-">, c #273BAD",
-",, c #2739AB",
-"', c #263AAC",
-"), c #243CAE",
-"!, c #233DAE",
-"~, c #213EAF",
-"{, c #1F3FB0",
-"], c #2040B4",
-"^, c #1F3FB6",
-"/, c #1E3EB7",
-"(, c #2240B7",
-"_, c #2341B6",
-":, c #2543B4",
-"<, c #2644B3",
-"[, c #2544B5",
-"}, c #2545B5",
-"|, c #2547B6",
-"1, c #2548B7",
-"2, c #2349BA",
-"3, c #1F49BE",
-"4, c #2149BD",
-"5, c #2049BE",
-"6, c #214BBE",
-"7, c #2249BE",
-"8, c #234CBD",
-"9, c #2149BE",
-"0, c #1E49BF",
-"a, c #253BA9",
-"b, c #253BAB",
-"c, c #263AAB",
-"d, c #213DAF",
-"e, c #203EAF",
-"f, c #1D40AF",
-"g, c #1D40B0",
-"h, c #1E40B4",
-"i, c #2241B7",
-"j, c #2643B6",
-"k, c #2744B5",
-"l, c #2643B5",
-"m, c #2346B6",
-"n, c #2147B7",
-"o, c #2644B6",
-"p, c #2247B7",
-"q, c #2248B8",
-"r, c #2647B7",
-"s, c #2549B7",
-"t, c #2645B7",
-"u, c #2148B8",
-"v, c #2847B6",
-"w, c #2549B6",
-"x, c #2849B6",
-"y, c #2049B7",
-"z, c #2A49B5",
-"A, c #243BA4",
-"B, c #253BA5",
-"C, c #253BA6",
-"D, c #263AA7",
-"E, c #263AA8",
-"F, c #2739AA",
-"G, c #243CAD",
-"H, c #223DAE",
-"I, c #1F3EAF",
-"J, c #1E3FB0",
-"K, c #1D40B1",
-"L, c #1E3FB1",
-"M, c #1F3FB3",
-"N, c #1F3FB5",
-"O, c #2140B6",
-"P, c #2140B8",
-"Q, c #2744B4",
-"R, c #2746B6",
-"S, c #2947B6",
-"T, c #2946B5",
-"U, c #2A48B6",
-"V, c #3551A8",
-"W, c #1F399C",
-"X, c #143D9F",
-"Y, c #263BA5",
-"Z, c #273BA8",
-"`, c #273BAA",
-" ' c #263AAD",
-".' c #233CAD",
-"+' c #213DAE",
-"@' c #203FB2",
-"#' c #2342B6",
-"$' c #2443B6",
-"%' c #2543B6",
-"&' c #2644B5",
-"*' c #133D9E",
-"=' c #263BA7",
-"-' c #263BA9",
-";' c #273BA9",
-">' c #263AAA",
-",' c #2539AB",
-"'' c #2639AB",
-")' c #253AAC",
-"!' c #243BAD",
-"~' c #223DAF",
-"{' c #203FB0",
-"]' c #2040B1",
-"^' c #2140B3",
-"/' c #2543B1",
-"(' c #2744AF",
-"_' c #1A3CA0",
-":' c #1D3BA2",
-"<' c #233BA4",
-"[' c #263AA5",
-"}' c #253AA5",
-"|' c #263AA6",
-"1' c #263BA4",
-"2' c #243BA5",
-"3' c #263BA8",
-"4' c #223EAF",
-"5' c #3B4CA5",
-"6' c #1D379A",
-"7' c #1E389C",
-"8' c #1E399F",
-"9' c #1F3BA2",
-"0' c #1F3BA3",
-"a' c #213BA4",
-"b' c #233AA3",
-"c' c #243AA3",
-"d' c #2539A4",
-"e' c #253AA6",
-"f' c #243BA7",
-"g' c #253CAA",
-"h' c #253CAC",
-"i' c #253CAD",
-"j' c #253CAE",
-"k' c #243DAE",
-"l' c #213FAF",
-"m' c #223FAF",
-"n' c #2040AF",
-"o' c #253D93",
-"p' c #1D3894",
-"q' c #1F379A",
-"r' c #1E389B",
-"s' c #1D399C",
-"t' c #1C3A9D",
-"u' c #1B3A9D",
-"v' c #183B9E",
-"w' c #163C9E",
-"x' c #153C9E",
-"y' c #163B9D",
-"z' c #173B9D",
-"A' c #193A9D",
-"B' c #1C3A9E",
-"C' c #1F3AA1",
-"D' c #223AA4",
-"E' c #253BA8",
-"F' c #273BA7",
-"G' c #263CAB",
-"H' c #263CAC",
-"I' c #243EAE",
-"J' c #273BAC",
-"K' c #2A3795",
-"L' c #1F389B",
-"M' c #1D389B",
-"N' c #1C399C",
-"O' c #1B399C",
-"P' c #1A3A9D",
-"Q' c #1D399B",
-"R' c #1B399B",
-"S' c #1A3A9C",
-"T' c #1B3A9F",
-"U' c #1D3AA0",
-"V' c #203BA2",
-"W' c #203BA3",
-"X' c #2639A6",
-"Y' c #1B3692",
-"Z' c #1C3794",
-"`' c #1D3796",
-" ) c #1E3898",
-".) c #1E389A",
-"+) c #1F399B",
-"@) c #1A399C",
-"#) c #193A9E",
-"$) c #1A3BA0",
-"%) c #1C3BA2",
-"&) c #1D3CA3",
-"*) c #203CA4",
-"=) c #223BA5",
-"-) c #3C4699",
-";) c #2B4595",
-">) c #1C3793",
-",) c #1D3895",
-"') c #1E3897",
-")) c #1F3998",
-"!) c #1F3999",
-"~) c #1F399A",
-"{) c #1E399C",
-"]) c #1C3B9E",
-"^) c #1D3BA0",
-"/) c #1E3CA2",
-"() c #223CA5",
-"_) c #243CA6",
-":) c #596FA9",
-"<) c #3B4894",
-"[) c #314993",
-"}) c #29499F",
-"|) c #28489E",
-"1) c #2B4BA1",
-"2) c #2C4BA1",
-"3) c #2D4CA2",
-"4) c #2E4CA3",
-"5) c #2F4CA4",
-"6) c #2E4CA4",
-"7) c #2F4DA3",
-"8) c #2F4DA4",
-"9) c #D3D5D2",
-"0) c #3B4794",
-"a) c #314791",
-"b) c #304892",
-"c) c #304893",
-"d) c #2F4995",
-"e) c #2F4997",
-"f) c #2D4A9A",
-"g) c #2A4A9D",
-"h) c #294A9F",
-"i) c #284AA0",
-"j) c #294AA0",
-"k) c #2B4AA1",
-"l) c #2D4CA3",
-"m) c #C9CAC9",
-"n) c #455D9B",
-"o) c #242F78",
-"p) c #1B2F85",
-"q) c #C6C3C8",
-"r) c #B5B2B6",
-"s) c #B5B7B4",
-"t) c #B5B7B3",
-"u) c #B5B2B5",
-"v) c #B5B3B4",
-"w) c #B5B5B4",
-"x) c #B5B6B3",
-"y) c #B5B4B4",
-"z) c #B5B3B5",
-"A) c #B5B4B5",
-"B) c #B5B5B5",
-"C) c #B5B5B3",
-"D) c #B5B5B6",
-"E) c #BAC3BE",
-"F) c #B9C3BD",
-"G) c #C1C3C4",
-"H) c #BFC3C2",
-"I) c #B9C3BE",
-"J) c #BBC3BF",
-"K) c #BDC3C1",
-"L) c #C0C3C3",
-"M) c #BEC3C1",
-"N) c #C2C3C5",
-"O) c #E6E3E8",
-"P) c #E0E2DF",
-"Q) c #E1E1E1",
-"R) c #E2E1E3",
-"S) c #E4E1E6",
-"T) c #E4E2E7",
-"U) c #E4E2E6",
-"V) c #E3E3E4",
-"W) c #E2E3E3",
-"X) c #E1E3E2",
-"Y) c #E3E3E3",
-"Z) c #E3E3E2",
-"`) c #EBEDEA",
-" ! c #EAECE9",
-".! c #E9EBE8",
-"+! c #ECEEEB",
-". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ",
-"0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ",
-"@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.",
-"c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+",
-"$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+",
-"{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+",
-"{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@",
-"{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+",
-"{+{+8@8@f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#",
-"$ {+8@e.f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.S#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$",
-"$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %",
-"$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%",
-"$ $ 8@e.f.f.d%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%",
-"$ $ 8@8@f.f.d%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%",
-"$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&",
-"{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*",
-"{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*",
-"{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=",
-"{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=",
-"{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=",
-"{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-",
-"{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ",
-"#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;",
-"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;",
-"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;",
-"#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;",
-"#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>",
-"#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;",
-"#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>",
-";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,",
-";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,",
-";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,",
-";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,",
-";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;",
-";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;",
-";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'",
-";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>",
-";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>",
-"{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>",
-":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)",
-"9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)",
-"+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)",
-"+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)",
-". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)",
-". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)",
-". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"};
-
-
-static char * listviewhighcornerright_xpm[] = {
-"100 46 780 2",
-" c None",
-". c #6A779D",
-"+ c #6C789C",
-"@ c #6C789D",
-"# c #6B789D",
-"$ c #6A779E",
-"% c #66759E",
-"& c #64749E",
-"* c #63749E",
-"= c #61739D",
-"- c #576D9B",
-"; c #556C9C",
-"> c #4D679D",
-", c #4A649D",
-"' c #49629D",
-") c #465E9C",
-"! c #40579C",
-"~ c #3B5394",
-"{ c #2C4E97",
-"] c #314993",
-"^ c #2B4595",
-"/ c #1B4296",
-"( c #253D93",
-"_ c #19418F",
-": c #0F3C96",
-"< c #42599E",
-"[ c #758DC3",
-"} c #E8EAE7",
-"| c #EEF0ED",
-"1 c #FBFBFC",
-"2 c #6F7D9B",
-"3 c #6F7D9A",
-"4 c #6E7B9C",
-"5 c #67759E",
-"6 c #63739E",
-"7 c #62739D",
-"8 c #596F9C",
-"9 c #4A639D",
-"0 c #47609C",
-"a c #445B9F",
-"b c #3E5697",
-"c c #2E509A",
-"d c #2D509A",
-"e c #2D4F99",
-"f c #2D4F98",
-"g c #28418A",
-"h c #3E51A3",
-"i c #D0D3DC",
-"j c #A1B6EF",
-"k c #A2B6F0",
-"l c #A1B6F0",
-"m c #A3B6F0",
-"n c #A0B6EF",
-"o c #9DB6EE",
-"p c #9CB5EF",
-"q c #9CB2F0",
-"r c #9FB5EE",
-"s c #9CB4EB",
-"t c #9AB3EC",
-"u c #9AB0EC",
-"v c #9DB3EB",
-"w c #9BB4EC",
-"x c #9BB4EE",
-"y c #9BB1EF",
-"z c #9BB0F0",
-"A c #90ACF0",
-"B c #93ABEE",
-"C c #91A8EB",
-"D c #8BA3E8",
-"E c #88A1E7",
-"F c #809DE9",
-"G c #7A99E8",
-"H c #7491E5",
-"I c #698AE4",
-"J c #6184E3",
-"K c #507EDC",
-"L c #4E7CDB",
-"M c #4F7DDC",
-"N c #5479DA",
-"O c #567BDC",
-"P c #577CDD",
-"Q c #5074DA",
-"R c #5174DB",
-"S c #5175DC",
-"T c #5276DD",
-"U c #4D71DE",
-"V c #4C72D8",
-"W c #3A6CE0",
-"X c #2B49A6",
-"Y c #E0E2DF",
-"Z c #93AAE9",
-"` c #94A9E8",
-" . c #94AAE9",
-".. c #93A9E9",
-"+. c #92AAE9",
-"@. c #8DA9E8",
-"#. c #8CA7E9",
-"$. c #92ABE9",
-"%. c #8EAAE9",
-"&. c #8EA9E9",
-"*. c #8FAAE9",
-"=. c #8CA8E9",
-"-. c #8CA2E7",
-";. c #86A1E6",
-">. c #839EE9",
-",. c #7F9CE9",
-"'. c #7A97E8",
-"). c #7693E7",
-"!. c #6E8EE8",
-"~. c #678AE9",
-"{. c #5D84E3",
-"]. c #577CDF",
-"^. c #4E77DF",
-"/. c #4A70DB",
-"(. c #4870DB",
-"_. c #4870DC",
-":. c #4770E3",
-"<. c #496FDC",
-"[. c #486EDB",
-"}. c #466FE4",
-"|. c #466EE3",
-"1. c #4167D9",
-"2. c #4066D8",
-"3. c #3F66D8",
-"4. c #3D64D7",
-"5. c #3960DA",
-"6. c #476DD9",
-"7. c #446EE5",
-"8. c #305EC8",
-"9. c #8EAAE8",
-"0. c #8FAAE8",
-"a. c #91AAE9",
-"b. c #8FA9E8",
-"c. c #8BA8E8",
-"d. c #8AA7E9",
-"e. c #8BA5EA",
-"f. c #8AA7E8",
-"g. c #87A2E6",
-"h. c #859FE8",
-"i. c #7F9DE8",
-"j. c #7C9AE8",
-"k. c #7B95E7",
-"l. c #7090E8",
-"m. c #6B8BE9",
-"n. c #6386E6",
-"o. c #5881E1",
-"p. c #5479DE",
-"q. c #4D74DE",
-"r. c #476EDB",
-"s. c #446EE1",
-"t. c #446EE0",
-"u. c #446EDF",
-"v. c #446DE0",
-"w. c #426ADF",
-"x. c #3C64DA",
-"y. c #4360CC",
-"z. c #D3D5D2",
-"A. c #E6E3E8",
-"B. c #8DA2E7",
-"C. c #8CA6EA",
-"D. c #8DA3E9",
-"E. c #88A2E7",
-"F. c #87A1E7",
-"G. c #8AA1E7",
-"H. c #849EE9",
-"I. c #7D9AE9",
-"J. c #7B98E8",
-"K. c #7796E5",
-"L. c #7191E7",
-"M. c #688CE9",
-"N. c #6687E5",
-"O. c #5C83E1",
-"P. c #557BDE",
-"Q. c #4F76DE",
-"R. c #4C72DE",
-"S. c #456EDF",
-"T. c #426AD9",
-"U. c #4269D9",
-"V. c #4269D8",
-"W. c #3D64D9",
-"X. c #3A61DA",
-"Y. c #345ED6",
-"Z. c #335ECF",
-"`. c #C6C3C8",
-" + c #86A1E7",
-".+ c #87A2E7",
-"++ c #87A0E7",
-"@+ c #859EE8",
-"#+ c #849DE9",
-"$+ c #7E9BE9",
-"%+ c #7A99E9",
-"&+ c #7A95E5",
-"*+ c #7593E7",
-"=+ c #6F8EE9",
-"-+ c #668AE5",
-";+ c #6386E0",
-">+ c #5B82DF",
-",+ c #5379DE",
-"'+ c #5075DE",
-")+ c #4B6FDC",
-"!+ c #446AD7",
-"~+ c #4269D6",
-"{+ c #4269D5",
-"]+ c #3E65D7",
-"^+ c #C9CAC9",
-"/+ c #869EE9",
-"(+ c #859FE9",
-"_+ c #849FE9",
-":+ c #829DE8",
-"<+ c #819DE8",
-"[+ c #7B9AE9",
-"}+ c #7A96E6",
-"|+ c #7290E8",
-"1+ c #698CE6",
-"2+ c #6689E0",
-"3+ c #5D84E0",
-"4+ c #587FDF",
-"5+ c #5377DD",
-"6+ c #4B74DE",
-"7+ c #496BD8",
-"8+ c #7C9BE9",
-"9+ c #7E9CE9",
-"0+ c #7D9AEA",
-"a+ c #7D9BEA",
-"b+ c #7D98E8",
-"c+ c #7C98E8",
-"d+ c #7796E4",
-"e+ c #7592E6",
-"f+ c #7390E1",
-"g+ c #698DE0",
-"h+ c #6588DE",
-"i+ c #5E84E0",
-"j+ c #5880DF",
-"k+ c #5479DC",
-"l+ c #4F75DE",
-"m+ c #4A6FDB",
-"n+ c #436AD7",
-"o+ c #3F65D7",
-"p+ c #BAC3BE",
-"q+ c #7B9AE8",
-"r+ c #7B9AEA",
-"s+ c #7A9AEA",
-"t+ c #7B99E9",
-"u+ c #7D97E7",
-"v+ c #7D95E6",
-"w+ c #7D95E5",
-"x+ c #7C95E6",
-"y+ c #7493E3",
-"z+ c #7290DF",
-"A+ c #6C8DDE",
-"B+ c #6B89E1",
-"C+ c #6486DF",
-"D+ c #5D81DF",
-"E+ c #567DDE",
-"F+ c #4F73DE",
-"G+ c #496EDA",
-"H+ c #355ED6",
-"I+ c #345ED5",
-"J+ c #7E95E5",
-"K+ c #7C97E8",
-"L+ c #7C97E7",
-"M+ c #7B94E6",
-"N+ c #7A95E4",
-"O+ c #7695E5",
-"P+ c #7694E4",
-"Q+ c #7994E6",
-"R+ c #7995E4",
-"S+ c #7594E4",
-"T+ c #7391E2",
-"U+ c #6E8EDE",
-"V+ c #6B8ADE",
-"W+ c #6688DF",
-"X+ c #5F84E0",
-"Y+ c #5980E0",
-"Z+ c #4D72DD",
-"`+ c #456BD7",
-" @ c #4168D6",
-".@ c #3C64D7",
-"+@ c #335ED0",
-"@@ c #4659C7",
-"#@ c #7292E1",
-"$@ c #7392E1",
-"%@ c #7492E1",
-"&@ c #718FDF",
-"*@ c #6F8EDE",
-"=@ c #6D8BDE",
-"-@ c #6B88DF",
-";@ c #597FDF",
-">@ c #557ADD",
-",@ c #5176DC",
-"'@ c #4D74DD",
-")@ c #496DDA",
-"!@ c #3860D8",
-"~@ c #7391E0",
-"{@ c #7290DE",
-"]@ c #6D8EDD",
-"^@ c #6D8DDD",
-"/@ c #7190E0",
-"(@ c #6C8DDD",
-"_@ c #6B89DF",
-":@ c #6487E0",
-"<@ c #6085DF",
-"[@ c #5F81DE",
-"}@ c #567EDE",
-"|@ c #4F74D9",
-"1@ c #466BD7",
-"2@ c #4067D5",
-"3@ c #3C63D7",
-"4@ c #335ED3",
-"5@ c #335ED1",
-"6@ c #718EDD",
-"7@ c #728EDD",
-"8@ c #748EDD",
-"9@ c #708EDD",
-"0@ c #6F8DDD",
-"a@ c #6E8DDD",
-"b@ c #6C8ADE",
-"c@ c #6C89DF",
-"d@ c #6988DF",
-"e@ c #6387DF",
-"f@ c #6282DE",
-"g@ c #5681E0",
-"h@ c #577BDD",
-"i@ c #5277DB",
-"j@ c #4D73D8",
-"k@ c #4A70D8",
-"l@ c #436AD5",
-"m@ c #3F66D6",
-"n@ c #3C63D8",
-"o@ c #3960D8",
-"p@ c #3860D7",
-"q@ c #335ED2",
-"r@ c #345ED4",
-"s@ c #6C88DF",
-"t@ c #6D88DF",
-"u@ c #6B89DE",
-"v@ c #6888DF",
-"w@ c #6587E0",
-"x@ c #6989DF",
-"y@ c #6687E0",
-"z@ c #6287E0",
-"A@ c #6281DD",
-"B@ c #5881E0",
-"C@ c #557ADB",
-"D@ c #5176D9",
-"E@ c #4E75D7",
-"F@ c #4A6FD8",
-"G@ c #476BD6",
-"H@ c #4067D6",
-"I@ c #3C62D7",
-"J@ c #3C60D4",
-"K@ c #365ED1",
-"L@ c #345ED3",
-"M@ c #6786DF",
-"N@ c #5F85E0",
-"O@ c #5F86E0",
-"P@ c #6186DF",
-"Q@ c #6286E0",
-"R@ c #6284DF",
-"S@ c #6384DF",
-"T@ c #5B7FDE",
-"U@ c #577DDC",
-"V@ c #557BDA",
-"W@ c #5278D8",
-"X@ c #4E76D6",
-"Y@ c #4C72D7",
-"Z@ c #486DD8",
-"`@ c #4469D6",
-" # c #3F62D2",
-".# c #3C60CF",
-"+# c #345ECF",
-"@# c #6086DF",
-"## c #6085E0",
-"$# c #6285DF",
-"%# c #6383DD",
-"&# c #6481DC",
-"*# c #6380DD",
-"=# c #6183DE",
-"-# c #6083DD",
-";# c #6081DC",
-"># c #6080DD",
-",# c #6083DE",
-"'# c #6181DC",
-")# c #6280DD",
-"!# c #577EDB",
-"~# c #557CD7",
-"{# c #4F76D6",
-"]# c #4E74D7",
-"^# c #466CD7",
-"/# c #3B64D6",
-"(# c #4261CD",
-"_# c #375FCE",
-":# c #5A7FD8",
-"<# c #6281DA",
-"[# c #5F81D8",
-"}# c #5C80D8",
-"|# c #557DD7",
-"1# c #577ED8",
-"2# c #567ED7",
-"3# c #587DD8",
-"4# c #577DD8",
-"5# c #587ED8",
-"6# c #567DD8",
-"7# c #5379D9",
-"8# c #5177D7",
-"9# c #4D74D5",
-"0# c #486ED9",
-"a# c #4068D4",
-"b# c #3D65D2",
-"c# c #4361CC",
-"d# c #345ECE",
-"e# c #325DCF",
-"f# c #2C5AD1",
-"g# c #3959C5",
-"h# c #547BD8",
-"i# c #567DD7",
-"j# c #557BD8",
-"k# c #5279D9",
-"l# c #5278D9",
-"m# c #4D74D6",
-"n# c #4B71D8",
-"o# c #496CD8",
-"p# c #4669D7",
-"q# c #3D66D3",
-"r# c #3F62CF",
-"s# c #4260CC",
-"t# c #5379D8",
-"u# c #4E75D4",
-"v# c #4C73D7",
-"w# c #476CD7",
-"x# c #4869D0",
-"y# c #4067D2",
-"z# c #3D64D1",
-"A# c #4261CC",
-"B# c #395FCE",
-"C# c #4F75D3",
-"D# c #5074D2",
-"E# c #5174D1",
-"F# c #5175D1",
-"G# c #4F74D3",
-"H# c #4C73D5",
-"I# c #4C73D4",
-"J# c #4A72D1",
-"K# c #4B70CF",
-"L# c #506CCC",
-"M# c #4D6BCE",
-"N# c #4167D0",
-"O# c #3D65D1",
-"P# c #3F63CF",
-"Q# c #3B5FCD",
-"R# c #3159CD",
-"S# c #4971D0",
-"T# c #4870CF",
-"U# c #4C6FCF",
-"V# c #4E6CCE",
-"W# c #4E6BCE",
-"X# c #4769CF",
-"Y# c #3D66D0",
-"Z# c #3C65D1",
-"`# c #4062CE",
-" $ c #3D5FCD",
-".$ c #365FCF",
-"+$ c #325DCD",
-"@$ c #2D5AD0",
-"#$ c #3859C5",
-"$$ c #355FCF",
-"%$ c #355ECF",
-"&$ c #335ECE",
-"*$ c #305CCD",
-"=$ c #2B5ACE",
-"-$ c #3056C9",
-";$ c #2553C6",
-">$ c #2153C8",
-",$ c #1F4FC7",
-"'$ c #274CC5",
-")$ c #214AC7",
-"!$ c #1C48C8",
-"~$ c #1244C9",
-"{$ c #1043C9",
-"]$ c #1144C9",
-"^$ c #2A45BE",
-"/$ c #2744B5",
-"($ c #1D49C0",
-"_$ c #2B58DE",
-":$ c #002D94",
-"<$ c #2B59CA",
-"[$ c #2A59CA",
-"}$ c #2E57C8",
-"|$ c #3255C6",
-"1$ c #3355C5",
-"2$ c #1C52C8",
-"3$ c #1D50C7",
-"4$ c #234FC6",
-"5$ c #264CC5",
-"6$ c #1D48C7",
-"7$ c #1245C8",
-"8$ c #1F44C2",
-"9$ c #2945BE",
-"0$ c #2A45BD",
-"a$ c #2040BF",
-"b$ c #3156C7",
-"c$ c #3056C7",
-"d$ c #3354C5",
-"e$ c #3355C6",
-"f$ c #3255C5",
-"g$ c #3254C5",
-"h$ c #1952C7",
-"i$ c #1951C8",
-"j$ c #2050C7",
-"k$ c #274CC4",
-"l$ c #244CC6",
-"m$ c #1F49C7",
-"n$ c #1E47C5",
-"o$ c #2045C3",
-"p$ c #1C44BF",
-"q$ c #2045BE",
-"r$ c #2040B8",
-"s$ c #3254C6",
-"t$ c #3055C6",
-"u$ c #2A54C6",
-"v$ c #2353C7",
-"w$ c #3054C5",
-"x$ c #2F55C5",
-"y$ c #2A54C5",
-"z$ c #2553C5",
-"A$ c #2F54C5",
-"B$ c #3155C6",
-"C$ c #2A54C7",
-"D$ c #1A52C8",
-"E$ c #204FC2",
-"F$ c #264DC6",
-"G$ c #234BC5",
-"H$ c #1D48C1",
-"I$ c #1E48BF",
-"J$ c #2646BE",
-"K$ c #2B45BD",
-"L$ c #1E43BE",
-"M$ c #2643BF",
-"N$ c #2243BF",
-"O$ c #3049BC",
-"P$ c #1E50BE",
-"Q$ c #1D50C0",
-"R$ c #1D50BF",
-"S$ c #1852C1",
-"T$ c #1E51C0",
-"U$ c #214FBF",
-"V$ c #2050C0",
-"W$ c #244EBF",
-"X$ c #2151C0",
-"Y$ c #234FBF",
-"Z$ c #2350C0",
-"`$ c #2351C0",
-" % c #244FBF",
-".% c #2250C0",
-"+% c #2051C0",
-"@% c #1E50C0",
-"#% c #244DBE",
-"$% c #274DBF",
-"%% c #244CBF",
-"&% c #1C48C0",
-"*% c #2247BF",
-"=% c #2C44BD",
-"-% c #1C44BE",
-";% c #1444BF",
-">% c #1841BF",
-",% c #1F40BF",
-"'% c #254DBE",
-")% c #224FBE",
-"!% c #224FBF",
-"~% c #234EBF",
-"{% c #254CBD",
-"]% c #244DBD",
-"^% c #244CBD",
-"/% c #264DBE",
-"(% c #264DBD",
-"_% c #214BC0",
-":% c #1D48C0",
-"<% c #2347BF",
-"[% c #2B44BD",
-"}% c #2444BE",
-"|% c #0F42BF",
-"1% c #0641BF",
-"2% c #0F41BF",
-"3% c #1741BE",
-"4% c #1F40BD",
-"5% c #234BBF",
-"6% c #234CBE",
-"7% c #214BBE",
-"8% c #244CBE",
-"9% c #214ABE",
-"0% c #214ABF",
-"a% c #1F48C0",
-"b% c #2746BE",
-"c% c #1F43BE",
-"d% c #0941BE",
-"e% c #0342BA",
-"f% c #0242BC",
-"g% c #1241B8",
-"h% c #1F40B7",
-"i% c #2F41AC",
-"j% c #2644AE",
-"k% c #2D49B4",
-"l% c #2649B6",
-"m% c #2949B7",
-"n% c #2849B5",
-"o% c #2149B8",
-"p% c #1E49B9",
-"q% c #1F48B8",
-"r% c #1F49B9",
-"s% c #2545B6",
-"t% c #2744B7",
-"u% c #2844B7",
-"v% c #2043B8",
-"w% c #1241B7",
-"x% c #1340B8",
-"y% c #0D41B8",
-"z% c #1941B8",
-"A% c #1F40B8",
-"B% c #203FB8",
-"C% c #2549B5",
-"D% c #2648B6",
-"E% c #2547B7",
-"F% c #2248B7",
-"G% c #2048B7",
-"H% c #2346B6",
-"I% c #2146B6",
-"J% c #2247B7",
-"K% c #2148B7",
-"L% c #2743B4",
-"M% c #2643B5",
-"N% c #2542B6",
-"O% c #1D42B7",
-"P% c #0E42B8",
-"Q% c #0C41B8",
-"R% c #1341B8",
-"S% c #1740B8",
-"T% c #1C41B8",
-"U% c #1F40B1",
-"V% c #2644B5",
-"W% c #2544B5",
-"X% c #2544B4",
-"Y% c #2444B5",
-"Z% c #2444B4",
-"`% c #2744B4",
-" & c #2241B7",
-".& c #1D41B8",
-"+& c #0B42B8",
-"@& c #0942B8",
-"#& c #0C42B8",
-"$& c #0F41B8",
-"%& c #1641B8",
-"&& c #2442B5",
-"*& c #2543B3",
-"=& c #2342B2",
-"-& c #2341B4",
-";& c #2141B3",
-">& c #2141B5",
-",& c #2140B5",
-"'& c #2040B5",
-")& c #1C40B7",
-"!& c #1B41B3",
-"~& c #0142B6",
-"{& c #0E41B7",
-"]& c #1141B7",
-"^& c #1440B2",
-"/& c #113FB0",
-"(& c #1440B0",
-"_& c #213EAF",
-":& c #233DAE",
-"<& c #223EAF",
-"[& c #1E40B1",
-"}& c #173EAD",
-"|& c #1440AF",
-"1& c #0D40AF",
-"2& c #0941B0",
-"3& c #0D3FAE",
-"4& c #1B3CAC",
-"5& c #233CAD",
-"6& c #203FB0",
-"7& c #273BAD",
-"8& c #1D40B0",
-"9& c #2040B1",
-"0& c #1E40B0",
-"a& c #1C40B0",
-"b& c #1B3DAC",
-"c& c #143DAC",
-"d& c #193DAD",
-"e& c #1B3DAD",
-"f& c #173DAD",
-"g& c #153DAC",
-"h& c #1C3CAC",
-"i& c #243CAD",
-"j& c #213FB0",
-"k& c #263BAA",
-"l& c #253CAE",
-"m& c #273AAC",
-"n& c #273AAD",
-"o& c #253BAD",
-"p& c #1D3CAC",
-"q& c #243BAD",
-"r& c #1E3CAC",
-"s& c #263BAD",
-"t& c #1A3DAC",
-"u& c #143DAB",
-"v& c #163DAC",
-"w& c #1A3CAC",
-"x& c #1F3CAD",
-"y& c #263BAB",
-"z& c #263BA6",
-"A& c #1E42A4",
-"B& c #2D40A5",
-"C& c #253BA6",
-"D& c #253CA7",
-"E& c #263AA5",
-"F& c #253BA7",
-"G& c #1E3BA6",
-"H& c #193DA6",
-"I& c #173DA5",
-"J& c #143DA6",
-"K& c #1A3DA7",
-"L& c #133DA6",
-"M& c #123DA5",
-"N& c #1A3CA7",
-"O& c #243BA6",
-"P& c #263AA7",
-"Q& c #273BA7",
-"R& c #263AA6",
-"S& c #223BA6",
-"T& c #1D3BA6",
-"U& c #173CA6",
-"V& c #133DA5",
-"W& c #1B3DA6",
-"X& c #193DA5",
-"Y& c #123DA4",
-"Z& c #163CA5",
-"`& c #213CA6",
-" * c #273BA8",
-".* c #263BA7",
-"+* c #253BA5",
-"@* c #263BA5",
-"#* c #1C3BA6",
-"$* c #1B3BA9",
-"%* c #133BA8",
-"&* c #0A3BA7",
-"** c #083AA6",
-"=* c #123CA5",
-"-* c #0839A8",
-";* c #0239A6",
-">* c #123AA8",
-",* c #1F49C8",
-"'* c #2F4DA4",
-")* c #2E4DA3",
-"!* c #384CA4",
-"~* c #3C4DA7",
-"{* c #394EA7",
-"]* c #3B4CA5",
-"^* c #3C52B1",
-"/* c #3551A8",
-"(* c #3759BE",
-"_* c #4161C7",
-":* c #0033A8",
-"<* c #596FA9",
-"[* c #2F4DA3",
-"}* c #2D4BA5",
-"|* c #2E4CA4",
-"1* c #2C4AA5",
-"2* c #2D4BA4",
-"3* c #354DA4",
-"4* c #3A4BA4",
-"5* c #394DA6",
-"6* c #4056AD",
-"7* c #445BBB",
-"8* c #B5B7B4",
-"9* c #1B2F85",
-"0* c #242F79",
-"a* c #B5B5B5",
-"b* c #B5B2B6",
-"c* c #C0C3C3",
-"d* c #E3E3E4",
-"e* c #EBEDEA",
-". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ",
-"2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ",
-"j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ",
-"Z ` . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ",
-"9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ",
-"-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ",
-" +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ",
-"/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ",
-"8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ",
-"q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.",
-"J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @4.4..@5.5.5.5.5.5.Y.Y.Y.I+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ",
-"#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @4.X.5.5.H+Y.Y.Y.!@Y.Y.I++@+@Z.Z.+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.",
-"#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@3@5.5.5.Y.Y.I+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ",
-"6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@p@Y.I+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.",
-"s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ",
-"M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.",
-"@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ",
-":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.",
-"h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ",
-"l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.",
-"C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ",
-"S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.",
-"+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ",
-"<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.",
-"b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ",
-"e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.",
-"P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ",
-"'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.",
-"5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ",
-"k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.",
-"C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ",
-"/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.",
-"&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ",
-"U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.",
-"U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ",
-"k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.",
-"C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ",
-"z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.",
-"z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ",
-"'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ",
-"'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ",
-"9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ",
-"a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ",
-"c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ",
-"d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ",
-"e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "};
-
-
-static char * tabmiddle_xpm[] = {
-"33 42 32 1",
-" c None",
-". c #CECFEF",
-"+ c #CECBE7",
-"@ c #C6C7E7",
-"# c #C6CBE7",
-"$ c #BDBEDE",
-"% c #BDC3DE",
-"& c #CECBEF",
-"* c #B5B6D6",
-"= c #ADAECE",
-"- c #ADB2CE",
-"; c #BDBAD6",
-"> c #B5BAD6",
-", c #C6C3DE",
-"' c #ADAAC6",
-") c #B5B2CE",
-"! c #B5B6CE",
-"~ c #A5A2BD",
-"{ c #A5A6BD",
-"] c #9C9EB5",
-"^ c #9CA2BD",
-"/ c #ADAEC6",
-"( c #C6C3E7",
-"_ c #9C9AB5",
-": c #A5A6C6",
-"< c #949AAD",
-"[ c #A5AAC6",
-"} c #9496AD",
-"| c #BDBADE",
-"1 c #BDBED6",
-"2 c #9CA2B5",
-"3 c #A5AABD",
-"..........................+@.#.#.",
-"........................$@%&#.#..",
-"......................**$$@@&#.#.",
-".....................=-;>,%+@.#..",
-"....................'')!$$@@&#.#.",
-"...................~{=)$$@@&#.#..",
-"..................]^'/;;(%&#.#...",
-"................._]:/*>,%&@.#.#..",
-".................<{[)!$%+@.#.#...",
-"................}~{=!$%@@.#......",
-"................]^/-|$@@.#.......",
-"................]'/*;@@&#........",
-"...............<~[)>,%&#.#.......",
-"...............]~=)$%+#.#........",
-"...............]'/;1@@.#.........",
-"...............~{)*,%&#..........",
-"...............2/-$$@#...........",
-"...............~[*>(@&#..........",
-"...............^=)$%+#...........",
-"...............{'*>(@.#..........",
-"...............^=)$%+#...........",
-"...............{'*>(@.#..........",
-"...............^=)$%+#...........",
-"...............{'*>(@.#..........",
-"...............^=)$%+#...........",
-"...............{'*>(@.#..........",
-"...............^=)$%+#...........",
-"...............{'*>@@.#..........",
-"...............^=!$%&#...........",
-"...............{/*;@@.#..........",
-"...............{)!$%&#...........",
-"..............]'/;1@@.#..........",
-"..............23)>,%&#...........",
-"..............~=-$$@@.#..........",
-".............]{/*;@@.#...........",
-"............<^[)>,%&#............",
-"............]{/!$%@@.#...........",
-"..........]^[-!$%@@.#............",
-".........]^3/!>$@@.#.............",
-".......<]^3/!>$@@&#..............",
-".....<]2{[/!>$%@&#.#.............",
-"}<<_]2{3/-!>$%@&#.#.............."};
-
-
-static char * tabselectedbeginn_xpm[] = {
-"33 39 28 1",
-" c None",
-". c #CECFEF",
-"+ c #EFF3EF",
-"@ c #FFFBFF",
-"# c #F7FBF7",
-"$ c #FFFFFF",
-"% c #EFEFEF",
-"& c #F7F7F7",
-"* c #DEDFDE",
-"= c #E7E7E7",
-"- c #D6D3D6",
-"; c #DEE3DE",
-"> c #EFEBEF",
-", c #F7F3F7",
-"' c #CECBCE",
-") c #CECFCE",
-"! c #D6D7D6",
-"~ c #DEDBDE",
-"{ c #E7EBE7",
-"] c #C6C7C6",
-"^ c #E7E3E7",
-"/ c #BDC3BD",
-"( c #CED3CE",
-"_ c #BDBABD",
-": c #C6C3C6",
-"< c #C6CBC6",
-"[ c #D6DBD6",
-"} c #BDBEBD",
-"..........................+@#$#$$",
-"........................%%&&@#$#$",
-"......................*==%%&&@#$$",
-"....................--*;>%,&@#$#$",
-"...................')!~={,+@#$#$$",
-"...................]-!^=%%&&@#$#$",
-"................../'(~;>%&&@#$#$$",
-"................._])!*={,&@#$#$$$",
-"................_])~*>%&&$#$$$$$$",
-"................:<![={&&@#$$$$$$$",
-"................:)!^=,+@#$$$$$$$$",
-"...............}'(*^%+@#$#$$$$$$$",
-"...............:<!*>%&&$#$$$$$$$$",
-".............../)!^{,&@#$$$$$$$$$",
-"...............](*^%+@#$$$$$$$$$$",
-"...............]!~=%&&$$$$$$$$$$$",
-"...............'(*=,+@#$$$$$$$$$$",
-"...............<!*>%&&$$$$$$$$$$$",
-"...............'-^=,+@#$$$$$$$$$$",
-"...............<!*>%&#$$$$$$$$$$$",
-"...............'-^=,+@#$$$$$$$$$$",
-"...............<!*>%&#$$$$$$$$$$$",
-"...............'-^=,+@#$$$$$$$$$$",
-"...............<!*>%&#$$$$$$$$$$$",
-"...............'-^=,+@#$$$$$$$$$$",
-"...............<!*>%&#$$$$$$$$$$$",
-"...............'!^=,&@#$$$$$$$$$$",
-"...............<~*>%&#$$$$$$$$$$$",
-"...............)!^{,&@#$$$$$$$$$$",
-"..............])~;%+@#$$$$$$$$$$$",
-"..............]-[={&&$#$$$$$$$$$$",
-".............])!^=,&@#$$$$$$$$$$$",
-"............:'-*^%+@#$$$$$$$$$$$$",
-"............])~*>%&&$#$$$$$$$$$$$",
-"...........:'!*={,&@#$$$$$$$$$$$$",
-"..........:'-~^=,+@#$$$$$$$$$$$$$",
-".......}]'-~^=%,&@#$$$$$$$$$$$$$$",
-".....}:])-~^=%,+@#$#$$$$$$$$$$$$$",
-"}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"};
-
-
-static char * tabselectedend_xpm[] = {
-"33 42 33 1",
-" c None",
-". c #FFFFFF",
-"+ c #CECBE7",
-"@ c #C6C7E7",
-"# c #CECFEF",
-"$ c #C6CBE7",
-"% c #BDBEDE",
-"& c #BDC3DE",
-"* c #CECBEF",
-"= c #B5B6D6",
-"- c #ADAECE",
-"; c #ADB2CE",
-"> c #BDBAD6",
-", c #B5BAD6",
-"' c #C6C3DE",
-") c #ADAAC6",
-"! c #B5B2CE",
-"~ c #B5B6CE",
-"{ c #A5A2BD",
-"] c #A5A6BD",
-"^ c #9C9EB5",
-"/ c #9CA2BD",
-"( c #ADAEC6",
-"_ c #C6C3E7",
-": c #9C9AB5",
-"< c #A5A6C6",
-"[ c #949AAD",
-"} c #A5AAC6",
-"| c #9496AD",
-"1 c #BDBADE",
-"2 c #BDBED6",
-"3 c #9CA2B5",
-"4 c #A5AABD",
-"..........................+@#$#$#",
-"........................%@&*$#$##",
-"......................==%%@@*$#$#",
-".....................-;>,'&+@#$##",
-"....................))!~%%@@*$#$#",
-"...................{]-!%%@@*$#$##",
-"..................^/)(>>_&*$#$###",
-".................:^<(=,'&*@#$#$##",
-".................[]}!~%&+@#$#$###",
-"................|{]-~%&@@#$######",
-"................^/(;1%@@#$#######",
-"................^)(=>@@*$########",
-"...............[{}!,'&*$#$#######",
-"...............^{-!%&+$#$########",
-"...............^)(>2@@#$#########",
-"...............{]!='&*$##########",
-"...............3(;%%@$###########",
-"...............{}=,_@*$##########",
-".............../-!%&+$###########",
-"...............])=,_@#$##########",
-".............../-!%&+$###########",
-"...............])=,_@#$##########",
-".............../-!%&+$###########",
-"...............])=,_@#$##########",
-".............../-!%&+$###########",
-"...............])=,_@#$##########",
-".............../-!%&+$###########",
-"...............])=,@@#$##########",
-".............../-~%&*$###########",
-"...............](=>@@#$##########",
-"...............]!~%&*$###########",
-"..............^)(>2@@#$##########",
-"..............34!,'&*$###########",
-"..............{-;%%@@#$##########",
-".............^](=>@@#$###########",
-"............[/}!,'&*$############",
-"............^](~%&@@#$###########",
-"..........^/};~%&@@#$############",
-".........^/4(~,%@@#$#############",
-".......[^/4(~,%@@*$##############",
-".....[^3]}(~,%&@*$#$#############",
-"|[[:^3]4(;~,%&@*$#$##############"};
-
-
-static char * tabend_xpm[] = {
-"33 42 3 1",
-" c None",
-". c #CECFEF",
-"+ c #FFFFFF",
-"..........................+++++++",
-"........................+++++++++",
-"......................+++++++++++",
-".....................++++++++++++",
-"....................+++++++++++++",
-"...................++++++++++++++",
-"..................+++++++++++++++",
-".................++++++++++++++++",
-".................++++++++++++++++",
-"................+++++++++++++++++",
-"................+++++++++++++++++",
-"................+++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"...............++++++++++++++++++",
-"..............+++++++++++++++++++",
-"..............+++++++++++++++++++",
-"..............+++++++++++++++++++",
-".............++++++++++++++++++++",
-"............+++++++++++++++++++++",
-"............+++++++++++++++++++++",
-"..........+++++++++++++++++++++++",
-".........++++++++++++++++++++++++",
-".......++++++++++++++++++++++++++",
-".....++++++++++++++++++++++++++++",
-"+++++++++++++++++++++++++++++++++"};
-
-
-
-
-QColor fromHsl(QColor c)
-{
- const qreal h = c.hueF();
- const qreal s = c.saturationF();
- const qreal l = c.valueF();
-
- qreal ca[3] = {0, 0, 0};
-
- if (s == 0 || h == 1) {
- // achromatic case
- ca[0] = ca[1] = ca[2] = l;
- } else {
- // chromatic case
- qreal temp2;
- if (l < qreal(0.5))
- temp2 = l * (qreal(1.0) + s);
- else
- temp2 = l + s - (l * s);
-
- const qreal temp1 = (qreal(2.0) * l) - temp2;
- qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
- h,
- h - (qreal(1.0) / qreal(3.0)) };
-
- for (int i = 0; i != 3; ++i) {
- if (temp3[i] < qreal(0.0))
- temp3[i] += qreal(1.0);
- else if (temp3[i] > qreal(1.0))
- temp3[i] -= qreal(1.0);
-
- const qreal sixtemp3 = temp3[i] * qreal(6.0);
-
- if (sixtemp3 < qreal(1.0))
- ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3));
- else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
- ca[i] = (temp2);
- else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
- ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0);
- else ca[i] = temp1;
- }
- }
-
- return QColor::fromRgbF(ca[0], ca[1], ca[2]);
-}
-
-#define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) )
-#define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) )
-
-QColor toHsl(QColor c)
-{
- QColor color;
- qreal h;
- qreal s;
- qreal l;
-
- const qreal r = c.redF();
- const qreal g = c.greenF();
- const qreal b = c.blueF();
- const qreal max = Q_MAX_3(r, g, b);
- const qreal min = Q_MIN_3(r, g, b);
- const qreal delta = max - min;
- const qreal delta2 = max + min;
- const qreal lightness = qreal(0.5) * delta2;
- l = (lightness);
- if (qFuzzyIsNull(delta)) {
- // achromatic case, hue is undefined
- h = 0;
- s = 0;
- } else {
- // chromatic case
- qreal hue = 0;
- if (lightness < qreal(0.5))
- s = ((delta / delta2));
- else
- s = ((delta / (qreal(2.0) - delta2)));
- if (qFuzzyCompare(r, max)) {
- hue = ((g - b) /delta);
- } else if (qFuzzyCompare(g, max)) {
- hue = (2.0 + (b - r) / delta);
- } else if (qFuzzyCompare(b, max)) {
- hue = (4.0 + (r - g) / delta);
- } else {
- Q_ASSERT_X(false, "QColor::toHsv", "internal error");
- }
- hue *= 60.0;
- if (hue < 0.0)
- hue += 360.0;
- h = (hue * 100);
- }
-
- h = h / 36000;
-
- return QColor::fromHsvF(h, s, l);
-}
-
-void tintColor(QColor &color, QColor tintColor, qreal _saturation)
-{
- tintColor = toHsl(tintColor);
- color = toHsl(color);
- qreal hue = tintColor.hueF();
-
- qreal saturation = color.saturationF();
- if (_saturation)
- saturation = _saturation;
- qreal lightness = color.valueF();
- color.setHsvF(hue, saturation, lightness);
-
- color = fromHsl(color);
- color.toRgb();
-}
-
-void tintImagePal(QImage *image, QColor color, qreal saturation)
-{
- QVector<QRgb> colorTable = image->colorTable();
- for (int i=2;i< colorTable.size();i++) {
- QColor c(toHsl(colorTable.at(i)));
- tintColor(c, color, saturation);
- colorTable[i] = c.rgb();
- }
- image->setColorTable(colorTable);
-}
-
-
-void tintImage(QImage *image, QColor color, qreal saturation)
-{
- *image = image->convertToFormat(QImage::Format_RGB32);
-
- for (int x = 0; x < image->width(); x++)
- for (int y = 0; y < image->height(); y++) {
- QColor c(image->pixel(x,y));
- tintColor(c, color, saturation);
- image->setPixel(x, y, c.rgb());
- }
-}
-
-#endif //Q_OS_WINCE_WM
-
-
-enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight };
-
-#ifdef Q_OS_WINCE_WM
-
-void QWindowsMobileStylePrivate::tintImagesButton(QColor color)
-{
- if (currentTintButton == color)
- return;
- currentTintButton = color;
-
- imageTabEnd = QImage(tabend_xpm);
- imageTabSelectedEnd = QImage(tabselectedend_xpm);
- imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
- imageTabMiddle = QImage(tabmiddle_xpm);
- tintImage(&imageTabEnd, color, 0.0);
- tintImage(&imageTabSelectedEnd, color, 0.0);
- tintImage(&imageTabSelectedBegin, color, 0.0);
- tintImage(&imageTabMiddle, color, 0.0);
-
- if (!doubleControls) {
- int height = imageTabMiddle.height() / 2 + 1;
- imageTabEnd = imageTabEnd.scaledToHeight(height);
- imageTabMiddle = imageTabMiddle.scaledToHeight(height);
- imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
- imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
- }
-}
-
-void QWindowsMobileStylePrivate::tintImagesHigh(QColor color)
-{
- if (currentTintHigh == color)
- return;
- currentTintHigh = color;
- tintListViewHighlight(color);
- imageScrollbarHandleUpHigh = imageScrollbarHandleUp;
- imageScrollbarHandleDownHigh = imageScrollbarHandleDown;
- tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8));
- tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8));
-}
-
-void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color)
-{
- imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm);
- tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0));
-
- imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm);
- tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0));
-
- imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm);
- tintImage(&imageListViewHighlightMiddle, color, qreal(0.0));
-
- int height = imageListViewHighlightMiddle.height();
- if (!doubleControls) {
- height = height / 2;
- imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height);
- imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height);
- imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height);
- }
-}
-
-#endif //Q_OS_WINCE_WM
-
-void QWindowsMobileStylePrivate::setupWindowsMobileStyle65()
-{
-#ifdef Q_OS_WINCE_WM
- wm65 = qt_wince_is_windows_mobile_65();
- if (wm65) {
- imageScrollbarHandleUp = QImage(sbhandleup_xpm);
- imageScrollbarHandleDown = QImage(sbhandledown_xpm);
- imageScrollbarGripUp = QImage(sbgripup_xpm);
- imageScrollbarGripDown = QImage(sbgripdown_xpm);
- imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm);
-
- if (!doubleControls) {
- imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2);
- imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2);
- imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2);
- imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2);
- imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2);
- } else {
- }
- tintImagesHigh(Qt::blue);
- }
-#endif //Q_OS_WINCE_WM
-}
-
-void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab)
-{
-#ifndef QT_NO_TABBAR
-#ifdef Q_OS_WINCE_WM
- if (wm65) {
- tintImagesButton(tab->palette.button().color());
- QRect r;
- r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0));
- r.setBottomRight(tab->rect.bottomRight());
- if (tab->state & QStyle::State_Selected) {
- painter->fillRect(tab->rect, tab->palette.window());
- } else {
- painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0)));
- }
- if (tab->selectedPosition == QStyleOptionTab::NextIsSelected) {
- painter->drawImage(r, imageTabSelectedBegin);
- } else if (tab->position == QStyleOptionTab::End ||
- tab->position == QStyleOptionTab::OnlyOneTab) {
- if (!(tab->state & QStyle::State_Selected)) {
- painter->drawImage(r, imageTabEnd);
- }
- } else if (tab->state & QStyle::State_Selected) {
- painter->drawImage(r, imageTabSelectedEnd);
- } else {
- painter->drawImage(r, imageTabMiddle);
- }
- if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) {
- painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd);
- }
- //imageTabBarBig
- return;
- }
-#endif //Q_OS_WINCE_WM
- painter->save();
- painter->setPen(tab->palette.shadow().color());
- if (doubleControls) {
- QPen pen = painter->pen();
- pen.setWidth(2);
- pen.setCapStyle(Qt::FlatCap);
- painter->setPen(pen);
- }
- if(tab->shape == QTabBar::RoundedNorth) {
- if (tab->state & QStyle::State_Selected) {
- painter->fillRect(tab->rect, tab->palette.light());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- }
- else if(tab->shape == QTabBar::RoundedSouth) {
- if (tab->state & QStyle::State_Selected) {
- painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- if (doubleControls)
- painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1));
- else
- painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- }
- else if(tab->shape == QTabBar::RoundedEast) {
- if (tab->state & QStyle::State_Selected) {
- painter->fillRect(tab->rect, tab->palette.light());
- painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft());
- painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
- }
- }
- else if(tab->shape == QTabBar::RoundedWest) {
- if (tab->state & QStyle::State_Selected) {
- painter->fillRect(tab->rect, tab->palette.light());
- painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
- }
- }
- painter->restore();
-#endif //QT_NO_TABBAR
-}
-
-void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItem *option, QRect rect)
-{
-#ifdef Q_OS_WINCE_WM
- if (wm65) {
- QRect r;
- if (rect.isValid())
- r = rect;
- else
- r = option->rect;
- tintImagesHigh(option->palette.highlight().color());
-
- painter->setPen(QColor(Qt::lightGray));
-
- if (option->viewItemPosition == QStyleOptionViewItem::Middle) {
- painter->drawImage(r, imageListViewHighlightMiddle);
- } else if (option->viewItemPosition == QStyleOptionViewItem::Beginning) {
- painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle);
- } else if (option->viewItemPosition == QStyleOptionViewItem::End) {
- painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle);
- } else {
- painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle);
- }
-
- QImage cornerLeft = imageListViewHighlightCornerLeft;
- QImage cornerRight = imageListViewHighlightCornerRight;
-
- int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width();
-
- if ((width * 2) > r.width()) {
- width = (r.width() - 5) / 2;
- }
-
- cornerLeft = cornerLeft.scaled(width, r.height());
- cornerRight = cornerRight.scaled(width, r.height());
-
- if ((option->viewItemPosition == QStyleOptionViewItem::Beginning) || (option->viewItemPosition == QStyleOptionViewItem::OnlyOne) || !option->viewItemPosition) {
- painter->drawImage(r.topLeft(), cornerLeft);
- }
- if ((option->viewItemPosition == QStyleOptionViewItem::End) || (option->viewItemPosition == QStyleOptionViewItem::OnlyOne) || !option->viewItemPosition) {
- painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight);
- }
- return;
- }
-#endif //Q_OS_WINCE_WM
- QPalette::ColorGroup cg = option->state & QStyle::State_Enabled
- ? QPalette::Normal : QPalette::Disabled;
-
- if (rect.isValid())
- painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight));
- else
- painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight));
-}
-
-void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame)
-{
-#ifdef Q_OS_WINCE_WM
- if (wm65) {
- if (newScrollbar->orientation == Qt::Horizontal) {
- QTransform transform;
- transform.rotate(-90);
- QRect r = newScrollbar->rect;
- p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform));
- p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform));
- p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform));
- } else {
- QRect r = newScrollbar->rect;
- p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle);
- p->drawImage(r.topLeft(), imageScrollbarGripUp);
- p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown);
- }
- return ;
- }
-#endif
- if (newScrollbar->orientation == Qt::Horizontal) {
- p->fillRect(newScrollbar->rect,option->palette.button());
- QRect r = newScrollbar->rect;
- p->drawLine(r.topLeft(), r.bottomLeft());
- p->drawLine(r.topRight(), r.bottomRight());
- if (smartphone) {
- p->drawLine(r.topLeft(), r.topRight());
- p->drawLine(r.bottomLeft(), r.bottomRight());
- }
- }
- else {
- p->fillRect(newScrollbar->rect,option->palette.button());
- QRect r = newScrollbar->rect;
- p->drawLine(r.topLeft(), r.topRight());
- p->drawLine(r.bottomLeft(), r.bottomRight());
- if (smartphone) {
- p->drawLine(r.topLeft(), r.bottomLeft());
- p->drawLine(r.topRight(), r.bottomRight());
- }
- }
- if (newScrollbar->state & QStyle::State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*newScrollbar);
- fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2,
- newScrollbar->rect.width() - 5,
- newScrollbar->rect.height() - 5);
- }
- int gripMargin = doubleControls ? 4 : 2;
- int doubleLines = doubleControls ? 2 : 1;
- //If there is a frame around the scrollbar (abstractScrollArea),
- //then the margin is different, because of the missing frame
- int gripMarginFrame = doubleControls ? 3 : 1;
- if (drawCompleteFrame)
- gripMarginFrame = 0;
- //draw grips
- if (!smartphone)
- if (newScrollbar->orientation == Qt::Horizontal) {
- for (int i = -3; i < 3; i += 2) {
- p->drawLine(
- QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1,
- newScrollbar->rect.top() + gripMargin +gripMarginFrame),
- QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1,
- newScrollbar->rect.bottom() - gripMargin));
- }
- } else {
- for (int i = -2; i < 4 ; i += 2) {
- p->drawLine(
- QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame ,
- newScrollbar->rect.center().y() + 1 + i * doubleLines - 1),
- QPoint(newScrollbar->rect.right() - gripMargin,
- newScrollbar->rect.center().y() + 1 + i * doubleLines - 1));
- }
- }
- if (!smartphone) {
- QRect r;
- if (doubleControls)
- r = option->rect.adjusted(1, 1, -1, 0);
- else
- r = option->rect.adjusted(0, 0, -1, 0);
- if (drawCompleteFrame && doubleControls)
- r.adjust(0, 0, 0, -1);
- //Check if the scrollbar is part of an abstractItemView and draw the frame according
- if (drawCompleteFrame)
- p->drawRect(r);
- else
- if (newScrollbar->orientation == Qt::Horizontal)
- p->drawLine(r.topLeft(), r.topRight());
- else
- p->drawLine(r.topLeft(), r.bottomLeft());
- }
-}
-
-void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool )
-{
-#ifdef Q_OS_WINCE_WM
- if (wm65) {
- tintImagesHigh(opt->palette.highlight().color());
- QRect r = opt->rect;
- if (opt->orientation == Qt::Horizontal) {
- QTransform transform;
- transform.rotate(-90);
- if (opt->state & QStyle::State_Sunken)
- p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform));
- else
- p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform));
- } else {
- if (opt->state & QStyle::State_Sunken)
- p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh);
- else
- p->drawImage(r.topLeft(), imageScrollbarHandleUp);
- }
- return ;
- }
-#endif //Q_OS_WINCE_WM
-
- QBrush fill = opt->palette.button();
- if (opt->state & QStyle::State_Sunken)
- fill = opt->palette.shadow();
-
- QStyleOption arrowOpt = *opt;
- if (doubleControls)
- arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3);
- else
- arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3);
-
- bool horizontal = (opt->orientation == Qt::Horizontal);
-
- if (horizontal) {
- p->fillRect(opt->rect,fill);
- QRect r = opt->rect.adjusted(0,0,1,0);
- p->drawLine(r.topRight(), r.bottomRight());
- if (doubleControls)
- arrowOpt.rect.adjust(0, -2 ,0, -2);
- q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0);
- } else {
- p->fillRect(opt->rect,fill);
- QRect r = opt->rect.adjusted(0, 0, 0, 1);
- p->drawLine(r.bottomLeft(), r.bottomRight());
- if (completeFrame)
- arrowOpt.rect.adjust(-2, 0, -2, 0);
- if (doubleControls)
- arrowOpt.rect.adjust(0, -4 , 0, -4);
- if (completeFrame && doubleControls)
- arrowOpt.rect.adjust(2, 0, 2, 0);
- q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0);
- }
-}
-
-void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar)
-{
-#ifndef QT_NO_SCROLLBAR
-#ifdef Q_OS_WINCE_WM
- if (wm65) {
- tintImagesHigh(opt->palette.highlight().color());
- QRect r = opt->rect;
- if (opt->orientation == Qt::Horizontal) {
- QTransform transform;
- transform.rotate(-90);
- if (opt->state & QStyle::State_Sunken)
- p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform));
- else
- p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform));
- } else {
- if (opt->state & QStyle::State_Sunken)
- p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh);
- else
- p->drawImage(r.topLeft(), imageScrollbarHandleDown);
- }
- return ;
- }
-#endif //Q_OS_WINCE_WM
-
- QBrush fill = opt->palette.button();
- if (opt->state & QStyle::State_Sunken)
- fill = opt->palette.shadow();
-
- QStyleOption arrowOpt = *opt;
- if (doubleControls)
- arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3);
- else
- arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3);
-
- bool horizontal = (opt->orientation == Qt::Horizontal);
-
- if (horizontal) {
- p->fillRect(opt->rect,fill);
- QRect r = opt->rect.adjusted(0, 0, 0, 0);
- p->drawLine(r.topLeft(), r.bottomLeft());
- if (secondScrollBar)
- p->drawLine(r.topRight(), r.bottomRight());
- if (doubleControls)
- arrowOpt.rect.adjust(0, 4, 0, 4 );
- q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0);
- } else {
- p->fillRect(opt->rect,fill);
- QRect r = opt->rect.adjusted(0, -1, 0, -1);
- p->drawLine(r.topLeft(), r.topRight());
- if (secondScrollBar)
- p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1));
- if (completeFrame)
- arrowOpt.rect.adjust(-2, 0, -2, 0);
- if (doubleControls)
- arrowOpt.rect.adjust(1, 0, 1, 0 );
- if (completeFrame && doubleControls)
- arrowOpt.rect.adjust(1, 0, 1, 0);
- q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0);
- }
-#endif //QT_NO_SCROLLBAR
-}
-
-void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt)
-{
-#ifndef QT_NO_SCROLLBAR
-#ifdef Q_OS_WINCE_WM
- if (wm65) {
- p->fillRect(opt->rect, QColor(231, 231, 231));
- return ;
- }
-#endif
- QBrush fill;
- if (smartphone) {
- fill = opt->palette.light();
- p->fillRect(opt->rect, fill);
- fill = opt->palette.button();
- QImage image;
-#ifndef QT_NO_IMAGEFORMAT_XPM
- if (opt->orientation == Qt::Horizontal)
- image = QImage(vertlines_xpm);
- else
- image = QImage(horlines_xpm);
-#endif
- image.setColor(1, opt->palette.button().color().rgb());
- fill.setTextureImage(image);
- }
- else {
- fill = opt->palette.light();
- }
- p->fillRect(opt->rect, fill);
-#endif //QT_NO_SCROLLBAR
-}
-
-QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) {
- qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
- qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
-}
-
-QWindowsMobileStyle::QWindowsMobileStyle() : QWindowsStyle(*new QWindowsMobileStylePrivate) {
- qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
- qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
-}
-
-QWindowsMobileStyle::~QWindowsMobileStyle()
-{
-}
-
-QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() {
-
-#ifdef Q_OS_WINCE
- doubleControls = qt_wince_is_high_dpi();
- smartphone = qt_wince_is_smartphone();
-#else
- doubleControls = false;
- smartphone = false;
-#endif //Q_OS_WINCE
-
-#ifndef QT_NO_IMAGEFORMAT_XPM
-
- imageArrowDown = QImage(arrowdown_xpm);
- imageArrowUp = QImage(arrowdown_xpm).mirrored();
- imageArrowLeft = QImage(arrowleft_xpm);
- imageArrowRight = QImage(arrowleft_xpm).mirrored(true, false);
- if (doubleControls) {
- imageRadioButton = QImage(radiobutton_xpm);
- imageRadioButtonChecked = QImage(radiochecked_xpm);
- imageChecked = QImage(checkedlight_xpm);
- imageCheckedBold = QImage(checkedbold_xpm);
- imageRadioButtonHighlighted = QImage(highlightedradiobutton_xpm);
- imageClose = QImage(cross_big_xpm);
- imageMaximize = QImage(max_big_xpm);
- imageMinimize = QImage(min_big_xpm);
- imageNormalize = QImage(normal_big_xpm);
- } else {
- imageRadioButton = QImage(radiobutton_low_xpm);
- imageRadioButtonChecked = QImage(radiochecked_low_xpm);
- imageChecked = QImage(checkedlight_low_xpm);
- imageCheckedBold = QImage(checkedbold_low_xpm);
- imageRadioButtonHighlighted = QImage(highlightedradiobutton_low_xpm);
- imageClose = QImage(cross_small_xpm);
- imageMaximize = QImage(max_small_xpm);
- imageMinimize = QImage(min_small_xpm);
- imageNormalize = QImage(normal_small_xpm);
- }
-
- setupWindowsMobileStyle65();
-
-
- imageArrowDownBig = QImage(arrowdown_big_xpm);
- imageArrowUpBig = QImage(arrowdown_big_xpm).mirrored();
- imageArrowLeftBig = QImage(arrowleft_big_xpm);
- imageArrowRightBig = QImage(arrowleft_big_xpm).mirrored(true, false);
-
-#endif
-}
-
-void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
- bool doRestore = false;
- QRect rect = option->rect;
- painter->setClipping(false);
-
- switch (element) {
- case PE_PanelButtonTool: {
- int penSize = 1;
- if (d->doubleControls)
- penSize = 2;
- if (widget)
- if (QWidget *parent = widget->parentWidget())
-#ifndef QT_NO_TABWIDGET
- if (qobject_cast<QTabWidget *>(parent->parentWidget())) {
-#else
- if (false) {
-#endif //QT_NO_TABBAR
- rect.adjust(0,2*penSize,0,-1*penSize);
- qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light());
- if (option->state & (State_Sunken))
- qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.shadow());
- }
- else {
- if (!(option->state & State_AutoRaise) || (option->state & (State_Sunken | State_On)))
- qDrawPlainRect(painter,option->rect.adjusted(0, penSize, 0, -1 * penSize) ,
- option->palette.button().color(), 0, &option->palette.button());
- if (option->state & (State_Sunken)) {
- qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light());
- }
- if (option->state & (State_On)){
- QBrush fill = QBrush(option->palette.light().color());
- painter->fillRect(rect.adjusted(windowsItemFrame , windowsItemFrame ,
- -windowsItemFrame , -windowsItemFrame ), fill);
- qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light());
- }
- }
- break; }
- case PE_IndicatorButtonDropDown:
- if (d->doubleControls)
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.button());
- else
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.button());
- break;
-#ifndef QT_NO_TABBAR
- case PE_IndicatorTabTear:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- bool rtl = tab->direction == Qt::RightToLeft;
- QRect rect = tab->rect;
- QPainterPath path;
- rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3));
- rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2));
- path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top()));
- int count = 3;
- for(int jags = 1; jags <= count; ++jags, rtl = !rtl)
- path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count));
- painter->setPen(QPen(tab->palette.light(), qreal(.8)));
- painter->setBrush(tab->palette.background());
- painter->setRenderHint(QPainter::Antialiasing);
- painter->drawPath(path);
- }
- break;
-#endif //QT_NO_TABBAR
-
-#ifndef QT_NO_TOOLBAR
- case PE_IndicatorToolBarSeparator: {
- painter->save();
- QPoint p1, p2;
- if (option->state & State_Horizontal) {
- p1 = QPoint(option->rect.width()/2, 0);
- p2 = QPoint(p1.x(), option->rect.height());
- } else {
- p1 = QPoint(0, option->rect.height()/2);
- p2 = QPoint(option->rect.width(), p1.y());
- }
-
-
- painter->setPen(option->palette.mid().color());
- if (d->doubleControls) {
- QPen pen = painter->pen();
- pen.setWidth(2);
- pen.setCapStyle(Qt::FlatCap);
- painter->setPen(pen);
- }
- painter->drawLine(p1, p2);
- painter->restore();
- break; }
-#endif // QT_NO_TOOLBAR
- case PE_IndicatorToolBarHandle:
- painter->save();
- painter->translate(option->rect.x(), option->rect.y());
- if (option->state & State_Horizontal) {
- int x = option->rect.width() / 2 - 4;
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- x -= 2;
- if (option->rect.height() > 4) {
- qDrawWinButton(painter,x-1,0,7,option->rect.height(), option->palette, false, 0);
-
- qDrawShadePanel(painter, x, 1, 3, option->rect.height() - 1,
- option->palette, false, 0);
- qDrawShadePanel(painter, x + 3, 1, 3, option->rect.height() - 1,
- option->palette, false, 0);
- painter->setPen(option->palette.button().color());
- }
- } else {
- if (option->rect.width() > 4) {
- int y = option->rect.height() / 2 - 4;
- qDrawShadePanel(painter, 2, y, option->rect.width() - 2, 3,
- option->palette, false, 0);
- qDrawShadePanel(painter, 2, y + 3, option->rect.width() - 2, 3,
- option->palette, false, 0);
- }
- }
- painter->restore();
- break;
-
-#ifndef QT_NO_PROGRESSBAR
- case PE_IndicatorProgressChunk: {
- bool vertical = false;
- if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option))
- vertical = pb->orientation == Qt::Vertical;
- if (!vertical) {
- painter->fillRect(option->rect.x(), option->rect.y()+2, option->rect.width(), option->rect.height()-4,
- option->palette.brush(QPalette::Highlight));
- } else {
- painter->fillRect(option->rect.x()+2, option->rect.y(), option->rect.width()-4, option->rect.height(),
- option->palette.brush(QPalette::Highlight));
- }
- }
- break;
-#endif // QT_NO_PROGRESSBAR
-
- case PE_FrameButtonTool: {
-#ifndef QT_NO_DOCKWIDGET
- if (widget && widget->inherits("QDockWidgetTitleButton")) {
- if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent()))
- if (dw->isFloating()){
- qDrawPlainRect(painter,option->rect.adjusted(1, 1, 0, 0),
- option->palette.shadow().color(),1,&option->palette.button());
- return;
- }
- }
-#endif // QT_NO_DOCKWIDGET
- QBrush fill;
- bool stippled;
- bool panel = (element == PE_PanelButtonTool);
- if ((!(option->state & State_Sunken ))
- && (!(option->state & State_Enabled)
- || ((option->state & State_Enabled ) && !(option->state & State_MouseOver)))
- && (option->state & State_On)) {
- fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- stippled = true;
- } else {
- fill = option->palette.brush(QPalette::Button);
- stippled = false;
- }
- if (option->state & (State_Raised | State_Sunken | State_On)) {
- if (option->state & State_AutoRaise) {
- if(option->state & (State_Enabled | State_Sunken | State_On)){
- if (panel)
- qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill);
- else
- qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill);
- }
- if (stippled) {
- painter->setPen(option->palette.button().color());
- painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
- }
- } else {
- qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill);
- }
- } else {
- painter->fillRect(option->rect, fill);
- }
- break; }
-
- case PE_FrameFocusRect:
- if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
- //### check for d->alt_down
- int penSize;
- d->doubleControls ? penSize = 2 : penSize = 1;
- bool alternateFocusStyle = false;
- if (!widget)
- alternateFocusStyle = true;
-#ifndef QT_NO_COMBOBOX
- if (qobject_cast<const QComboBox*>(widget))
- alternateFocusStyle = true;
-#endif
- if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, option))
- return;
- QRect r = option->rect;
- painter->save();
- painter->setBackgroundMode(Qt::TransparentMode);
- if (alternateFocusStyle) {
- QColor bg_col = fropt->backgroundColor;
- if (!bg_col.isValid())
- bg_col = painter->background().color();
- // Create an "XOR" color.
- QColor patternCol((bg_col.red() ^ 0xff) & 0xff,
- (bg_col.green() ^ 0xff) & 0xff,
- (bg_col.blue() ^ 0xff) & 0xff);
- painter->setBrush(QBrush(patternCol, Qt::Dense4Pattern));
- painter->setBrushOrigin(r.topLeft());
- }
- else {
- painter->setPen(option->palette.highlight().color());
- painter->setBrush(option->palette.highlight());
- }
- painter->setPen(Qt::NoPen);
- painter->setBrushOrigin(r.topLeft());
- painter->drawRect(r.left(), r.top(), r.width(), penSize); // Top
- painter->drawRect(r.left(), r.bottom(), r.width() + penSize - 1, penSize); // Bottom
- painter->drawRect(r.left(), r.top(), penSize, r.height()); // Left
- painter->drawRect(r.right(), r.top(), penSize, r.height()); // Right
- painter->restore();
- }
- break;
-
- case PE_PanelButtonBevel: {
- QBrush fill;
- bool panel = element != PE_FrameButtonBevel;
- painter->setBrushOrigin(option->rect.topLeft());
- if (!(option->state & State_Sunken) && (option->state & State_On))
- fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- else
- fill = option->palette.brush(QPalette::Button);
-
- if (option->state & (State_Raised | State_On | State_Sunken)) {
- if (d->doubleControls)
- qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),2,&fill);
- else
- qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),1,&fill);
- } else {
- if (panel)
- painter->fillRect(option->rect, fill);
- else
- painter->drawRect(option->rect);
- }
- break; }
-
- case PE_FrameGroupBox:
- if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
-
- if (!(frame->features & QStyleOptionFrame::Flat)) {
- QPen oldPen = painter->pen();
- QRect r = frame->rect;
- painter->setPen(frame->palette.shadow().color());
- painter->fillRect(r.x(), r.y(), r.x() + r.width()-1,
- r.y() + r.height() - windowsMobileFrameGroupBoxOffset,
- frame->palette.light());
- painter ->drawLine(r.topLeft() + QPoint(-2, 1), r.topRight()+ QPoint(0, 1));
- if (d->doubleControls)
- painter ->drawLine(r.topLeft() + QPoint(-2, 2), r.topRight()+ QPoint(0, 2));
- painter->setPen(oldPen);
- }
- }
- break;
-
- case PE_IndicatorCheckBox: {
- QBrush fill;
- QRect r = d->doubleControls ? option->rect.adjusted(0,1,0,-1) : option->rect;
- if (option->state & State_NoChange)
- fill = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern);
- else if (option->state & State_Sunken)
- fill = option->palette.button();
- else if (option->state & State_Enabled)
- fill = option->palette.base();
- else
- fill = option->palette.background();
- painter->save();
- doRestore = true;
- if (d->doubleControls && (option->state & State_NoChange))
- painter->fillRect(r, fill);
- else
- painter->fillRect(option->rect, fill);
- painter->setPen(option->palette.shadow().color());
- painter->drawLine(r.topLeft(), r.topRight());
- painter->drawLine(r.topRight(), r.bottomRight());
- painter->drawLine(r.bottomLeft(), r.bottomRight());
- painter->drawLine(r.bottomLeft(), r.topLeft());
- if (d->doubleControls) {
- QRect r0 = r.adjusted(1, 1, -1, -1);
- painter->drawLine(r0.topLeft(), r0.topRight());
- painter->drawLine(r0.topRight(), r0.bottomRight());
- painter->drawLine(r0.bottomLeft(), r0.bottomRight());
- painter->drawLine(r0.bottomLeft(), r0.topLeft());
- }
- if (option->state & State_HasFocus) {
- painter->setPen(option->palette.highlight().color());
- QRect r2 = d->doubleControls ? r.adjusted(2, 2, -2, -2) : r.adjusted(1, 1, -1, -1);
- painter->drawLine(r2.topLeft(), r2.topRight());
- painter->drawLine(r2.topRight(), r2.bottomRight());
- painter->drawLine(r2.bottomLeft(), r2.bottomRight());
- painter->drawLine(r2.bottomLeft(), r2.topLeft());
- if (d->doubleControls) {
- QRect r3 = r2.adjusted(1, 1, -1, -1);
- painter->drawLine(r3.topLeft(), r3.topRight());
- painter->drawLine(r3.topRight(), r3.bottomRight());
- painter->drawLine(r3.bottomLeft(), r3.bottomRight());
- painter->drawLine(r3.bottomLeft(), r3.topLeft());
- }
- painter->setPen(option->palette.shadow().color());
- }
- //fall through...
- }
- case PE_IndicatorViewItemCheck: {
- if (!doRestore) {
- painter->save();
- doRestore = true;
- }
- if (element == PE_IndicatorViewItemCheck) {
- painter->setPen(option->palette.shadow().color());
- if (option->state & State_NoChange)
- painter->setBrush(option->palette.brush(QPalette::Button));
- if (d->doubleControls) {
- QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize * 2, windowsMobileitemViewCheckBoxSize * 2);
- qDrawPlainRect(painter, r, option->palette.shadow().color(), 2);
- } else {
- QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize);
- qDrawPlainRect(painter, r, option->palette.shadow().color(), 1);
- }
- if (option->state & State_Enabled)
- d->imageChecked.setColor(1, option->palette.shadow().color().rgba());
- else
- d->imageChecked.setColor(1, option->palette.dark().color().rgba());
- if (!(option->state & State_Off)) {
- if (d->doubleControls)
- painter->drawImage(option->rect.x(), option->rect.y(), d->imageChecked);
- else
- painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageChecked);
- }
- }
- else {
- if (option->state & State_NoChange)
- d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba());
- else if (option->state & State_Enabled)
- d->imageCheckedBold.setColor(1, option->palette.shadow().color().rgba());
- else
- d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba());
- if (!(option->state & State_Off)) {
- if (d->doubleControls)
- painter->drawImage(option->rect.x() + 2, option->rect.y(), d->imageCheckedBold);
- else
- painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageCheckedBold);
- }
- }
- if (doRestore)
- painter->restore();
- break; }
- case PE_IndicatorRadioButton: {
- painter->save();
-
- if (option->state & State_HasFocus) {
- d->imageRadioButtonHighlighted.setColor(1, option->palette.shadow().color().rgba());
- d->imageRadioButtonHighlighted.setColor(2, option->palette.highlight().color().rgba());
- painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButtonHighlighted);
- }
- else {
- d->imageRadioButton.setColor(1, option->palette.shadow().color().rgba());
- painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButton);
- }
- if (option->state & (State_Sunken | State_On)) {
- if (option->state & State_Enabled)
- d->imageRadioButtonChecked.setColor(1, option->palette.shadow().color().rgba());
- else
- d->imageRadioButtonChecked.setColor(1, option->palette.dark().color().rgba());
-
- static const int offset = d->doubleControls ? 6 : 3;
- painter->drawImage(option->rect.x() + offset, option->rect.y() + offset, d->imageRadioButtonChecked);
- }
- painter->restore();
- break; }
- case PE_PanelButtonCommand:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QBrush fill;
- State flags = option->state;
- QPalette pal = option->palette;
- QRect r = option->rect;
- if ((flags & State_Sunken || flags & State_On) )
- fill = pal.brush(QPalette::Shadow);
- else
- fill = pal.brush(QPalette::Button);
- int singleLine = 1;
- int doubleLine = 2;
- if (d->doubleControls) {
- singleLine = 2;
- doubleLine = 4;
- }
- if (button->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) {
- if (d->doubleControls) {
- qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill);
- qDrawPlainRect(painter, r.adjusted(1, 1, -1, 1), pal.shadow().color(), 1, &fill);
- }
- else {
- qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill);
- }
- } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) {
- qDrawPlainRect(painter, r, pal.shadow().color(), singleLine, &fill);
- } else {
- painter->fillRect(r, fill);
- }
- }
- break;
- case PE_FrameDefaultButton: {
- painter->save();
- painter->setPen(option->palette.shadow().color());
- QRect rect = option->rect;
- if (d->doubleControls) {
- rect.adjust(1, 1, -2, -2);
- painter->drawRect(rect);
- painter->drawRect(rect.adjusted(1, 1, -1, -1));
- }
-
- else {
- rect.adjust(2, 2, -3, -3);
- painter->drawRect(rect);
- }
- painter->restore();
- break; }
- case PE_IndicatorSpinPlus:
- case PE_IndicatorSpinMinus: {
- QRect r = option->rect;
- int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
- QRect br = r.adjusted(fw, fw, -fw, -fw);
- int offset = (option->state & State_Sunken) ? 1 : 0;
- int step = (br.width() + 4) / 5;
- painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2,
- br.width(), step, option->palette.buttonText());
- if (element == PE_IndicatorSpinPlus)
- painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4,
- step, br.height() - 7, option->palette.buttonText());
- break; }
- case PE_IndicatorSpinUp:
- case PE_IndicatorSpinDown: {
- painter->save();
- QPoint points[7];
- switch (element) {
- case PE_IndicatorSpinUp:
- points[0] = QPoint(-2, -4);
- points[1] = QPoint(-2, 2);
- points[2] = QPoint(-1, -3);
- points[3] = QPoint(-1, 1);
- points[4] = QPoint(0, -2);
- points[5] = QPoint(0, 0);
- points[6] = QPoint(1, -1);
- break;
- case PE_IndicatorSpinDown:
- points[0] = QPoint(0, -4);
- points[1] = QPoint(0, 2);
- points[2] = QPoint(-1, -3);
- points[3] = QPoint(-1, 1);
- points[4] = QPoint(-2, -2);
- points[5] = QPoint(-2, 0);
- points[6] = QPoint(-3, -1);
- break;
- default:
- break;
- }
- if (option->state & State_Sunken)
- painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal),
- proxy()->pixelMetric(PM_ButtonShiftVertical));
- if (option->state & State_Enabled) {
- painter->translate(option->rect.x() + option->rect.width() / 2,
- option->rect.y() + option->rect.height() / 2);
- painter->setPen(option->palette.buttonText().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- } else {
- painter->translate(option->rect.x() + option->rect.width() / 2 + 1,
- option->rect.y() + option->rect.height() / 2 + 1);
- painter->setPen(option->palette.light().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- painter->translate(-1, -1);
- painter->setPen(option->palette.mid().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- }
- painter->restore();
- break; }
-
- case PE_IndicatorArrowUpBig:
- case PE_IndicatorArrowDownBig:
- case PE_IndicatorArrowLeftBig:
- case PE_IndicatorArrowRightBig:
-
- case PE_IndicatorArrowUp:
- case PE_IndicatorArrowDown:
- case PE_IndicatorArrowRight:
- case PE_IndicatorArrowLeft: {
- painter->save();
-
- if (d->doubleControls) {
- QColor color;
- if (option->state & State_Sunken)
- color = option->palette.light().color();
- else
- color = option->palette.buttonText().color();
- QImage image;
- int xoffset, yoffset;
- bool isTabBarArrow = widget && widget->parent()
- && widget->inherits("QToolButton")
- && widget->parent()->inherits("QTabBar");
-
- switch (element) {
- case PE_IndicatorArrowUp:
- image = d->imageArrowUp;
- xoffset = 1;
- yoffset = 12;
- break;
- case PE_IndicatorArrowDown:
- image = d->imageArrowDown;
- xoffset = 1;
- yoffset =12;
- break;
- case PE_IndicatorArrowLeft:
- image = d->imageArrowLeft;
- xoffset = 8;
- yoffset = isTabBarArrow ? 12 : 2;
- break;
- case PE_IndicatorArrowRight:
- image = d->imageArrowRight;
- xoffset = 8;
- yoffset = isTabBarArrow ? 12 : 2;
- break;
- case PE_IndicatorArrowUpBig:
- image = d->imageArrowUpBig;
- xoffset = 3;
- yoffset = 12;
- break;
- case PE_IndicatorArrowDownBig:
- image = d->imageArrowDownBig;
- xoffset = 2;
- yoffset =12;
- break;
- case PE_IndicatorArrowLeftBig:
- image = d->imageArrowLeftBig;
- xoffset = 8;
- yoffset = 2;
- break;
- case PE_IndicatorArrowRightBig:
- image = d->imageArrowRightBig;
- xoffset = 8;
- yoffset = 2;
- break;
- default:
- break;
- }
- image.setColor(1, color.rgba());
- painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image);
- }
- else {
- QPoint points[7];
- switch (element) {
- case PE_IndicatorArrowUp:
- case PE_IndicatorArrowUpBig:
- points[0] = QPoint(-3, 1);
- points[1] = QPoint(3, 1);
- points[2] = QPoint(-2, 0);
- points[3] = QPoint(2, 0);
- points[4] = QPoint(-1, -1);
- points[5] = QPoint(1, -1);
- points[6] = QPoint(0, -2);
- break;
- case PE_IndicatorArrowDown:
- case PE_IndicatorArrowDownBig:
- points[0] = QPoint(-3, -1);
- points[1] = QPoint(3, -1);
- points[2] = QPoint(-2, 0);
- points[3] = QPoint(2, 0);
- points[4] = QPoint(-1, 1);
- points[5] = QPoint(1, 1);
- points[6] = QPoint(0, 2);
- break;
- case PE_IndicatorArrowRight:
- case PE_IndicatorArrowRightBig:
- points[0] = QPoint(-2, -3);
- points[1] = QPoint(-2, 3);
- points[2] = QPoint(-1, -2);
- points[3] = QPoint(-1, 2);
- points[4] = QPoint(0, -1);
- points[5] = QPoint(0, 1);
- points[6] = QPoint(1, 0);
- break;
- case PE_IndicatorArrowLeft:
- case PE_IndicatorArrowLeftBig:
- points[0] = QPoint(0, -3);
- points[1] = QPoint(0, 3);
- points[2] = QPoint(-1, -2);
- points[3] = QPoint(-1, 2);
- points[4] = QPoint(-2, -1);
- points[5] = QPoint(-2, 1);
- points[6] = QPoint(-3, 0);
- break;
- default:
- break;
- }
- if (option->state & State_Sunken)
- painter->setPen(option->palette.light().color());
- else
- painter->setPen(option->palette.buttonText().color());
- if (option->state & State_Enabled) {
- painter->translate(option->rect.x() + option->rect.width() / 2,
- option->rect.y() + option->rect.height() / 2 - 1);
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- } else {
- painter->translate(option->rect.x() + option->rect.width() / 2,
- option->rect.y() + option->rect.height() / 2 - 1);
- painter->setPen(option->palette.mid().color());
- painter->drawLine(points[0], points[1]);
- painter->drawLine(points[2], points[3]);
- painter->drawLine(points[4], points[5]);
- painter->drawPoint(points[6]);
- }
- }
- painter->restore();
- break; }
-#ifndef QT_NO_TABWIDGET
- case PE_FrameTabWidget:
- if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
- QRect rect = option->rect;
- QPalette pal = option->palette;
- painter->save();
- QBrush fill = pal.light();
- painter->fillRect(rect, fill);
- painter->setPen(pal.shadow().color());
- if (d->doubleControls) {
- QPen pen = painter->pen();
- pen.setWidth(2);
- pen.setCapStyle(Qt::FlatCap);
- painter->setPen(pen);
- }
- switch (tab->shape) {
- case QTabBar::RoundedNorth:
-#ifdef Q_OS_WINCE_WM
- if (!d->wm65)
-#endif
- {
- if (d->doubleControls)
- painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
- else
- painter->drawLine(rect.topLeft(), rect.topRight());
- }
- break;
- case QTabBar::RoundedSouth:
-#ifdef Q_OS_WINCE_WM
- if (!d->wm65)
-#endif
- {
- if (d->doubleControls)
- painter->drawLine(rect.bottomLeft(), rect.bottomRight());
- else
- painter->drawLine(rect.bottomLeft(), rect.bottomRight());
- }
- break;
- case QTabBar::RoundedEast:
-#ifdef Q_OS_WINCE_WM
- if (!d->wm65)
-#endif
- painter->drawLine(rect.topRight(), rect.bottomRight());
- break;
- case QTabBar::RoundedWest:
-#ifdef Q_OS_WINCE_WM
- if (!d->wm65)
-#endif
- painter->drawLine(rect.topLeft(), rect.bottomLeft());
- break;
- case QTabBar::TriangularWest:
- case QTabBar::TriangularEast:
- case QTabBar::TriangularSouth:
- case QTabBar::TriangularNorth:
- if (d->doubleControls)
- qDrawPlainRect(painter, rect.adjusted(0,-2,0,0), option->palette.shadow().color(),2,&pal.light());
- else
- qDrawPlainRect(painter, rect, option->palette.shadow().color(),1,&pal.light());
- break;
- default:
- break;
- }
- painter->restore();
- }
- break;
-#endif //QT_NO_TABBAR
-#ifndef QT_NO_ITEMVIEWS
- case PE_PanelItemViewRow:
- if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
- QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
- ? QPalette::Normal : QPalette::Disabled;
- if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
- cg = QPalette::Inactive;
-
- if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget))
- d->drawPanelItemViewSelected(painter, vopt);
- else if (vopt->features & QStyleOptionViewItem::Alternate)
- painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
- else if (!(vopt->state & QStyle::State_Enabled))
- painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base));
- }
- break;
- case PE_PanelItemViewItem:
- if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
- QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
- ? QPalette::Normal : QPalette::Disabled;
- if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
- cg = QPalette::Inactive;
-
- if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) {
- d->drawPanelItemViewSelected(painter, vopt);
- } else {
- if (vopt->backgroundBrush.style() != Qt::NoBrush) {
- QPointF oldBO = painter->brushOrigin();
- painter->setBrushOrigin(vopt->rect.topLeft());
- painter->fillRect(vopt->rect, vopt->backgroundBrush);
- painter->setBrushOrigin(oldBO);
- }
-
- if (vopt->state & QStyle::State_Selected) {
- QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText, option, widget);
- d->drawPanelItemViewSelected(painter, vopt, textRect);
- }
- }
- }
- break;
-#endif //QT_NO_ITEMVIEWS
-
- case PE_FrameWindow: {
- QPalette popupPal = option->palette;
- popupPal.setColor(QPalette::Light, option->palette.background().color());
- popupPal.setColor(QPalette::Midlight, option->palette.light().color());
- if (d->doubleControls)
- qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),2,0);
- else
- qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),1,0);
- break; }
- case PE_FrameTabBarBase: {
- break; }
- case PE_Widget:
- break;
- case PE_IndicatorMenuCheckMark: {
- int markW = option->rect.width() > 7 ? 7 : option->rect.width();
- int markH = markW;
- if (d->doubleControls)
- markW*=2;
- markH*=2;
- int posX = option->rect.x() + (option->rect.width() - markW)/2 + 1;
- int posY = option->rect.y() + (option->rect.height() - markH)/2;
-
- QVector<QLineF> a;
- a.reserve(markH);
-
- int i, xx, yy;
- xx = posX;
- yy = 3 + posY;
- for (i = 0; i < markW/2; ++i) {
- a << QLineF(xx, yy, xx, yy + 2);
- ++xx;
- ++yy;
- }
- yy -= 2;
- for (; i < markH; ++i) {
- a << QLineF(xx, yy, xx, yy + 2);
- ++xx;
- --yy;
- }
- if (!(option->state & State_Enabled) && !(option->state & State_On)) {
- int pnt;
- painter->setPen(option->palette.highlightedText().color());
- QPoint offset(1, 1);
- for (pnt = 0; pnt < a.size(); ++pnt)
- a[pnt].translate(offset.x(), offset.y());
- painter->drawLines(a);
- for (pnt = 0; pnt < a.size(); ++pnt)
- a[pnt].translate(offset.x(), offset.y());
- }
- painter->setPen(option->palette.text().color());
- painter->drawLines(a);
- break; }
- case PE_IndicatorBranch: {
- // Copied from the Windows style.
- static const int decoration_size = d->doubleControls ? 18 : 9;
- static const int ofsA = d->doubleControls ? 4 : 2;
- static const int ofsB = d->doubleControls ? 8 : 4;
- static const int ofsC = d->doubleControls ? 12 : 6;
- static const int ofsD = d->doubleControls ? 1 : 0;
- int mid_h = option->rect.x() + option->rect.width() / 2;
- int mid_v = option->rect.y() + option->rect.height() / 2;
- int bef_h = mid_h;
- int bef_v = mid_v;
- int aft_h = mid_h;
- int aft_v = mid_v;
- if (option->state & State_Children) {
- int delta = decoration_size / 2;
- bef_h -= delta;
- bef_v -= delta;
- aft_h += delta;
- aft_v += delta;
- QPen oldPen = painter->pen();
- QPen crossPen = oldPen;
- crossPen.setWidth(2);
- painter->setPen(crossPen);
- painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD);
- if (!(option->state & State_Open))
- painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD);
- painter->setPen(option->palette.dark().color());
- painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1);
- if (d->doubleControls)
- painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3);
- painter->setPen(oldPen);
- }
- QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern);
- if (option->state & State_Item) {
- if (option->direction == Qt::RightToLeft)
- painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush);
- else
- painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush);
- }
- if (option->state & State_Sibling)
- painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush);
- if (option->state & (State_Open | State_Children | State_Item | State_Sibling))
- painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush);
- break; }
- case PE_Frame:
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),
- d->doubleControls ? 2 : 1, &option->palette.background());
- break;
- case PE_FrameLineEdit:
- case PE_FrameMenu:
- if (d->doubleControls)
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2);
- else
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1);
- break;
- case PE_FrameStatusBar:
- if (d->doubleControls)
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,0);
- else
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,0);
- break;
-
- default:
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
- break;
- }
-}
-
-void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const {
-
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
-
- painter->setClipping(false);
- switch (element) {
- case CE_MenuBarEmptyArea:
- painter->setClipping(true);
- QWindowsStyle::drawControl(element, option, painter, widget);
- break;
- case CE_PushButtonBevel:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QRect br = button->rect;
- int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
-
- if (button->features & QStyleOptionButton::AutoDefaultButton)
- br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi);
- QStyleOptionButton tmpBtn = *button;
- tmpBtn.rect = br;
- proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget);
- if (button->features & QStyleOptionButton::HasMenu) {
- int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget);
- QRect ir = button->rect;
- QStyleOptionButton newButton = *button;
- if (d->doubleControls)
- newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4);
- else
- newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4);
- proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget);
- }
- if (button->features & QStyleOptionButton::DefaultButton)
- proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
- }
- break;
- case CE_RadioButton:
- case CE_CheckBox:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- bool isRadio = (element == CE_RadioButton);
- QStyleOptionButton subopt = *button;
- subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
- : SE_CheckBoxIndicator, button, widget);
- proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
- &subopt, painter, widget);
- subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents
- : SE_CheckBoxContents, button, widget);
- proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
- if (button->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*button);
- fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect
- : SE_CheckBoxFocusRect, button, widget);
- proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- }
- break;
- case CE_RadioButtonLabel:
- case CE_CheckBoxLabel:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- uint alignment = visualAlignment(button->direction, Qt::AlignLeft | Qt::AlignVCenter);
- if (!styleHint(SH_UnderlineShortcut, button, widget))
- alignment |= Qt::TextHideMnemonic;
- QPixmap pix;
- QRect textRect = button->rect;
- if (!button->icon.isNull()) {
- pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
- proxy()->drawItemPixmap(painter, button->rect, alignment, pix);
- if (button->direction == Qt::RightToLeft)
- textRect.setRight(textRect.right() - button->iconSize.width() - 4);
- else
- textRect.setLeft(textRect.left() + button->iconSize.width() + 4);
- }
- if (!button->text.isEmpty()){
- if (button->state & State_Enabled)
- proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
- button->palette, false, button->text, QPalette::WindowText);
- else
- proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
- button->palette, false, button->text, QPalette::Mid);
- }
- }
- break;
-#ifndef QT_NO_PROGRESSBAR
- case CE_ProgressBarGroove:
- if (d->doubleControls)
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.brush(QPalette::Window));
- else
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.brush(QPalette::Window));
- break;
-#endif //QT_NO_PROGRESSBAR
-#ifndef QT_NO_TABBAR
- case CE_TabBarTab:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget);
- proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget);
- }
- break;
- case CE_TabBarTabShape:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
-
- if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
- tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) {
- d->drawTabBarTab(painter, tab);
- } else {
- QCommonStyle::drawControl(element, option, painter, widget);
- }
- break; }
-
-#endif // QT_NO_TABBAR
-
-#ifndef QT_NO_TOOLBAR
- case CE_ToolBar:
- if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
- QRect rect = option->rect;
- painter->save();
- painter->setPen(option->palette.dark().color());
- painter->fillRect(rect,option->palette.button());
- if (d->doubleControls) {
- QPen pen = painter->pen();
- pen.setWidth(4);
- painter->setPen(pen);
- }
- if (toolBar->toolBarArea == Qt::TopToolBarArea)
- painter->drawLine(rect.bottomLeft(), rect.bottomRight());
- else
- painter->drawLine(rect.topLeft(), rect.topRight());
- painter->restore();
- break; }
-#endif //QT_NO_TOOLBAR
- case CE_Header:
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- QRegion clipRegion = painter->clipRegion();
- painter->setClipRect(option->rect);
- proxy()->drawControl(CE_HeaderSection, header, painter, widget);
- QStyleOptionHeader subopt = *header;
- subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget);
- if (header->state & State_Sunken)
- subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color());
- subopt.state |= QStyle::State_On;
- if (subopt.rect.isValid())
- proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget);
- if (header->sortIndicator != QStyleOptionHeader::None) {
- subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget);
- proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
- }
- painter->setClipRegion(clipRegion);
- }
- break;
-
- case CE_HeaderSection:
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- QBrush fill;
- QColor color;
- QRect rect = option->rect;
- painter->setPen(option->palette.shadow().color());
-
- int penSize = 1;
-
- if (d->doubleControls) {
- penSize = 2;
- QPen pen = painter->pen();
- pen.setWidth(2);
- pen.setCapStyle(Qt::FlatCap);
- painter->setPen(pen);
- }
-
- //fix Frame
-
- if (header->position == QStyleOptionHeader::End
- || (header->position == QStyleOptionHeader::OnlyOneSection
- && !header->text.isEmpty()))
- if (Qt::Horizontal == header->orientation )
- rect.adjust(0, 0, penSize, 0);
- else
- rect.adjust(0, 0, 0, penSize);
-
- if (option->state & State_Sunken) {
- fill = option->palette.brush(QPalette::Shadow);
- color = option->palette.light().color();
- painter->drawLine(rect.bottomLeft(), rect.bottomRight());
- painter->drawLine(rect.topRight(), rect.bottomRight());
- rect.adjust(0, 0, -penSize, -penSize);
- }
- else {
- fill = option->palette.brush(QPalette::Button);
- color = option->palette.shadow().color();
- if (Qt::Horizontal == header->orientation )
- rect.adjust(-penSize, 0, 0, 0);
- else
- rect.adjust(0, -penSize, 0, 0);
- }
- if (Qt::Horizontal == header->orientation )
- rect.adjust(0,-penSize,0,0);
- else
- rect.adjust(-penSize, 0, 0, 0);
-
- if (option->state & State_Sunken) {
- qDrawPlainRect(painter, rect, color, penSize, &fill);
- } else {
- //Corner
- rect.adjust(-penSize, 0, 0, 0);
- qDrawPlainRect(painter, rect, color, penSize, &fill);
- }
-
- //Hack to get rid of some double lines... StyleOptions need a clean flag for that
- rect = option->rect;
-#ifndef QT_NO_SCROLLAREA
- if (const QAbstractScrollArea *abstractScrollArea = qobject_cast<const QAbstractScrollArea *> (widget) ) {
- QRect rectScrollArea = abstractScrollArea->geometry();
- if (Qt::Horizontal == header->orientation )
- if ((rectScrollArea.right() - rect.right() ) > 1)
- painter->drawLine(rect.topRight(), rect.bottomRight());
- else ;
- else
- if ((rectScrollArea.bottom() - rect.bottom() ) > 1)
- painter->drawLine(rect.bottomLeft(), rect.bottomRight());
- }
-#endif // QT_NO_SCROLLAREA
- break;
- }
-#ifndef QT_NO_COMBOBOX
- case CE_ComboBoxLabel:
- // This is copied from qcommonstyle.cpp with the difference, that
- // the editRect isn't adjusted when calling drawItemText.
- if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
- painter->save();
- painter->setClipRect(editRect);
- if (!cb->currentIcon.isNull()) {
- QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
- : QIcon::Disabled;
- QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
- QRect iconRect(editRect);
- iconRect.setWidth(cb->iconSize.width() + 4);
- iconRect = alignedRect(cb->direction,
- Qt::AlignLeft | Qt::AlignVCenter,
- iconRect.size(), editRect);
- if (cb->editable)
- painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
- proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
-
- if (cb->direction == Qt::RightToLeft)
- editRect.translate(-4 - cb->iconSize.width(), 0);
- else
- editRect.translate(cb->iconSize.width() + 4, 0);
- }
- if (!cb->currentText.isEmpty() && !cb->editable) {
- proxy()->drawItemText(painter, editRect,
- visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
- cb->palette, cb->state & State_Enabled, cb->currentText);
- }
- painter->restore();
- }
- break;
-#endif // QT_NO_COMBOBOX
-#ifndef QT_NO_DOCKWIDGET
- case CE_DockWidgetTitle:
- if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
-
- const bool verticalTitleBar = dwOpt->verticalTitleBar;
-
- QRect rect = dwOpt->rect;
- QRect r = rect;
-
- if (verticalTitleBar) {
- r = r.transposed();
-
- painter->save();
- painter->translate(r.left(), r.top() + r.width());
- painter->rotate(-90);
- painter->translate(-r.left(), -r.top());
- }
-
- bool floating = false;
- bool active = dwOpt->state & State_Active;
- int menuOffset = 0; //used to center text when floated
- QColor inactiveCaptionTextColor = option->palette.highlightedText().color();
- if (dwOpt->movable) {
- QColor left, right;
-
- //Titlebar gradient
- if (widget && widget->isWindow()) {
- floating = true;
- if (active) {
- right = option->palette.highlight().color();
- left = right.lighter(125);
- } else {
- left = option->palette.highlight().color().lighter(125);
- right = QColor(0xff, 0xff, 0xff);
- }
- menuOffset = 2;
- QBrush fillBrush(left);
- if (left != right) {
- QPoint p1(r.x(), r.top() + r.height()/2);
- QPoint p2(rect.right(), r.top() + r.height()/2);
- QLinearGradient lg(p1, p2);
- lg.setColorAt(0, left);
- lg.setColorAt(1, right);
- fillBrush = lg;
- }
- painter->fillRect(r.adjusted(0, 0, 0, -3), fillBrush);
- } else {
- painter->fillRect(r.adjusted(0, 0, 0, -3), option->palette.button().color());
- }
- painter->setPen(dwOpt->palette.color(QPalette::Light));
- if (!widget || !widget->isWindow()) {
- painter->drawLine(r.topLeft(), r.topRight());
- painter->setPen(dwOpt->palette.color(QPalette::Dark));
- painter->drawLine(r.bottomLeft(), r.bottomRight()); }
- }
- if (!dwOpt->title.isEmpty()) {
- QFont oldFont = painter->font();
- QFont newFont = oldFont;
- if (newFont.pointSize() > 2)
- newFont.setPointSize(newFont.pointSize() - 2);
- if (floating)
- newFont.setBold(true);
- painter->setFont(newFont);
- QPalette palette = dwOpt->palette;
- palette.setColor(QPalette::Window, inactiveCaptionTextColor);
- QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget);
- if (verticalTitleBar) {
- titleRect = QRect(r.left() + rect.bottom()
- - titleRect.bottom(),
- r.top() + titleRect.left() - rect.left(),
- titleRect.height(), titleRect.width());
- }
- proxy()->drawItemText(painter, titleRect,
- Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette,
- dwOpt->state & State_Enabled, dwOpt->title,
- floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
- painter->setFont(oldFont);
- }
- if (verticalTitleBar)
- painter->restore();
- }
- return;
-#endif // QT_NO_DOCKWIDGET
-
- case CE_PushButtonLabel:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- painter->save();
- QRect ir = button->rect;
- QPalette::ColorRole colorRole;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, button, widget))
- tf |= Qt::TextHideMnemonic;
-
- if (button->state & (State_On | State_Sunken))
- colorRole = QPalette::Light;
- else
- colorRole = QPalette::ButtonText;
-
- if (!button->icon.isNull()) {
- QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
- : QIcon::Disabled;
- if (mode == QIcon::Normal && button->state & State_HasFocus)
- mode = QIcon::Active;
- QIcon::State state = QIcon::Off;
- if (button->state & State_On)
- state = QIcon::On;
- QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
- int pixw = pixmap.width();
- int pixh = pixmap.height();
- //Center the icon if there is no text
-
- QPoint point;
- if (button->text.isEmpty()) {
- point = QPoint(ir.x() + ir.width() / 2 - pixw / 2,
- ir.y() + ir.height() / 2 - pixh / 2);
- } else {
- point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2);
- }
- if (button->direction == Qt::RightToLeft)
- point.rx() += pixw;
-
- if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft)
- point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
-
- painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap);
-
- if (button->direction == Qt::RightToLeft)
- ir.translate(-4, 0);
- else
- ir.translate(pixw + 4, 0);
- ir.setWidth(ir.width() - (pixw + 4));
- // left-align text if there is
- if (!button->text.isEmpty())
- tf |= Qt::AlignLeft;
- } else {
- tf |= Qt::AlignHCenter;
- }
- if (button->state & State_Enabled)
- proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole);
- else
- proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid);
- painter->restore();
- }
- break;
- default:
- QWindowsStyle::drawControl(element, option, painter, widget);
- break;
- }
-}
-
-void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const {
-
- painter->setClipping(false);
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
- switch (control) {
-#ifndef QT_NO_SLIDER
- case CC_Slider:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
- int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
- int ticks = slider->tickPosition;
- QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
- QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
-
- if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
- int mid = thickness / 2;
- if (ticks & QSlider::TicksAbove)
- mid += len / 8;
- if (ticks & QSlider::TicksBelow)
- mid -= len / 8;
-
- painter->setPen(slider->palette.shadow().color());
- if (slider->orientation == Qt::Horizontal) {
- qDrawPlainRect(painter, groove.x(), groove.y() + mid - 2,
- groove.width(), 4, option->palette.shadow().color(),1,0);
- } else {
- qDrawPlainRect(painter, groove.x()+mid-2, groove.y(),
- 4, groove.height(), option->palette.shadow().color(),1,0);
- }
- }
- if (slider->subControls & SC_SliderTickmarks) {
- QStyleOptionSlider tmpSlider = *slider;
- tmpSlider.subControls = SC_SliderTickmarks;
- QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget);
- }
-
- if (slider->subControls & SC_SliderHandle) {
- const QColor c0 = slider->palette.shadow().color();
- const QColor c1 = slider->palette.dark().color();
- const QColor c3 = slider->palette.midlight().color();
- const QColor c4 = slider->palette.dark().color();
- QBrush handleBrush;
-
- if (slider->state & State_Enabled) {
- handleBrush = slider->palette.color(QPalette::Light);
- } else {
- handleBrush = QBrush(slider->palette.color(QPalette::Shadow),
- Qt::Dense4Pattern);
- }
- int x = handle.x(), y = handle.y(),
- wi = handle.width(), he = handle.height();
- int x1 = x;
- int x2 = x+wi-1;
- int y1 = y;
- int y2 = y+he-1;
-
- Qt::Orientation orient = slider->orientation;
- bool tickAbove = slider->tickPosition == QSlider::TicksAbove;
- bool tickBelow = slider->tickPosition == QSlider::TicksBelow;
-
- if (slider->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*slider);
- fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget);
- proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
- Qt::BGMode oldMode = painter->backgroundMode();
- painter->setBackgroundMode(Qt::OpaqueMode);
- qDrawPlainRect(painter, QRect(x, y, wi, he)
- ,slider->palette.shadow().color(),1,&handleBrush);
- painter->setBackgroundMode(oldMode);
- QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern);
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill);
- return;
- }
- QSliderDirection dir;
- if (orient == Qt::Horizontal)
- if (tickAbove)
- dir = SliderUp;
- else
- dir = SliderDown;
- else
- if (tickAbove)
- dir = SliderLeft;
- else
- dir = SliderRight;
- QPolygon polygon;
- int d = 0;
- switch (dir) {
- case SliderUp:
- x2++;
- y1 = y1 + wi / 2;
- d = (wi + 1) / 2 - 1;
- polygon.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d,y1 - d);
- break;
- case SliderDown:
- x2++;
- y2 = y2 - wi/2;
- d = (wi + 1) / 2 - 1;
- polygon.setPoints(5, x1, y1, x1, y2, x1 + d,y2 + d, x2, y2, x2, y1);
- break;
- case SliderLeft:
- d = (he + 1) / 2 - 1;
- x1 = x1 + he/2;
- polygon.setPoints(5, x1, y1, x1 - d, y1 + d, x1,y2, x2, y2, x2, y1);
- y1--;
- break;
- case SliderRight:
- d = (he + 1) / 2 - 1;
- x2 = x2 - he/2;
- polygon.setPoints(5, x1, y1, x1, y2, x2,y2, x2 + d, y1 + d, x2, y1);
- y1--;
- break;
- }
- QBrush oldBrush = painter->brush();
- painter->setPen(Qt::NoPen);
- painter->setBrush(handleBrush);
- Qt::BGMode oldMode = painter->backgroundMode();
- painter->setBackgroundMode(Qt::OpaqueMode);
- painter->drawRect(x1, y1, x2-x1+1, y2-y1+1);
- painter->drawPolygon(polygon);
- QBrush fill = QBrush(option->palette.button().color(), Qt::Dense4Pattern);
- painter->setBrush(oldBrush);
- painter->setBackgroundMode(oldMode);
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill);
-
- if (dir != SliderUp) {
- painter->setPen(c0);
- painter->drawLine(x1, y1, x2, y1);
- }
- if (dir != SliderLeft) {
- painter->setPen(c0);
- painter->drawLine(x1, y1, x1, y2);
- }
- if (dir != SliderRight) {
- painter->setPen(c0);
- painter->drawLine(x2, y1, x2, y2);
- }
- if (dir != SliderDown) {
- painter->setPen(c0);
- painter->drawLine(x1, y2, x2, y2);
- }
- switch (dir) {
- case SliderUp:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4, y1),fill);
- painter->setPen(c0);
- painter->drawLine(x1, y1, x1 + d, y1 - d);
- d = wi - d - 1;
- painter->drawLine(x2, y1, x2 -d , y1 -d );
- d--;
- break;
- case SliderDown:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1+3, y2 - d, x2 - x1 -4,y2 - 8),fill);
- painter->setPen(c0);
- painter->drawLine(x1, y2, x1 + d, y2 + d);
- d = wi - d - 1;
- painter->drawLine(x2, y2, x2 - d, y2 + d);
- d--;
- break;
- case SliderLeft:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1, y2 - y1 - 3),fill);
- painter->setPen(c0);
- painter->drawLine(x1, y1, x1 - d, y1 + d);
- d = he - d - 1;
- painter->drawLine(x1, y2, x1 - d, y2 - d);
- d--;
- break;
- case SliderRight:
- if (slider->state & State_Sunken)
- painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3),fill);
- painter->setPen(c0);
- painter->drawLine(x2, y1, x2 + d, y1 + d);
- painter->setPen(c0);
- d = he - d - 1;
- painter->drawLine(x2, y2, x2 + d, y2 - d);
- d--;
- break;
- }
- }
- }
- break;
-#endif //QT_NO_SLIDER
-#ifndef QT_NO_SCROLLBAR
- case CC_ScrollBar:
- painter->save();
- painter->setPen(option->palette.shadow().color());
- if (d->doubleControls) {
- QPen pen = painter->pen();
- pen.setWidth(2);
- pen.setCapStyle(Qt::SquareCap);
- painter->setPen(pen);
- }
- if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- d->drawScrollbarGroove(painter, scrollbar);
- // Make a copy here and reset it for each primitive.
- QStyleOptionSlider newScrollbar = *scrollbar;
- State saveFlags = scrollbar->state;
- //Check if the scrollbar is part of an abstractItemView and draw the frame according
- bool drawCompleteFrame = true;
- bool secondScrollBar = false;
- if (widget)
- if (QWidget *parent = widget->parentWidget()) {
- if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) {
- drawCompleteFrame = (abstractScrollArea->frameStyle() == QFrame::NoFrame) || (abstractScrollArea->frameStyle() == QFrame::StyledPanel);
- secondScrollBar = (abstractScrollArea->horizontalScrollBar()->isVisible()
- && abstractScrollArea->verticalScrollBar()->isVisible()) ;
- }
-#ifndef QT_NO_LISTVIEW
- if (QListView *listView = qobject_cast<QListView *>(parent->parentWidget()))
- drawCompleteFrame = false;
-#endif
- }
- if (scrollbar->minimum == scrollbar->maximum)
- saveFlags |= State_Enabled;
- if (scrollbar->subControls & SC_ScrollBarSubLine) {
- newScrollbar.state = saveFlags;
- newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
- }
- }
- if (scrollbar->subControls & SC_ScrollBarAddLine) {
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
- }
- }
- if (scrollbar->subControls & SC_ScrollBarSlider) {
-
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget);
-
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame);
- }
- }
- }
- painter->restore();
- break;
-#endif // QT_NO_SCROLLBAR
- case CC_ToolButton:
- if (const QStyleOptionToolButton *toolbutton
- = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- QRect button, menuarea;
- bool isTabWidget = false;
-#ifndef QT_NO_TABWIDGET
- if (widget)
- if (QWidget *parent = widget->parentWidget())
- isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget()));
-#endif //QT_NO_TABWIDGET
-
- button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
- menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
- State buttonFlags = toolbutton->state;
- if (buttonFlags & State_AutoRaise) {
- if (!(buttonFlags & State_MouseOver)) {
- buttonFlags &= ~State_Raised;
- }
- }
- State menuFlags = buttonFlags;
- if (toolbutton->activeSubControls & SC_ToolButton)
- buttonFlags |= State_Sunken;
- if (toolbutton->activeSubControls & SC_ToolButtonMenu)
- menuFlags |= State_On;
- QStyleOption tool = *toolbutton;
- if (toolbutton->subControls & SC_ToolButton) {
- tool.rect = button;
- tool.state = buttonFlags;
- proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
- }
- if (toolbutton->subControls & SC_ToolButtonMenu) {
- tool.rect = menuarea;
- tool.state = buttonFlags & State_Enabled;
- QStyleOption toolMenu = *toolbutton;
- toolMenu.state = menuFlags;
- if (buttonFlags & State_Sunken)
- proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
- QStyleOption arrowOpt = toolMenu;
- State flags = State_None;
- if (menuFlags & State_Enabled)
- flags |= State_Enabled;
- if ((menuFlags & State_On) && !(buttonFlags & State_Sunken)) {
- flags |= State_Sunken;
- painter->fillRect(menuarea, option->palette.shadow());
- }
- arrowOpt.state = flags;
- proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
- }
- if (toolbutton->state & State_HasFocus) {
- QStyleOptionFocusRect focusRect;
- focusRect.QStyleOption::operator=(*toolbutton);
- focusRect.rect.adjust(3, 3, -3, -3);
- if (toolbutton->features & QStyleOptionToolButton::Menu)
- focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
- toolbutton, widget), 0);
- proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget);
- }
- QStyleOptionToolButton label = *toolbutton;
- if (isTabWidget)
- label.state = toolbutton->state;
- else
- label.state = toolbutton->state & State_Enabled;
- int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
- label.rect = button.adjusted(fw, fw, -fw, -fw);
- proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
- }
- break;
-
-#ifndef QT_NO_GROUPBOX
- case CC_GroupBox:
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- // Draw frame
- painter->save();
- QFont font = painter->font();
- font.setBold(true);
- painter->setFont(font);
- QStyleOptionGroupBox groupBoxFont = *groupBox;
- groupBoxFont.fontMetrics = QFontMetrics(font);
- QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0);
- if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
- QStyleOptionFrame frame;
- frame.QStyleOption::operator=(*groupBox);
- frame.features = groupBox->features;
- frame.lineWidth = groupBox->lineWidth;
- frame.midLineWidth = groupBox->midLineWidth;
- frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
- painter->save();
- QRegion region(groupBox->rect);
- if (!groupBox->text.isEmpty()) {
- bool ltr = groupBox->direction == Qt::LeftToRight;
- QRect finalRect = checkBoxRect.united(textRect);
- if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)
- finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
- region -= finalRect;
- }
- proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
- painter->restore();
- }
- // Draw checkbox
- if (groupBox->subControls & SC_GroupBoxCheckBox) {
- QStyleOptionButton box;
- box.QStyleOption::operator=(*groupBox);
- box.rect = checkBoxRect;
- proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
- }
- // Draw title
- if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
- QColor textColor = groupBox->textColor;
- if (textColor.isValid())
- painter->setPen(textColor);
- else
- painter->setPen(groupBox->palette.link().color());
- painter->setPen(groupBox->palette.link().color());
-
- int alignment = int(groupBox->textAlignment);
- if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget))
- alignment |= Qt::TextHideMnemonic;
-
- if (groupBox->state & State_Enabled)
- proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
- groupBox->palette, true, groupBox->text,
- textColor.isValid() ? QPalette::NoRole : QPalette::Link);
- else
- proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
- groupBox->palette, true, groupBox->text, QPalette::Mid);
- if (groupBox->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*groupBox);
- fropt.rect = textRect;
- proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- }
- painter->restore();
- }
- break;
-#endif //QT_NO_GROUPBOX
-
-#ifndef QT_NO_COMBOBOX
- case CC_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- QBrush editBrush = cmb->palette.brush(QPalette::Base);
- if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame)
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush);
- else
- painter->fillRect(option->rect, editBrush);
- State flags = State_None;
- QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
- if ((option->state & State_On)) {
- painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow));
- }
- if (d->doubleControls)
- ar.adjust(5, 0, 5, 0);
- else
- ar.adjust(2, 0, -2, 0);
- if (option->state & State_Enabled)
- flags |= State_Enabled;
- if (option->state & State_On)
- flags |= State_Sunken;
- QStyleOption arrowOpt = *cmb;
- arrowOpt.rect = ar;
- arrowOpt.state = flags;
- proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget);
- if (cmb->subControls & SC_ComboBoxEditField) {
- QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
- if (cmb->state & State_HasFocus && !cmb->editable)
- painter->fillRect(re.x(), re.y(), re.width(), re.height(),
- cmb->palette.brush(QPalette::Highlight));
- if (cmb->state & State_HasFocus) {
- painter->setPen(cmb->palette.highlightedText().color());
- painter->setBackground(cmb->palette.highlight());
- } else {
- painter->setPen(cmb->palette.text().color());
- painter->setBackground(cmb->palette.background());
- }
- if (cmb->state & State_HasFocus && !cmb->editable) {
- QStyleOptionFocusRect focus;
- focus.QStyleOption::operator=(*cmb);
- focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget);
- focus.state |= State_FocusAtBorder;
- focus.backgroundColor = cmb->palette.highlight().color();
- if ((option->state & State_On))
- proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
- }
- }
- }
- break;
-#endif // QT_NO_COMBOBOX
-
-
-#ifndef QT_NO_SPINBOX
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QStyleOptionSpinBox copy = *spinBox;
- //PrimitiveElement primitiveElement;
- int primitiveElement;
-
- if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
- QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget);
- qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0);
- }
- QPalette shadePal(option->palette);
- shadePal.setColor(QPalette::Button, option->palette.light().color());
- shadePal.setColor(QPalette::Light, option->palette.base().color());
- if (spinBox->subControls & SC_SpinBoxUp) {
- copy.subControls = SC_SpinBoxUp;
- QPalette pal2 = spinBox->palette;
- if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
- pal2.setCurrentColorGroup(QPalette::Disabled);
- copy.state &= ~State_Enabled;
- }
- copy.palette = pal2;
- if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) {
- copy.state |= State_On;
- copy.state |= State_Sunken;
- } else {
- copy.state |= State_Raised;
- copy.state &= ~State_Sunken;
- }
- primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig
- : PE_IndicatorArrowUpBig);
- copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
- if (copy.state & (State_Sunken | State_On))
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
- else
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
- copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0);
- proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
- }
- if (spinBox->subControls & SC_SpinBoxDown) {
- copy.subControls = SC_SpinBoxDown;
- copy.state = spinBox->state;
- QPalette pal2 = spinBox->palette;
- if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
- pal2.setCurrentColorGroup(QPalette::Disabled);
- copy.state &= ~State_Enabled;
- }
- copy.palette = pal2;
- if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) {
- copy.state |= State_On;
- copy.state |= State_Sunken;
- } else {
- copy.state |= State_Raised;
- copy.state &= ~State_Sunken;
- }
- primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig
- : PE_IndicatorArrowDownBig);
- copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
- if (copy.state & (State_Sunken | State_On))
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
- else
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
- copy.rect.adjust(3, 0, -4, 0);
- if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) {
- int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
- copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
- proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
- }
- else {
- proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
- }
- if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
- QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget);
- }
- }
- }
- break;
-#endif // QT_NO_SPINBOX
-
- default:
- QWindowsStyle::drawComplexControl(control, option, painter, widget);
- break;
- }
-}
-
-QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const {
-
- QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget);
- switch (type) {
- case CT_PushButton:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- newSize = QCommonStyle::sizeFromContents(type, option, size, widget);
- int w = newSize.width(),
- h = newSize.height();
- int defwidth = 0;
- if (button->features & QStyleOptionButton::AutoDefaultButton)
- defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
-
- int minwidth = int(QStyleHelper::dpiScaled(55.0f));
- int minheight = int(QStyleHelper::dpiScaled(19.0f));
-
- if (w < minwidth + defwidth && button->icon.isNull())
- w = minwidth + defwidth;
- if (h < minheight + defwidth)
- h = minheight + defwidth;
- newSize = QSize(w + 4, h + 4);
- }
- break;
-
-#ifndef QT_NO_GROUPBOX
- case CT_GroupBox:
- if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) {
- newSize = size + QSize(!grb->isFlat() ? 16 : 0, !grb->isFlat() ? 16 : 0);
- }
- break;
-#endif // QT_NO_GROUPBOX
-
- case CT_RadioButton:
- case CT_CheckBox:
- newSize = size;
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- bool isRadio = (type == CT_RadioButton);
- QRect irect = visualRect(button->direction, button->rect,
- proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
- : SE_CheckBoxIndicator, button, widget));
- int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
- : PM_IndicatorHeight, button, widget);
- int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10;
- if (d_func()->doubleControls)
- margins *= 2;
- newSize += QSize(irect.right() + margins, 1);
- newSize.setHeight(qMax(newSize.height(), h));
- }
- break;
-#ifndef QT_NO_COMBOBOX
- case CT_ComboBox:
- if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
- newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23)
- }
- break;
-#endif
-#ifndef QT_NO_SPINBOX
- case CT_SpinBox:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
- newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6);
- }
- break;
-#endif
-#ifndef QT_NO_LINEEDIT
- case CT_LineEdit:
- newSize += QSize(0,1);
- break;
-#endif
- case CT_ToolButton:
- newSize = QSize(newSize.width() + 1, newSize.height());
- break;
- case CT_TabBarTab:
- if (d_func()->doubleControls)
- newSize = QSize(newSize.width(), 42);
- else
- newSize = QSize(newSize.width(), 21);
- break;
- case CT_HeaderSection:
- newSize += QSize(4, 2);
- break;
-#ifndef QT_NO_ITEMVIEWS
-#ifdef Q_OS_WINCE_WM
- case CT_ItemViewItem:
- if (d_func()->wm65)
- if (d_func()->doubleControls)
- newSize.setHeight(46);
- else
- newSize.setHeight(23);
- break;
-#endif //Q_OS_WINCE_WM
-#endif //QT_NO_ITEMVIEWS
- default:
- break;
- }
- return newSize;
-}
-
-QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
- QRect rect = QWindowsStyle::subElementRect(element, option, widget);
- switch (element) {
-#ifndef QT_NO_TABWIDGET
- case SE_TabWidgetTabBar:
- if (d->doubleControls)
- rect.adjust(-2, 0, 2, 0);
- else
- rect.adjust(-2, 0, 2, 0);
- break;
-#endif //QT_NO_TABWIDGET
- case SE_CheckBoxFocusRect:
- rect.adjust(1,0,-2,-1);
- break;
- case SE_RadioButtonFocusRect:
- rect.adjust(1,1,-2,-2);
- break;
- default:
- break;
-#ifndef QT_NO_SLIDER
- case SE_SliderFocusRect:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- rect = slider->rect;
- }
- break;
- case SE_PushButtonFocusRect:
- if (d->doubleControls)
- rect.adjust(-1, -1, 0, 0);
- break;
-#endif // QT_NO_SLIDER
-#ifndef QT_NO_ITEMVIEWS
- case SE_ItemViewItemFocusRect:
-#ifdef Q_OS_WINCE_WM
- if (d->wm65)
- rect = QRect();
-#endif
- break;
-#endif //QT_NO_ITEMVIEWS
- }
- return rect;
-}
-
-QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
- SubControl subControl, const QWidget *widget) const {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
- QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget);
- switch (control) {
-
-#ifndef QT_NO_SCROLLBAR
- case CC_ScrollBar:
- if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
- float stretchFactor = 1.4f;
- int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor);
-
-#ifdef Q_OS_WINCE_WM
- if (d->wm65)
- {
- sliderButtonExtent = d->imageScrollbarHandleUp.width();
- sliderButtonExtentDir = d->imageScrollbarHandleUp.height();
- }
-#endif //Q_OS_WINCE_WM
-
- int sliderlen;
- int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
- scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2);
- // calculate slider length
- if (scrollbar->maximum != scrollbar->minimum) {
- uint range = scrollbar->maximum - scrollbar->minimum;
- sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
-
- int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
- if (sliderlen < slidermin || range > INT_MAX / 2)
- sliderlen = slidermin;
- if (sliderlen > maxlen)
- sliderlen = maxlen;
- } else {
- sliderlen = maxlen;
- }
- int sliderstart = sliderButtonExtentDir + sliderPositionFromValue(scrollbar->minimum,
- scrollbar->maximum,
- scrollbar->sliderPosition,
- maxlen - sliderlen,
- scrollbar->upsideDown);
- if (d->smartphone) {
- sliderstart -= sliderButtonExtentDir;
- sliderlen += 2*sliderButtonExtent;
- }
- switch (subControl) {
- case SC_ScrollBarSubLine: // top/left button
- if (scrollbar->orientation == Qt::Horizontal) {
- int buttonWidth = qMin(scrollbar->rect.width() / 2, sliderButtonExtentDir );
- rect.setRect(0, 0, buttonWidth, sliderButtonExtent);
- } else {
- int buttonHeight = qMin(scrollbar->rect.height() / 2, sliderButtonExtentDir);
- rect.setRect(0, 0, sliderButtonExtent, buttonHeight);
- }
- if (d->smartphone)
- rect.setRect(0, 0, 0, 0);
- break;
- case SC_ScrollBarAddLine: // bottom/right button
- if (scrollbar->orientation == Qt::Horizontal) {
- int buttonWidth = qMin(scrollbar->rect.width()/2, sliderButtonExtentDir);
- rect.setRect(scrollbar->rect.width() - buttonWidth, 0, buttonWidth, sliderButtonExtent);
- } else {
- int buttonHeight = qMin(scrollbar->rect.height()/2, sliderButtonExtentDir );
- rect.setRect(0, scrollbar->rect.height() - buttonHeight, sliderButtonExtent, buttonHeight);
- }
- if (d->smartphone)
- rect.setRect(0, 0, 0, 0);
- break;
- case SC_ScrollBarSubPage: // between top/left button and slider
- if (scrollbar->orientation == Qt::Horizontal)
- if (d->smartphone)
- rect.setRect(0, 0, sliderstart, sliderButtonExtent);
- else
- rect.setRect(sliderButtonExtent, 0, sliderstart - sliderButtonExtent, sliderButtonExtent);
- else
- if (d->smartphone)
- rect.setRect(0, 0, sliderButtonExtent, sliderstart);
- else
- rect.setRect(0, sliderButtonExtent, sliderButtonExtent, sliderstart - sliderButtonExtent);
- break;
- case SC_ScrollBarAddPage: // between bottom/right button and slider
- if (scrollbar->orientation == Qt::Horizontal)
- if (d->smartphone)
- rect.setRect(sliderstart + sliderlen, 0,
- maxlen - sliderstart - sliderlen + 2*sliderButtonExtent, sliderButtonExtent);
- else
- rect.setRect(sliderstart + sliderlen, 0,
- maxlen - sliderstart - sliderlen + sliderButtonExtent, sliderButtonExtent);
- else
- if (d->smartphone)
- rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent,
- maxlen - sliderstart - sliderlen + 2*sliderButtonExtent);
- else
- rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent,
- maxlen - sliderstart - sliderlen + sliderButtonExtent);
- break;
- case SC_ScrollBarGroove:
- if (scrollbar->orientation == Qt::Horizontal)
- rect.setRect(sliderButtonExtent, 0, scrollbar->rect.width() - sliderButtonExtent * 2,
- scrollbar->rect.height());
- else
- rect.setRect(0, sliderButtonExtent, scrollbar->rect.width(),
- scrollbar->rect.height() - sliderButtonExtent * 2);
- break;
- case SC_ScrollBarSlider:
- if (scrollbar->orientation == Qt::Horizontal)
- rect.setRect(sliderstart, 0, sliderlen, sliderButtonExtent);
- else
- rect.setRect(0, sliderstart, sliderButtonExtent, sliderlen);
- break;
- default:
- break;
- }
- rect = visualRect(scrollbar->direction, scrollbar->rect, rect);
- }
- break;
-#endif // QT_NO_SCROLLBAR
-
-
-
-#ifndef QT_NO_TOOLBUTTON
- case CC_ToolButton:
- if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget);
- rect = toolButton->rect;
- switch (subControl) {
- case SC_ToolButton:
- if ((toolButton->features
- & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay))
- == QStyleOptionToolButton::Menu)
- rect.adjust(0, 0, -mbi, 0);
- break;
- case SC_ToolButtonMenu:
- if ((toolButton->features
- & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay))
- == QStyleOptionToolButton::Menu)
- rect.adjust(rect.width() - mbi, 1, 0, 1);
- break;
- default:
- break;
- }
- rect = visualRect(toolButton->direction, toolButton->rect, rect);
- }
- break;
-#endif // QT_NO_TOOLBUTTON
-
-#ifndef QT_NO_SLIDER
- case CC_Slider:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
- int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
- switch (subControl) {
- case SC_SliderHandle: {
- int sliderPos = 0;
- int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
- bool horizontal = slider->orientation == Qt::Horizontal;
- sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
- slider->sliderPosition,
- (horizontal ? slider->rect.width()
- : slider->rect.height()) - len,
- slider->upsideDown);
- if (horizontal)
- rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness);
- else
- rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len);
- break; }
- default:
- break;
- }
- rect = visualRect(slider->direction, slider->rect, rect);
- }
- break;
-#endif //QT_NO_SLIDER
-#ifndef QT_NO_COMBOBOX
- case CC_ComboBox:
- if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int x = comboBox->rect.x(),
- y = comboBox->rect.y(),
- wi = comboBox->rect.width(),
- he = comboBox->rect.height();
- int xpos = x;
- int margin = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0;
- int bmarg = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0;
- if (subControl == SC_ComboBoxArrow)
- xpos += wi - int((he - 2*bmarg)*0.9) - bmarg;
- else
- xpos += wi - (he - 2*bmarg) - bmarg;
- switch (subControl) {
- case SC_ComboBoxArrow:
- rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg);
- break;
- case SC_ComboBoxEditField:
- rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin);
- if (d->doubleControls) {
- if (comboBox->editable)
- rect.adjust(2, 0, 0, 0);
- else
- rect.adjust(4, 2, 0, -2);
- } else if (!comboBox->editable) {
- rect.adjust(2, 1, 0, -1);
- }
- break;
- case SC_ComboBoxFrame:
- rect = comboBox->rect;
- break;
- default:
- break;
- }
- }
-#endif //QT_NO_COMBOBOX
-#ifndef QT_NO_SPINBOX
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- QSize bs;
- int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0;
- bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height())));
- // 1.6 -approximate golden mean
- bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8))));
- bs = bs.expandedTo(QApplication::globalStrut());
- int x, lx, rx;
- x = spinBox->rect.width() - bs.width()*2;
- lx = fw;
- rx = x - fw;
- switch (subControl) {
- case SC_SpinBoxUp:
- rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height());
- break;
- case SC_SpinBoxDown:
- rect = QRect(x + bs.width(), 0, bs.width(), bs.height());
- break;
- case SC_SpinBoxEditField:
- if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) {
- rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw);
- } else {
- rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw);
- }
- break;
- case SC_SpinBoxFrame:
- rect = spinBox->rect;
- default:
- break;
- }
- rect = visualRect(spinBox->direction, spinBox->rect, rect);
- }
- break;
-#endif // Qt_NO_SPINBOX
-#ifndef QT_NO_GROUPBOX
- case CC_GroupBox: {
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- switch (subControl) {
- case SC_GroupBoxFrame:
- // FALL THROUGH
- case SC_GroupBoxContents: {
- int topMargin = 0;
- int topHeight = 0;
- int bottomMargin = 0;
- int labelMargin = 2;
-
- QRect frameRect = groupBox->rect;
- int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
- if (groupBox->text.size()) {
- topHeight = groupBox->fontMetrics.height();
- if (verticalAlignment & Qt::AlignVCenter)
- topMargin = topHeight+5;
- else if (verticalAlignment & Qt::AlignTop)
- topMargin = -topHeight+5;
- }
- if (subControl == SC_GroupBoxFrame) {
- frameRect.setTop(topMargin);
- frameRect.setBottom(frameRect.height() + bottomMargin);
- rect = frameRect;
- break;
- }
- int frameWidth = 0;
- if (groupBox->text.size()) {
- frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
- rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth);
- }
- else {
- rect = groupBox->rect;
- }
- break;
- }
- case SC_GroupBoxCheckBox:
- // FALL THROUGH
- case SC_GroupBoxLabel: {
- QFontMetrics fontMetrics = groupBox->fontMetrics;
- int h = fontMetrics.height();
- int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width();
- const int margX = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 2;
- const int margY = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 2;
- rect = groupBox->rect.adjusted(margX, margY, -margX, 0);
- if (groupBox->text.size())
- rect.setHeight(h);
- else
- rect.setHeight(0);
- int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
- int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
- bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
- int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
-
- // Adjusted rect for label + indicatorWidth + indicatorSpace
- QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment,
- QSize(textWidth + checkBoxSize, h), rect);
-
- // Adjust totalRect if checkbox is set
- if (hasCheckBox) {
- bool ltr = groupBox->direction == Qt::LeftToRight;
- int left = 2;
- // Adjust for check box
- if (subControl == SC_GroupBoxCheckBox) {
- int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
- left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
- int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
- totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
- // Adjust for label
- } else {
- left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
- totalRect.setRect(left, totalRect.top(),
- totalRect.width() - checkBoxSize, totalRect.height());
- }
- }
- if ((subControl== SC_GroupBoxLabel))
- totalRect.adjust(-2,0,6,0);
- rect = totalRect;
- break;
- }
- default:
- break;
- }
- }
- break;
- }
-#endif // QT_NO_GROUPBOX
- default:
- break;
- }
- return rect;
-}
-
-QPalette QWindowsMobileStyle::standardPalette() const {
- QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ),
- QColor(132, 130, 132), QColor(198, 195, 198), Qt::black, Qt::white, Qt::white, QColor(198, 195, 198));
- palette.setColor(QPalette::Window, QColor(206, 223, 239));
- palette.setColor(QPalette::Link, QColor(8,77,123)); //Alternate TextColor for labels...
- palette.setColor(QPalette::Base, Qt::white);
- palette.setColor(QPalette::Button, QColor(206, 223, 239));
- palette.setColor(QPalette::Highlight, QColor(49, 146, 214));
- palette.setColor(QPalette::Light, Qt::white);
- palette.setColor(QPalette::Text, Qt::black);
- palette.setColor(QPalette::ButtonText, Qt::black);
- palette.setColor(QPalette::Midlight, QColor(222, 223, 222 ));
- palette.setColor(QPalette::Dark, QColor(132, 130, 132));
- palette.setColor(QPalette::Mid, QColor(189, 190, 189));
- palette.setColor(QPalette::Shadow, QColor(0, 0, 0));
- palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow)
- return palette;
-}
-
-
-/*! \reimp */
-void QWindowsMobileStyle::polish(QApplication *application) {
- QWindowsStyle::polish(application);
-}
-
-/*! \reimp */
-void QWindowsMobileStyle::polish(QWidget *widget) {
-
-#ifndef QT_NO_TOOLBAR
- if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) {
- QPalette pal = toolBar->palette();
- pal.setColor(QPalette::Background, pal.button().color());
- toolBar->setPalette(pal);
- }
- else
-#endif //QT_NO_TOOLBAR
-
- QWindowsStyle::polish(widget);
-}
-
-void QWindowsMobileStyle::unpolish(QWidget *widget)
-{
- QWindowsStyle::unpolish(widget);
-}
-
-void QWindowsMobileStyle::unpolish(QApplication *app)
-{
- QWindowsStyle::unpolish(app);
-}
-
-/*! \reimp */
-void QWindowsMobileStyle::polish(QPalette &palette) {
- QWindowsStyle::polish(palette);
-}
-
-int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
- int ret;
-
- switch (pm) {
- case PM_DefaultTopLevelMargin:
- ret =0;
- break;
- case PM_DefaultLayoutSpacing:
- d->doubleControls ? ret = 8 : ret = 4;
- break;
- case PM_HeaderMargin:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
- case PM_DefaultChildMargin:
- d->doubleControls ? ret = 10 : ret = 5;
- break;
- case PM_ToolBarSeparatorExtent:
- d->doubleControls ? ret = 6 : ret = 3;
- break;
- case PM_DefaultFrameWidth:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
- case PM_MenuVMargin:
- ret = 1;
- break;
- case PM_MenuHMargin:
- ret = 1;
- break;
- case PM_MenuButtonIndicator:
- ret = d->doubleControls ? 24 : 14;
- break;
- case PM_ComboBoxFrameWidth:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
- case PM_SpinBoxFrameWidth:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
- case PM_ButtonDefaultIndicator:
- case PM_ButtonShiftHorizontal:
- case PM_ButtonShiftVertical:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
-#ifndef QT_NO_TABBAR
- case PM_TabBarTabShiftHorizontal:
- ret = 0;
- break;
- case PM_TabBarTabShiftVertical:
- ret = 0;
- break;
-#endif
- case PM_MaximumDragDistance:
- ret = 60;
- break;
- case PM_TabBarTabVSpace:
- ret = d->doubleControls ? 12 : 6;
- break;
- case PM_TabBarBaseHeight:
- ret = 0;
- break;
- case PM_IndicatorWidth:
- ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize;
- break;
- case PM_IndicatorHeight:
- ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize;
- break;
- case PM_ExclusiveIndicatorWidth:
- ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2;
- break;
- case PM_ExclusiveIndicatorHeight:
- ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2;
- break;
-#ifndef QT_NO_SLIDER
- case PM_SliderLength:
- ret = d->doubleControls ? 16 : 8;
- break;
- case PM_FocusFrameHMargin:
- ret = d->doubleControls ? 1 : 2;
- break;
- case PM_SliderThickness:
- ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness;
- break;
- case PM_TabBarScrollButtonWidth:
- ret = d->doubleControls ? 14 * 2 : 18;
- break;
- case PM_CheckBoxLabelSpacing:
- case PM_RadioButtonLabelSpacing:
- ret = d->doubleControls ? 6 * 2 : 6;
- break;
- // Returns the number of pixels to use for the business part of the
- // slider (i.e., the non-tickmark portion). The remaining space is shared
- // equally between the tickmark regions.
- case PM_SliderControlThickness:
- if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
- int ticks = sl->tickPosition;
- int n = 0;
- if (ticks & QSlider::TicksAbove)
- ++n;
- if (ticks & QSlider::TicksBelow)
- ++n;
- if (!n) {
- ret = space;
- break;
- }
- int thick = 8;
- if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
- thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
-
- space -= thick;
- if (space > 0)
- thick += (space * 2) / (n + 2);
- ret = thick;
- } else {
- ret = 0;
- }
- break;
-#endif // QT_NO_SLIDER
-#ifndef QT_NO_MENU
- case PM_SmallIconSize:
- d->doubleControls ? ret = windowsMobileIconSize * 2 : ret = windowsMobileIconSize;
- break;
- case PM_ButtonMargin:
- d->doubleControls ? ret = 8 : ret = 4;
- break;
- case PM_LargeIconSize:
- d->doubleControls ? ret = 64 : ret = 32;
- break;
- case PM_IconViewIconSize:
- ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
- break;
- case PM_ToolBarIconSize:
- d->doubleControls ? ret = 2 * windowsMobileIconSize : ret = windowsMobileIconSize;
- break;
- case PM_DockWidgetTitleMargin:
- ret = 2;
- break;
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
-#else
- case PM_DockWidgetFrameWidth:
- ret = 4;
- break;
-#endif // Q_DEAD_CODE_FROM_QT4_WIN
- break;
-#endif // QT_NO_MENU
-
- case PM_TitleBarHeight:
- d->doubleControls ? ret = 42 : ret = 21;
- break;
- case PM_ScrollBarSliderMin:
-#ifdef Q_OS_WINCE_WM
- if (d->wm65)
-#else
- if (false)
-#endif
- {
- d->doubleControls ? ret = 68 : ret = 34;
- } else {
- d->doubleControls ? ret = 36 : ret = 18;
- }
- break;
- case PM_ScrollBarExtent: {
-
- if (d->smartphone)
- ret = 9;
- else
- d->doubleControls ? ret = 25 : ret = 13;
-
-#ifdef Q_OS_WINCE_WM
- if (d->wm65)
-#else
- if (false)
-#endif
- {
- d->doubleControls ? ret = 26 : ret = 13;
- break;
- }
-
-#ifndef QT_NO_SCROLLAREA
- //Check if the scrollbar is part of an abstractItemView and set size according
- if (widget)
- if (QWidget *parent = widget->parentWidget())
- if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget()))
- if (d->smartphone)
- ret = 8;
- else
- d->doubleControls ? ret = 24 : ret = 12;
-#endif
- }
- break;
- case PM_SplitterWidth:
- ret = qMax(4, QApplication::globalStrut().width());
- break;
-
-#if defined(Q_DEAD_CODE_FROM_QT4_WIN)
- case PM_MDIFrameWidth:
- ret = 1;
- break;
-#endif
- case PM_ToolBarExtensionExtent:
- d->doubleControls ? ret = 32 : ret = 16;
- break;
- case PM_ToolBarItemMargin:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
- case PM_ToolBarItemSpacing:
- d->doubleControls ? ret = 2 : ret = 1;
- break;
- case PM_ToolBarHandleExtent:
- d->doubleControls ? ret = 16 : ret = 8;
- break;
- case PM_ButtonIconSize:
- d->doubleControls ? ret = 32 : ret = 16;
- break;
- case PM_TextCursorWidth:
- ret = 2;
- break;
- case PM_TabBar_ScrollButtonOverlap:
- ret = 0;
- break;
- default:
- ret = QWindowsStyle::pixelMetric(pm, opt, widget);
- break;
- }
- return ret;
-}
-
-int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget,
- QStyleHintReturn *returnData) const {
-
- int ret;
- switch (hint) {
- case SH_Menu_MouseTracking:
- case SH_ComboBox_ListMouseTracking:
- case SH_EtchDisabledText:
- ret = 0;
- break;
- case SH_DitherDisabledText:
- ret = 0;
- break;
- case SH_ItemView_ShowDecorationSelected:
- ret = 0;
- break;
-#ifndef QT_NO_TABWIDGET
- case SH_TabWidget_DefaultTabPosition:
- ret = QTabWidget::South;
- break;
-#endif
- case SH_ToolBar_Movable:
- ret = false;
- break;
- case SH_ScrollBar_ContextMenu:
- ret = false;
- break;
- case SH_MenuBar_AltKeyNavigation:
- ret = false;
- break;
- case SH_RequestSoftwareInputPanel:
- ret = RSIP_OnMouseClick;
- break;
- default:
- ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
- break;
- }
- return ret;
-}
-
-QPixmap QWindowsMobileStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
- const QWidget *widget) const {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
- switch (sp) {
-#ifndef QT_NO_IMAGEFORMAT_XPM
- case SP_ToolBarHorizontalExtensionButton: {
- QPixmap pixmap = QCommonStyle::standardPixmap(sp, option, widget);
- if (d->doubleControls)
- return pixmap.scaledToHeight(pixmap.height() * 2);
- else
- return pixmap;
- }
- case SP_TitleBarMaxButton:
- case SP_TitleBarCloseButton:
- case SP_TitleBarNormalButton:
- case SP_TitleBarMinButton: {
- QImage image;
- switch (sp) {
- case SP_TitleBarMaxButton:
- image = d->imageMaximize;
- break;
- case SP_TitleBarCloseButton:
- image = d->imageClose;
- break;
- case SP_TitleBarNormalButton:
- image = d->imageNormalize;
- break;
- case SP_TitleBarMinButton:
- image = d->imageMinimize;
- break;
- default:
- break;
- }
- if (option) {
- image.setColor(0, option->palette.shadow().color().rgba());
- image.setColor(1, option->palette.highlight().color().rgba());
- image.setColor(2, option->palette.highlight().color().lighter(150).rgba());
- image.setColor(3, option->palette.highlightedText().color().rgba());
- }
-
- return QPixmap::fromImage(image);
- }
-
-#endif
- default:
- return QWindowsStyle::standardPixmap(sp, option, widget);
- }
-}
-
-QPixmap QWindowsMobileStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *option) const {
-
- switch (iconMode) {
- case QIcon::Selected: {
-#ifdef Q_OS_WINCE_WM
- if (d_func()->wm65)
- return pixmap;
-#endif //Q_OS_WINCE_WM
- QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
- int imgh = img.height();
- int imgw = img.width();
- for (int y = 0; y < imgh; y += 2) {
- for (int x = 0; x < imgw; x += 2) {
- QColor c = option->palette.highlight().color().rgb();
- c.setAlpha( qAlpha(img.pixel(x, y)));
- QRgb pixel = c.rgba();
- img.setPixel(x, y, pixel);
- }
- }
- return QPixmap::fromImage(img);
- }
- default:
- break;
- }
- return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, option);
-}
-
-
-bool QWindowsMobileStyle::doubleControls() const {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
- return d->doubleControls;
-}
-
-void QWindowsMobileStyle::setDoubleControls(bool doubleControls) {
-
- QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
- d->doubleControls = doubleControls;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_WINDOWSMOBILE
-
diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h
deleted file mode 100644
index 68dfbfb412..0000000000
--- a/src/widgets/styles/qwindowsmobilestyle_p.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSMOBILESTYLE_P_H
-#define QWINDOWSMOBILESTYLE_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 <private/qwindowsstyle_p.h>
-
-QT_BEGIN_NAMESPACE
-
-
-#if !defined(QT_NO_STYLE_WINDOWSMOBILE)
-
-class QWindowsMobileStylePrivate;
-
-class QWindowsMobileStyle : public QWindowsStyle
-{
- Q_OBJECT
-public:
- QWindowsMobileStyle();
- ~QWindowsMobileStyle();
-
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget = 0) const;
-
- void drawControl(ControlElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
-
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const;
-
- QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const;
-
- QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
-
- QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget) const;
-
- QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *option) const;
-
- QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option,
- const QWidget *widget) const;
-
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
-
- int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const;
-
- void polish(QApplication*);
- void unpolish(QApplication*);
- void polish(QWidget *widget);
- void unpolish(QWidget *widget);
- void polish(QPalette &);
-
- QPalette standardPalette() const;
-
- bool doubleControls() const;
-
- void setDoubleControls(bool);
-
-protected:
- QWindowsMobileStyle(QWindowsMobileStylePrivate &dd);
-
-private:
- Q_DECLARE_PRIVATE(QWindowsMobileStyle)
-};
-
-#endif // QT_NO_STYLE_WINDOWSMOBILE
-
-QT_END_NAMESPACE
-
-#endif //QWINDOWSMOBILESTYLE_P_H
diff --git a/src/widgets/styles/qwindowsmobilestyle_p_p.h b/src/widgets/styles/qwindowsmobilestyle_p_p.h
deleted file mode 100644
index cd9e4636ec..0000000000
--- a/src/widgets/styles/qwindowsmobilestyle_p_p.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWINDOWSMOBILESTYLE_P_P_H
-#define QWINDOWSMOBILESTYLE_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
-// file may change from version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qwindowsmobilestyle_p.h"
-#include "qwindowsstyle_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_STYLE_WINDOWSMOBILE
-
-class QStyleOptionTab;
-class QStyleOptionSlider;
-
-class QWindowsMobileStylePrivate : public QWindowsStylePrivate
-{
- Q_DECLARE_PUBLIC(QWindowsMobileStyle)
-public:
- QWindowsMobileStylePrivate();
- bool doubleControls;
- bool smartphone;
-#ifdef Q_OS_WINCE_WM
- bool wm65;
-#endif
-
- QImage imageRadioButton;
- QImage imageRadioButtonChecked;
- QImage imageRadioButtonHighlighted;
- QImage imageChecked;
- QImage imageCheckedBold;
- QImage imageArrowDown;
- QImage imageArrowUp;
- QImage imageArrowLeft;
- QImage imageArrowRight;
- QImage imageArrowDownBig;
- QImage imageArrowUpBig;
- QImage imageArrowLeftBig;
- QImage imageArrowRightBig;
- QImage imageClose;
- QImage imageMaximize;
- QImage imageNormalize;
- QImage imageMinimize;
-
- void setupWindowsMobileStyle65();
-
-#ifdef Q_OS_WINCE_WM
- //Windows Mobile 6.5 images
- QImage imageScrollbarHandleUp;
- QImage imageScrollbarHandleDown;
- QImage imageScrollbarHandleUpHigh;
- QImage imageScrollbarHandleDownHigh;
- QImage imageScrollbarGripUp;
- QImage imageScrollbarGripDown;
- QImage imageScrollbarGripMiddle;
- QImage imageListViewHighlightCornerLeft;
- QImage imageListViewHighlightCornerRight;
- QImage imageListViewHighlightMiddle;
- QImage imageTabEnd;
- QImage imageTabSelectedEnd;
- QImage imageTabSelectedBegin;
- QImage imageTabMiddle;
-
- QColor currentTintHigh;
- QColor currentTintButton;
-
- void tintImagesHigh(QColor color);
- void tintImagesButton(QColor color);
- void tintListViewHighlight(QColor color);
-
-#endif //Q_OS_WINCE_WM
-
- void drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false);
- void drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false);
- void drawScrollbarGroove(QPainter *p, const QStyleOptionSlider *opt);
- void drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame);
- void drawTabBarTab(QPainter *p, const QStyleOptionTab *tab);
- void drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItem *option, QRect rect = QRect());
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_STYLE_WINDOWSMOBILE
-#endif //QWINDOWSMOBILESTYLE_P_P_H
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 3eca9aef7f..b41ad4249e 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -42,7 +42,6 @@
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
-#include <private/qsystemlibrary_p.h>
#include "qapplication.h"
#include "qbitmap.h"
#include "qdrawutil.h" // for now
@@ -87,26 +86,7 @@ QT_END_INCLUDE_NAMESPACE
# define COLOR_GRADIENTINACTIVECAPTION 28
# endif
-
-typedef struct
-{
- DWORD cbSize;
- HICON hIcon;
- int iSysImageIndex;
- int iIcon;
- WCHAR szPath[MAX_PATH];
-} QSHSTOCKICONINFO;
-
-#define _SHGFI_SMALLICON 0x000000001
-#define _SHGFI_LARGEICON 0x000000000
-#define _SHGFI_ICON 0x000000100
-#define _SIID_SHIELD 77
-
-typedef HRESULT (WINAPI *PtrSHGetStockIconInfo)(int siid, int uFlags, QSHSTOCKICONINFO *psii);
-static PtrSHGetStockIconInfo pSHGetStockIconInfo = 0;
-
Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
#endif //Q_OS_WIN
QT_BEGIN_INCLUDE_NAMESPACE
@@ -122,13 +102,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
QWindowsStylePrivate::QWindowsStylePrivate()
: alt_down(false), menuBarTimer(0)
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {
- QSystemLibrary shellLib(QLatin1String("shell32"));
- pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");
- }
-#endif
}
qreal QWindowsStylePrivate::appDevicePixelRatio()
@@ -305,25 +278,15 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
switch (pm) {
case QStyle::PM_DockWidgetFrameWidth:
-# ifndef Q_OS_WINCE
return GetSystemMetrics(SM_CXFRAME);
-# else
- return GetSystemMetrics(SM_CXDLGFRAME);
-# endif
- break;
case QStyle::PM_TitleBarHeight:
if (widget && (widget->windowType() == Qt::Tool)) {
// MS always use one less than they say
-# ifndef Q_OS_WINCE
return GetSystemMetrics(SM_CYSMCAPTION) - 1;
-# else
- return GetSystemMetrics(SM_CYCAPTION) - 1;
-# endif
}
return GetSystemMetrics(SM_CYCAPTION) - 1;
-# ifndef Q_OS_WINCE
case QStyle::PM_ScrollBarExtent:
{
NONCLIENTMETRICS ncm;
@@ -332,14 +295,9 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const
return qMax(ncm.iScrollHeight, ncm.iScrollWidth);
}
break;
-# endif // !Q_OS_WINCE
case QStyle::PM_MdiSubWindowFrameWidth:
-# ifndef Q_OS_WINCE
return GetSystemMetrics(SM_CYFRAME);
-# else
- return GetSystemMetrics(SM_CYDLGFRAME);
-# endif
default:
break;
@@ -476,7 +434,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
const QWidget *widget) const
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QPixmap desktopIcon;
switch(standardPixmap) {
case SP_DriveCDIcon:
@@ -515,7 +473,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl
if (!desktopIcon.isNull()) {
return desktopIcon;
}
-#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN && !Q_OS_WINRT
return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
}
@@ -592,12 +550,12 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
#endif // Q_OS_WIN && !Q_OS_WINRT
case SH_Menu_SubMenuSloppyCloseTimeout:
case SH_Menu_SubMenuPopupDelay: {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
DWORD delay;
if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0))
ret = delay;
else
-#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
+#endif // Q_OS_WIN && !Q_OS_WINRT
ret = 400;
break;
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 5c227b9d5d..6009b5d1f8 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -43,7 +43,6 @@
#include <qwindow.h>
#include <private/qstyleanimation_p.h>
#include <private/qstylehelper_p.h>
-#include <private/qsystemlibrary_p.h>
#include <private/qapplication_p.h>
#include <qpa/qplatformnativeinterface.h>
@@ -88,8 +87,7 @@ bool QWindowsVistaStylePrivate::useVista()
{
return (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
- && QWindowsVistaStylePrivate::useXP()
- && QWindowsVistaStylePrivate::pGetThemeTransitionDuration != Q_NULLPTR;
+ && QWindowsVistaStylePrivate::useXP();
}
/* \internal
@@ -356,13 +354,13 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
HTHEME theme;
int partId;
- int duration;
+ DWORD duration;
int fromState = 0;
int toState = 0;
//translate state flags to UXTHEME states :
if (element == PE_FrameLineEdit) {
- theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Edit");
+ theme = OpenThemeData(0, L"Edit");
partId = EP_EDITBORDER_NOSCROLL;
if (oldState & State_MouseOver)
@@ -380,7 +378,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
toState = ETS_NORMAL;
} else {
- theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button");
+ theme = OpenThemeData(0, L"Button");
if (element == PE_IndicatorRadioButton)
partId = BP_RADIOBUTTON;
else if (element == PE_IndicatorCheckBox)
@@ -393,9 +391,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
// Retrieve the transition time between the states from the system.
- if (theme && QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, partId, fromState, toState,
- TMT_TRANSITIONDURATIONS, &duration) == S_OK)
- {
+ if (theme
+ && SUCCEEDED(GetThemeTransitionDuration(theme, partId, fromState, toState,
+ TMT_TRANSITIONDURATIONS, &duration))) {
t->setDuration(duration);
}
t->setStartTime(QTime::currentTime());
@@ -513,7 +511,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
EP_EDITBORDER_HVSCROLL, stateId, option->rect);
// Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping
int borderSize = 1;
- QWindowsXPStylePrivate::pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize);
+ GetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize);
QRegion clipRegion = option->rect;
QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize);
clipRegion ^= content;
@@ -548,22 +546,18 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
return;
}
int bgType;
- QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(),
- partId,
- stateId,
- TMT_BGTYPE,
- &bgType);
+ GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType);
if( bgType == BT_IMAGEFILE ) {
d->drawBackground(theme);
} else {
QBrush fillColor = option->palette.brush(QPalette::Base);
if (!isEnabled) {
PROPERTYORIGIN origin = PO_NOTFOUND;
- QWindowsXPStylePrivate::pGetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin);
+ GetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin);
// Use only if the fill property comes from our part
if ((origin == PO_PART || origin == PO_STATE)) {
COLORREF bgRef;
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef);
+ GetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef);
fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef)));
}
}
@@ -899,12 +893,12 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
t->setEndImage(endImage);
- int duration = 0;
- HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button");
+ DWORD duration = 0;
+ const HTHEME theme = OpenThemeData(0, L"Button");
int fromState = buttonStateId(oldState, BP_PUSHBUTTON);
int toState = buttonStateId(option->state, BP_PUSHBUTTON);
- if (QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, fromState, toState, TMT_TRANSITIONDURATIONS, &duration) == S_OK)
+ if (GetThemeTransitionDuration(theme, BP_PUSHBUTTON, fromState, toState, TMT_TRANSITIONDURATIONS, &duration) == S_OK)
t->setDuration(duration);
else
t->setDuration(0);
@@ -1456,7 +1450,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
// We cannot currently get the correct selection color for "explorer style" views
COLORREF cref = 0;
XPThemeData theme(d->treeViewHelper(), 0, QLatin1String("LISTVIEW"), 0, 0);
- unsigned int res = pGetThemeColor(theme.handle(), LVP_LISTITEM, LISS_SELECTED, TMT_TEXTCOLOR, &cref);
+ unsigned int res = GetThemeColor(theme.handle(), LVP_LISTITEM, LISS_SELECTED, TMT_TEXTCOLOR, &cref);
QColor textColor(GetRValue(cref), GetGValue(cref), GetBValue(cref));
*/
QPalette palette = vopt->palette;
@@ -1925,7 +1919,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
case SE_PushButtonContents:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
MARGINS borderSize;
- HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button");
+ const HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button");
if (theme) {
int stateId = PBS_NORMAL;
if (!(option->state & State_Enabled))
@@ -1940,15 +1934,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
rect = option->rect.adjusted(border, border, -border, -border);
- int result = QWindowsXPStylePrivate::pGetThemeMargins(theme,
- NULL,
- BP_PUSHBUTTON,
- stateId,
- TMT_CONTENTMARGINS,
- NULL,
- &borderSize);
-
- if (result == S_OK) {
+ if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) {
rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
-borderSize.cxRightWidth, -borderSize.cyBottomHeight);
rect = visualRect(option->direction, option->rect, rect);
@@ -2318,14 +2304,12 @@ void QWindowsVistaStyle::polish(QWidget *widget)
//we do not have to care about unpolishing
widget->setContentsMargins(3, 0, 4, 0);
COLORREF bgRef;
- HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP");
- if (theme) {
- if (QWindowsXPStylePrivate::pGetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef) == S_OK) {
- QColor textColor = QColor::fromRgb(bgRef);
- QPalette pal;
- pal.setColor(QPalette::All, QPalette::ToolTipText, textColor);
- widget->setPalette(pal);
- }
+ HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP");
+ if (theme && SUCCEEDED(GetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef))) {
+ QColor textColor = QColor::fromRgb(bgRef);
+ QPalette pal;
+ pal.setColor(QPalette::All, QPalette::ToolTipText, textColor);
+ widget->setPalette(pal);
}
} else if (qobject_cast<QMessageBox *> (widget)) {
widget->setAttribute(Qt::WA_StyledBackground);
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 900597cdab..2fbc40dc11 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -47,7 +47,6 @@
#include <qpa/qplatformnativeinterface.h>
#include <private/qstylehelper_p.h>
#include <private/qwidget_p.h>
-#include <private/qsystemlibrary_p.h>
#include <qpainter.h>
#include <qpaintengine.h>
#include <qwidget.h>
@@ -76,78 +75,6 @@
QT_BEGIN_NAMESPACE
-// Runtime resolved theme engine function calls
-
-QWindowsUxThemeLib::PtrIsAppThemed QWindowsUxThemeLib::pIsAppThemed = Q_NULLPTR;
-QWindowsUxThemeLib::PtrIsThemeActive QWindowsUxThemeLib::pIsThemeActive = Q_NULLPTR;
-QWindowsUxThemeLib::PtrOpenThemeData QWindowsUxThemeLib::pOpenThemeData = Q_NULLPTR;
-QWindowsUxThemeLib::PtrCloseThemeData QWindowsUxThemeLib::pCloseThemeData = Q_NULLPTR;
-QWindowsUxThemeLib::PtrDrawThemeBackground QWindowsUxThemeLib::pDrawThemeBackground = Q_NULLPTR;
-QWindowsUxThemeLib::PtrDrawThemeBackgroundEx QWindowsUxThemeLib::pDrawThemeBackgroundEx = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetCurrentThemeName QWindowsUxThemeLib::pGetCurrentThemeName = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeBool QWindowsUxThemeLib::pGetThemeBool = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeColor QWindowsUxThemeLib::pGetThemeColor = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeEnumValue QWindowsUxThemeLib::pGetThemeEnumValue = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeFilename QWindowsUxThemeLib::pGetThemeFilename = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeFont QWindowsUxThemeLib::pGetThemeFont = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeInt QWindowsUxThemeLib::pGetThemeInt = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeIntList QWindowsUxThemeLib::pGetThemeIntList = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeMargins QWindowsUxThemeLib::pGetThemeMargins = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeMetric QWindowsUxThemeLib::pGetThemeMetric = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemePartSize QWindowsUxThemeLib::pGetThemePartSize = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemePosition QWindowsUxThemeLib::pGetThemePosition = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemePropertyOrigin QWindowsUxThemeLib::pGetThemePropertyOrigin = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeRect QWindowsUxThemeLib::pGetThemeRect = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeString QWindowsUxThemeLib::pGetThemeString = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeBackgroundRegion QWindowsUxThemeLib::pGetThemeBackgroundRegion = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeDocumentationProperty QWindowsUxThemeLib::pGetThemeDocumentationProperty = Q_NULLPTR;
-QWindowsUxThemeLib::PtrIsThemeBackgroundPartiallyTransparent
- QWindowsUxThemeLib::pIsThemeBackgroundPartiallyTransparent = Q_NULLPTR;
-QWindowsUxThemeLib::PtrSetWindowTheme QWindowsUxThemeLib::pSetWindowTheme = Q_NULLPTR;
-QWindowsUxThemeLib::PtrGetThemeTransitionDuration QWindowsUxThemeLib::pGetThemeTransitionDuration = Q_NULLPTR;
-
-bool QWindowsUxThemeLib::resolveSymbols()
-{
- static bool tried = false;
- if (tried)
- return pIsAppThemed != Q_NULLPTR;
- tried = true;
- QSystemLibrary themeLib(QLatin1String("uxtheme"));
- if (!themeLib.load())
- return false;
- pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
- if (!pIsAppThemed)
- return false;
- pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive");
- pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize");
- pOpenThemeData = (PtrOpenThemeData )themeLib.resolve("OpenThemeData");
- pCloseThemeData = (PtrCloseThemeData )themeLib.resolve("CloseThemeData");
- pDrawThemeBackground = (PtrDrawThemeBackground )themeLib.resolve("DrawThemeBackground");
- pDrawThemeBackgroundEx = (PtrDrawThemeBackgroundEx )themeLib.resolve("DrawThemeBackgroundEx");
- pGetCurrentThemeName = (PtrGetCurrentThemeName )themeLib.resolve("GetCurrentThemeName");
- pGetThemeBool = (PtrGetThemeBool )themeLib.resolve("GetThemeBool");
- pGetThemeColor = (PtrGetThemeColor )themeLib.resolve("GetThemeColor");
- pGetThemeEnumValue = (PtrGetThemeEnumValue )themeLib.resolve("GetThemeEnumValue");
- pGetThemeFilename = (PtrGetThemeFilename )themeLib.resolve("GetThemeFilename");
- pGetThemeFont = (PtrGetThemeFont )themeLib.resolve("GetThemeFont");
- pGetThemeInt = (PtrGetThemeInt )themeLib.resolve("GetThemeInt");
- pGetThemeIntList = (PtrGetThemeIntList )themeLib.resolve("GetThemeIntList");
- pGetThemeMargins = (PtrGetThemeMargins )themeLib.resolve("GetThemeMargins");
- pGetThemeMetric = (PtrGetThemeMetric )themeLib.resolve("GetThemeMetric");
- pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize");
- pGetThemePosition = (PtrGetThemePosition )themeLib.resolve("GetThemePosition");
- pGetThemePropertyOrigin = (PtrGetThemePropertyOrigin)themeLib.resolve("GetThemePropertyOrigin");
- pGetThemeRect = (PtrGetThemeRect )themeLib.resolve("GetThemeRect");
- pGetThemeString = (PtrGetThemeString )themeLib.resolve("GetThemeString");
- pGetThemeBackgroundRegion = (PtrGetThemeBackgroundRegion )themeLib.resolve("GetThemeBackgroundRegion");
- pGetThemeDocumentationProperty = (PtrGetThemeDocumentationProperty )themeLib.resolve("GetThemeDocumentationProperty");
- pIsThemeBackgroundPartiallyTransparent = (PtrIsThemeBackgroundPartiallyTransparent)themeLib.resolve("IsThemeBackgroundPartiallyTransparent");
- pSetWindowTheme = (PtrSetWindowTheme )themeLib.resolve("SetWindowTheme");
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
- pGetThemeTransitionDuration = (PtrGetThemeTransitionDuration)themeLib.resolve("GetThemeTransitionDuration");
- return true;
-}
-
// General const values
static const int windowsItemFrame = 2; // menu item frame width
static const int windowsItemHMargin = 3; // menu item hor text margin
@@ -231,7 +158,7 @@ RECT XPThemeData::toRECT(const QRect &qr)
*/
HRGN XPThemeData::mask(QWidget *widget)
{
- if (!QWindowsXPStylePrivate::pIsThemeBackgroundPartiallyTransparent(handle(), partId, stateId))
+ if (!IsThemeBackgroundPartiallyTransparent(handle(), partId, stateId))
return 0;
HRGN hrgn;
@@ -239,7 +166,7 @@ HRGN XPThemeData::mask(QWidget *widget)
if (widget)
dc = hdcForWidgetBackingStore(widget);
RECT nativeRect = toRECT(rect);
- QWindowsXPStylePrivate::pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn);
+ GetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn);
return hrgn;
}
@@ -272,7 +199,7 @@ static HRGN qt_hrgn_from_qregion(const QRegion &region)
qt_add_rect(hRegion, region.boundingRect());
return hRegion;
}
- foreach (const QRect &rect, region.rects())
+ for (const QRect &rect : region)
qt_add_rect(hRegion, rect);
return hRegion;
}
@@ -285,8 +212,7 @@ bool QWindowsXPStylePrivate::useXP(bool update)
{
if (!update)
return use_xp;
- return (use_xp = QWindowsUxThemeLib::resolveSymbols() && pIsThemeActive()
- && (pIsAppThemed() || !QApplication::instance()));
+ return use_xp = IsThemeActive() && (IsAppThemed() || !QApplication::instance());
}
/* \internal
@@ -366,7 +292,7 @@ bool QWindowsXPStylePrivate::initVistaTreeViewTheming()
qWarning("Unable to create the treeview helper window.");
return false;
}
- if (FAILED(QWindowsXPStylePrivate::pSetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) {
+ if (FAILED(SetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) {
qErrnoWarning("SetWindowTheme() failed.");
cleanupVistaTreeViewTheming();
return false;
@@ -391,7 +317,7 @@ void QWindowsXPStylePrivate::cleanupHandleMap()
{
for (int i = 0; i < NThemes; ++i)
if (m_themes[i]) {
- pCloseThemeData(m_themes[i]);
+ CloseThemeData(m_themes[i]);
m_themes[i] = 0;
}
QWindowsXPStylePrivate::cleanupVistaTreeViewTheming();
@@ -407,7 +333,7 @@ HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd)
const wchar_t *name = themeNames[theme];
if (theme == VistaTreeViewTheme && QWindowsXPStylePrivate::initVistaTreeViewTheming())
hwnd = QWindowsXPStylePrivate::m_vistaTreeViewHelper;
- m_themes[theme] = pOpenThemeData(hwnd, name);
+ m_themes[theme] = OpenThemeData(hwnd, name);
if (Q_UNLIKELY(!m_themes[theme]))
qErrnoWarning("OpenThemeData() failed for theme %d (%s).",
theme, qPrintable(themeName(theme)));
@@ -505,48 +431,6 @@ const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget)
}
/*! \internal
- Returns \c true if all the necessary theme engine symbols were
- resolved.
-*/
-bool QWindowsXPStylePrivate::resolveSymbols()
-{
- static bool tried = false;
- if (!tried) {
- tried = true;
- QSystemLibrary themeLib(QLatin1String("uxtheme"));
- pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
- if (pIsAppThemed) {
- pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive");
- pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize");
- pOpenThemeData = (PtrOpenThemeData )themeLib.resolve("OpenThemeData");
- pCloseThemeData = (PtrCloseThemeData )themeLib.resolve("CloseThemeData");
- pDrawThemeBackground = (PtrDrawThemeBackground )themeLib.resolve("DrawThemeBackground");
- pDrawThemeBackgroundEx = (PtrDrawThemeBackgroundEx )themeLib.resolve("DrawThemeBackgroundEx");
- pGetCurrentThemeName = (PtrGetCurrentThemeName )themeLib.resolve("GetCurrentThemeName");
- pGetThemeBool = (PtrGetThemeBool )themeLib.resolve("GetThemeBool");
- pGetThemeColor = (PtrGetThemeColor )themeLib.resolve("GetThemeColor");
- pGetThemeEnumValue = (PtrGetThemeEnumValue )themeLib.resolve("GetThemeEnumValue");
- pGetThemeFilename = (PtrGetThemeFilename )themeLib.resolve("GetThemeFilename");
- pGetThemeFont = (PtrGetThemeFont )themeLib.resolve("GetThemeFont");
- pGetThemeInt = (PtrGetThemeInt )themeLib.resolve("GetThemeInt");
- pGetThemeIntList = (PtrGetThemeIntList )themeLib.resolve("GetThemeIntList");
- pGetThemeMargins = (PtrGetThemeMargins )themeLib.resolve("GetThemeMargins");
- pGetThemeMetric = (PtrGetThemeMetric )themeLib.resolve("GetThemeMetric");
- pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize");
- pGetThemePosition = (PtrGetThemePosition )themeLib.resolve("GetThemePosition");
- pGetThemePropertyOrigin = (PtrGetThemePropertyOrigin)themeLib.resolve("GetThemePropertyOrigin");
- pGetThemeRect = (PtrGetThemeRect )themeLib.resolve("GetThemeRect");
- pGetThemeString = (PtrGetThemeString )themeLib.resolve("GetThemeString");
- pGetThemeBackgroundRegion = (PtrGetThemeBackgroundRegion )themeLib.resolve("GetThemeBackgroundRegion");
- pGetThemeDocumentationProperty = (PtrGetThemeDocumentationProperty )themeLib.resolve("GetThemeDocumentationProperty");
- pIsThemeBackgroundPartiallyTransparent = (PtrIsThemeBackgroundPartiallyTransparent)themeLib.resolve("IsThemeBackgroundPartiallyTransparent");
- }
- }
-
- return pIsAppThemed != 0;
-}
-
-/*! \internal
Returns a native buffer (DIB section) of at least the size of
( \a x , \a y ). The buffer has a 32 bit depth, to not lose
the alpha values on proper alpha-pixmaps.
@@ -614,8 +498,8 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h)
*/
bool QWindowsXPStylePrivate::isTransparent(XPThemeData &themeData)
{
- return pIsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId,
- themeData.stateId);
+ return IsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId,
+ themeData.stateId);
}
@@ -626,9 +510,10 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData)
{
HRGN hRgn = 0;
RECT rect = themeData.toRECT(themeData.rect);
- if (!SUCCEEDED(pGetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId,
- themeData.stateId, &rect, &hRgn)))
+ if (!SUCCEEDED(GetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId,
+ themeData.stateId, &rect, &hRgn))) {
return QRegion();
+ }
HRGN dest = CreateRectRgn(0, 0, 0, 0);
const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR;
@@ -822,7 +707,6 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
bool canDrawDirectly = false;
if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate
&& tt != ComplexTransform && !themeData.mirrorVertically
- && (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx)
&& !translucentToplevel) {
// Draw on backing store DC only for real widgets or backing store images.
const QPaintDevice *enginePaintDevice = painter->paintEngine()->paintDevice();
@@ -904,44 +788,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa
| (themeData.noContent ? DTBG_OMITCONTENT : 0)
| (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0);
- HRESULT result = S_FALSE;
- if (pDrawThemeBackgroundEx != 0) {
- result = pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions);
- } else {
- // We are running on a system where the uxtheme.dll does not have
- // the DrawThemeBackgroundEx function, so we need to clip away
- // borders or contents manually. All flips and mirrors uses the
- // fallback implementation
-
- int borderSize = 0;
- PROPERTYORIGIN origin = PO_NOTFOUND;
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin);
- pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize);
-
- // Clip away border region
- QRegion extraClip = sysRgn;
- if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) {
- if (themeData.noBorder) {
- // extraClip &= area is already done
- drawRECT = themeData.toRECT(area.adjusted(-borderSize, -borderSize, borderSize, borderSize));
- }
-
- // Clip away content region
- if (themeData.noContent) {
- QRegion content = area.adjusted(borderSize, borderSize, -borderSize, -borderSize);
- extraClip ^= content;
- }
-
- // Set the clip region, if used..
- if (themeData.noBorder || themeData.noContent) {
- DeleteObject(hrgn);
- hrgn = qt_hrgn_from_qregion(extraClip);
- SelectClipRgn(dc, hrgn);
- }
- }
-
- result = pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &(drawOptions.rcClip));
- }
+ const HRESULT result = DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions);
SelectClipRgn(dc, 0);
DeleteObject(hrgn);
return SUCCEEDED(result);
@@ -1020,17 +867,17 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
BOOL tmt_borderonly = false;
COLORREF tmt_transparentcolor = 0x0;
PROPERTYORIGIN proporigin = PO_NOTFOUND;
- pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly);
- pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor);
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin);
+ GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly);
+ GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor);
+ GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin);
partIsTransparent = isTransparent(themeData);
potentialInvalidAlpha = false;
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &proporigin);
+ GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &proporigin);
if (proporigin == PO_PART || proporigin == PO_STATE) {
int tmt_glyphtype = GT_NONE;
- pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype);
+ GetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype);
potentialInvalidAlpha = partIsTransparent && tmt_glyphtype == GT_IMAGEGLYPH;
}
@@ -1060,8 +907,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
int borderSize = 0;
PROPERTYORIGIN origin = PO_NOTFOUND;
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin);
- pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize);
+ GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin);
+ GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize);
// Clip away border region
if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) {
@@ -1094,8 +941,6 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
// Difference between area and rect
int dx = area.x() - rect.x();
int dy = area.y() - rect.y();
- int dr = area.right() - rect.right();
- int db = area.bottom() - rect.bottom();
// Adjust so painting rect starts from Origo
rect.moveTo(0,0);
@@ -1108,24 +953,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
| (themeData.noContent ? DTBG_OMITCONTENT : 0);
// Drawing the part into the backing store
- if (pDrawThemeBackgroundEx != 0) {
- RECT rect(themeData.toRECT(area));
- pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &rect, &drawOptions);
- } else {
- // Set the clip region, if used..
- if (addBorderContentClipping) {
- HRGN hrgn = qt_hrgn_from_qregion(extraClip);
- SelectClipRgn(dc, hrgn);
- // Compensate for the noBorder area difference (noContent has the same area)
- drawOptions.rcClip = themeData.toRECT(rect.adjusted(dx, dy, dr, db));
- DeleteObject(hrgn);
- }
-
- pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawOptions.rcClip), 0);
-
- if (addBorderContentClipping)
- SelectClipRgn(dc, 0);
- }
+ RECT wRect(themeData.toRECT(area));
+ DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &wRect, &drawOptions);
// If not cached, analyze the buffer data to figure
// out alpha type, and if it contains data
@@ -1183,11 +1012,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
painter->setClipRegion(newRegion);
#if defined(DEBUG_XP_STYLE) && 0
printf("Using region:\n");
- QVector<QRect> rects = newRegion.rects();
- for (int i = 0; i < rects.count(); ++i) {
- const QRect &r = rects.at(i);
+ for (const QRect &r : newRegion)
printf(" (%d, %d, %d, %d)\n", r.x(), r.y(), r.right(), r.bottom());
- }
#endif
}
@@ -1345,12 +1171,12 @@ void QWindowsXPStyle::polish(QWidget *widget)
// Get text color for group box labels
COLORREF cref;
XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0);
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
+ GetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref);
+ GetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref);
d->groupBoxTextColorDisabled = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref));
// Where does this color come from?
- //pGetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref);
+ //GetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref);
d->sliderTickColor = qRgb(165, 162, 148);
d->hasInitColors = true;
}
@@ -1472,15 +1298,7 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option,
int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
rect = option->rect.adjusted(border, border, -border, -border);
- int result = QWindowsXPStylePrivate::pGetThemeMargins(theme,
- NULL,
- BP_PUSHBUTTON,
- stateId,
- TMT_CONTENTMARGINS,
- NULL,
- &borderSize);
-
- if (result == S_OK) {
+ if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) {
rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight,
-borderSize.cxRightWidth, -borderSize.cyBottomHeight);
rect = visualRect(option->direction, option->rect, rect);
@@ -1667,14 +1485,14 @@ case PE_Frame:
else
stateId = ETS_NORMAL;
int fillType;
- if (QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) {
+ if (GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) {
if (fillType == BT_BORDERFILL) {
COLORREF bcRef;
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef);
+ GetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef);
QColor bordercolor(qRgb(GetRValue(bcRef), GetGValue(bcRef), GetBValue(bcRef)));
QPen oldPen = p->pen();
// int borderSize = 1;
- // pGetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize);
+ // GetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize);
// Inner white border
p->setPen(QPen(option->palette.base().color(), 1));
@@ -1733,11 +1551,7 @@ case PE_Frame:
return;
}
int bgType;
- QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(),
- partId,
- stateId,
- TMT_BGTYPE,
- &bgType);
+ GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType);
if( bgType == BT_IMAGEFILE ) {
theme.mirrorHorizontally = hMirrored;
theme.mirrorVertically = vMirrored;
@@ -1750,11 +1564,11 @@ case PE_Frame:
if (!isEnabled) {
PROPERTYORIGIN origin = PO_NOTFOUND;
- QWindowsXPStylePrivate::pGetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin);
+ GetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin);
// Use only if the fill property comes from our part
if ((origin == PO_PART || origin == PO_STATE)) {
COLORREF bgRef;
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef);
+ GetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef);
fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef)));
}
}
@@ -1780,7 +1594,7 @@ case PE_Frame:
wchar_t themeFileName[maxlength];
wchar_t themeColor[maxlength];
// Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it
- if (QWindowsXPStylePrivate::pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) {
+ if (GetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) {
wchar_t *offset = 0;
if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
offset++;
@@ -2567,10 +2381,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
= p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width());
int result = TST_NONE;
- QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
+ GetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
if (result != TST_NONE) {
COLORREF textShadowRef;
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef);
+ GetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef);
QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef));
p->setPen(textShadow);
drawItemText(p, titleRect.adjusted(1, 1, 1, 1),
@@ -3165,10 +2979,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
int result = TST_NONE;
- QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
+ GetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
if (result != TST_NONE) {
COLORREF textShadowRef;
- QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef);
+ GetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef);
QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef));
p->setPen(textShadow);
p->drawText(ir.x() + 3, ir.y() + 2, ir.width() - 1, ir.height(),
@@ -4199,7 +4013,7 @@ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h)
static void showProperty(XPThemeData &themeData, const PropPair &prop)
{
PROPERTYORIGIN origin = PO_NOTFOUND;
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin);
+ GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin);
const char *originStr;
switch(origin) {
case PO_STATE:
@@ -4224,35 +4038,35 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
case TMT_STRING:
{
wchar_t buffer[512];
- pGetThemeString(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512);
+ GetThemeString(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512);
printf(" (%sString) %-20S: %S\n", originStr, prop.propName, buffer);
}
break;
case TMT_ENUM:
{
int result = -1;
- pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sEnum) %-20S: %d\n", originStr, prop.propName, result);
}
break;
case TMT_INT:
{
int result = -1;
- pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sint) %-20S: %d\n", originStr, prop.propName, result);
}
break;
case TMT_BOOL:
{
BOOL result = false;
- pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sbool) %-20S: %d\n", originStr, prop.propName, result);
}
break;
case TMT_COLOR:
{
COLORREF result = 0;
- pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%scolor) %-20S: 0x%08X\n", originStr, prop.propName, result);
}
break;
@@ -4260,7 +4074,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
{
MARGINS result;
memset(&result, 0, sizeof(result));
- pGetThemeMargins(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, 0, &result);
+ GetThemeMargins(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, 0, &result);
printf(" (%smargins) %-20S: (%d, %d, %d, %d)\n", originStr,
prop.propName, result.cxLeftWidth, result.cyTopHeight, result.cxRightWidth, result.cyBottomHeight);
}
@@ -4268,7 +4082,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
case TMT_FILENAME:
{
wchar_t buffer[512];
- pGetThemeFilename(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512);
+ GetThemeFilename(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512);
printf(" (%sfilename)%-20S: %S\n", originStr, prop.propName, buffer);
}
break;
@@ -4280,9 +4094,9 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
memset(&result1, 0, sizeof(result1));
memset(&result2, 0, sizeof(result2));
memset(&result3, 0, sizeof(result3));
- pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1);
- pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2);
- pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_DRAW, &result3);
+ GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1);
+ GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2);
+ GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_DRAW, &result3);
printf(" (%ssize) %-20S: Min (%d, %d), True(%d, %d), Draw(%d, %d)\n", originStr, prop.propName,
result1.cx, result1.cy, result2.cx, result2.cy, result3.cx, result3.cy);
}
@@ -4291,7 +4105,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
{
POINT result;
memset(&result, 0, sizeof(result));
- pGetThemePosition(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemePosition(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sPosition)%-20S: (%d, %d)\n", originStr, prop.propName, result.x, result.y);
}
break;
@@ -4299,7 +4113,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
{
RECT result;
memset(&result, 0, sizeof(result));
- pGetThemeRect(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeRect(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sRect) %-20S: (%d, %d, %d, %d)\n", originStr, prop.propName, result.left, result.top, result.right, result.bottom);
}
break;
@@ -4307,7 +4121,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
{
LOGFONT result;
memset(&result, 0, sizeof(result));
- pGetThemeFont(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeFont(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sFont) %-20S: %S height(%d) width(%d) weight(%d)\n", originStr, prop.propName,
result.lfFaceName, result.lfHeight, result.lfWidth, result.lfWeight);
}
@@ -4316,7 +4130,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop)
{
INTLIST result;
memset(&result, 0, sizeof(result));
- pGetThemeIntList(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
+ GetThemeIntList(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result);
printf(" (%sInt list)%-20S: { ", originStr, prop.propName);
for (int i = 0; i < result.iValueCount; ++i)
printf("%d ", result.iValues[i]);
@@ -4368,7 +4182,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData)
for (int j = 0; j < all_props.count(); ++j) {
PropPair prop = all_props.at(j);
wchar_t buf[500];
- pGetThemeDocumentationProperty(themeName, prop.propName, buf, 500);
+ GetThemeDocumentationProperty(themeName, prop.propName, buf, 500);
printf("%3d: (%4d) %-20S %S\n", j, prop.propValue, prop.propName, buf);
}
}
@@ -4378,7 +4192,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData)
for (int j = 0; j < all_props.count(); ++j) {
PropPair prop = all_props.at(j);
PROPERTYORIGIN origin = PO_NOTFOUND;
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin);
+ GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin);
if (origin == PO_GLOBAL) {
showProperty(themeData, prop);
}
@@ -4389,7 +4203,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData)
for (int j = 0; j < all_props.count(); ++j) {
PropPair prop = all_props.at(j);
PROPERTYORIGIN origin = PO_NOTFOUND;
- pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin);
+ GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin);
if (origin != PO_NOTFOUND)
{
showProperty(themeData, prop);
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 8ee4d1a641..91d60c8e82 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -57,101 +57,12 @@
#include <qt_windows.h>
#include <uxtheme.h>
-
-#if WINVER >= 0x0600
#include <vssym32.h>
-#else
-#include <tmschema.h>
-#endif
#include <limits.h>
QT_BEGIN_NAMESPACE
-// Older Platform SDKs do not have the extended DrawThemeBackgroundEx
-// function. We add the needed parts here, and use the extended
-// function dynamically, if available in uxtheme.dll. Else, we revert
-// back to using the DrawThemeBackground function.
-#ifndef DTBG_OMITBORDER
-# ifndef DTBG_CLIPRECT
-# define DTBG_CLIPRECT 0x00000001
-# endif
-# ifndef DTBG_DRAWSOLID
-# define DTBG_DRAWSOLID 0x00000002
-# endif
-# ifndef DTBG_OMITBORDER
-# define DTBG_OMITBORDER 0x00000004
-# endif
-# ifndef DTBG_OMITCONTENT
-# define DTBG_OMITCONTENT 0x00000008
-# endif
-# ifndef DTBG_COMPUTINGREGION
-# define DTBG_COMPUTINGREGION 0x00000010
-# endif
-# ifndef DTBG_MIRRORDC
-# define DTBG_MIRRORDC 0x00000020
-# endif
- typedef struct _DTBGOPTS
- {
- DWORD dwSize;
- DWORD dwFlags;
- RECT rcClip;
- } DTBGOPTS, *PDTBGOPTS;
-#endif // _DTBGOPTS
-
-// Undefined for some compile environments
-#ifndef TMT_TEXTCOLOR
-# define TMT_TEXTCOLOR 3803
-#endif
-#ifndef TMT_BORDERCOLORHINT
-# define TMT_BORDERCOLORHINT 3822
-#endif
-#ifndef TMT_BORDERSIZE
-# define TMT_BORDERSIZE 2403
-#endif
-#ifndef TMT_BORDERONLY
-# define TMT_BORDERONLY 2203
-#endif
-#ifndef TMT_TRANSPARENTCOLOR
-# define TMT_TRANSPARENTCOLOR 3809
-#endif
-#ifndef TMT_CAPTIONMARGINS
-# define TMT_CAPTIONMARGINS 3603
-#endif
-#ifndef TMT_CONTENTMARGINS
-# define TMT_CONTENTMARGINS 3602
-#endif
-#ifndef TMT_SIZINGMARGINS
-# define TMT_SIZINGMARGINS 3601
-#endif
-#ifndef TMT_GLYPHTYPE
-# define TMT_GLYPHTYPE 4012
-#endif
-#ifndef TMT_BGTYPE
-# define TMT_BGTYPE 4001
-#endif
-#ifndef TMT_TEXTSHADOWTYPE
-# define TMT_TEXTSHADOWTYPE 4010
-#endif
-#ifndef TMT_BORDERCOLOR
-# define TMT_BORDERCOLOR 3801
-#endif
-#ifndef BT_IMAGEFILE
-# define BT_IMAGEFILE 0
-#endif
-#ifndef BT_BORDERFILL
-# define BT_BORDERFILL 1
-#endif
-#ifndef BT_NONE
-# define BT_NONE 2
-#endif
-#ifndef TMT_FILLCOLOR
-# define TMT_FILLCOLOR 3802
-#endif
-#ifndef TMT_PROGRESSCHUNKSIZE
-# define TMT_PROGRESSCHUNKSIZE 2411
-#endif
-
// TMT_TEXTSHADOWCOLOR is wrongly defined in mingw
#if TMT_TEXTSHADOWCOLOR != 3818
#undef TMT_TEXTSHADOWCOLOR
@@ -161,13 +72,6 @@ QT_BEGIN_NAMESPACE
# define TST_NONE 0
#endif
-#ifndef GT_NONE
-# define GT_NONE 0
-#endif
-#ifndef GT_IMAGEGLYPH
-# define GT_IMAGEGLYPH 1
-#endif
-
// These defines are missing from the tmschema, but still exist as
// states for their parts
#ifndef MINBS_INACTIVE
@@ -278,65 +182,7 @@ struct ThemeMapData {
hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {}
};
-struct QWindowsUxThemeLib {
- typedef bool (WINAPI *PtrIsAppThemed)();
- typedef bool (WINAPI *PtrIsThemeActive)();
- typedef HTHEME (WINAPI *PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
- typedef HRESULT (WINAPI *PtrCloseThemeData)(HTHEME hTheme);
- typedef HRESULT (WINAPI *PtrDrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
- typedef HRESULT (WINAPI *PtrDrawThemeBackgroundEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const DTBGOPTS *pOptions);
- typedef HRESULT (WINAPI *PtrGetCurrentThemeName)(OUT LPWSTR pszThemeFileName, int cchMaxNameChars, OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars, OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars);
- typedef HRESULT (WINAPI *PtrGetThemeDocumentationProperty)(LPCWSTR pszThemeName, LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars);
- typedef HRESULT (WINAPI *PtrGetThemeBool)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT BOOL *pfVal);
- typedef HRESULT (WINAPI *PtrGetThemeColor)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor);
- typedef HRESULT (WINAPI *PtrGetThemeEnumValue)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal);
- typedef HRESULT (WINAPI *PtrGetThemeFilename)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars);
- typedef HRESULT (WINAPI *PtrGetThemeFont)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT LOGFONT *pFont);
- typedef HRESULT (WINAPI *PtrGetThemeInt)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal);
- typedef HRESULT (WINAPI *PtrGetThemeIntList)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT INTLIST *pIntList);
- typedef HRESULT (WINAPI *PtrGetThemeMargins)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins);
- typedef HRESULT (WINAPI *PtrGetThemeMetric)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT int *piVal);
- typedef HRESULT (WINAPI *PtrGetThemePartSize)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz);
- typedef HRESULT (WINAPI *PtrGetThemePosition)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT POINT *pPoint);
- typedef HRESULT (WINAPI *PtrGetThemePropertyOrigin)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin);
- typedef HRESULT (WINAPI *PtrGetThemeRect)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT RECT *pRect);
- typedef HRESULT (WINAPI *PtrGetThemeString)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars);
- typedef HRESULT (WINAPI *PtrGetThemeBackgroundRegion)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion);
- typedef BOOL (WINAPI *PtrIsThemeBackgroundPartiallyTransparent)(HTHEME hTheme, int iPartId, int iStateId);
- typedef HRESULT (WINAPI *PtrSetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);
- typedef HRESULT (WINAPI *PtrGetThemeTransitionDuration)(HTHEME hTheme, int iPartId, int iStateFromId, int iStateToId, int iPropId, int *pDuration);
-
- static bool resolveSymbols();
-
- static PtrIsAppThemed pIsAppThemed;
- static PtrIsThemeActive pIsThemeActive;
- static PtrOpenThemeData pOpenThemeData;
- static PtrCloseThemeData pCloseThemeData;
- static PtrDrawThemeBackground pDrawThemeBackground;
- static PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx;
- static PtrGetCurrentThemeName pGetCurrentThemeName;
- static PtrGetThemeBool pGetThemeBool;
- static PtrGetThemeColor pGetThemeColor;
- static PtrGetThemeEnumValue pGetThemeEnumValue;
- static PtrGetThemeFilename pGetThemeFilename;
- static PtrGetThemeFont pGetThemeFont;
- static PtrGetThemeInt pGetThemeInt;
- static PtrGetThemeIntList pGetThemeIntList;
- static PtrGetThemeMargins pGetThemeMargins;
- static PtrGetThemeMetric pGetThemeMetric;
- static PtrGetThemePartSize pGetThemePartSize;
- static PtrGetThemePosition pGetThemePosition;
- static PtrGetThemePropertyOrigin pGetThemePropertyOrigin;
- static PtrGetThemeRect pGetThemeRect;
- static PtrGetThemeString pGetThemeString;
- static PtrGetThemeBackgroundRegion pGetThemeBackgroundRegion;
- static PtrGetThemeDocumentationProperty pGetThemeDocumentationProperty;
- static PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTransparent;
- static PtrSetWindowTheme pSetWindowTheme;
- static PtrGetThemeTransitionDuration pGetThemeTransitionDuration; // Windows Vista onwards.
-};
-
-class QWindowsXPStylePrivate : public QWindowsStylePrivate, public QWindowsUxThemeLib
+class QWindowsXPStylePrivate : public QWindowsStylePrivate
{
Q_DECLARE_PUBLIC(QWindowsXPStyle)
public:
@@ -385,7 +231,6 @@ public:
HDC bufferHDC()
{ return bufferDC;}
- static bool resolveSymbols();
static bool useXP(bool update = false);
static QRect scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme);
@@ -443,7 +288,7 @@ inline QSizeF XPThemeData::size()
QSizeF result(0, 0);
if (isValid()) {
SIZE size;
- if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size)))
+ if (SUCCEEDED(GetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size)))
result = QSize(size.cx, size.cy);
}
return result;
@@ -455,7 +300,7 @@ inline QMarginsF XPThemeData::margins(const QRect &qRect, int propId)
if (isValid()) {
MARGINS margins;
RECT rect = XPThemeData::toRECT(qRect);
- if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, &rect, &margins)))
+ if (SUCCEEDED(GetThemeMargins(handle(), 0, partId, stateId, propId, &rect, &margins)))
result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
}
return result;
@@ -466,7 +311,7 @@ inline QMarginsF XPThemeData::margins(int propId)
QMarginsF result(0, 0, 0 ,0);
if (isValid()) {
MARGINS margins;
- if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins)))
+ if (SUCCEEDED(GetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins)))
result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight);
}
return result;
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 11f7d973cc..1805e4a8af 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -33,11 +33,7 @@ SOURCES += \
styles/qstylesheetstyle_default.cpp \
styles/qpixmapstyle.cpp
-wince* {
- RESOURCES += styles/qstyle_wince.qrc
-} else {
- RESOURCES += styles/qstyle.qrc
-}
+RESOURCES += styles/qstyle.qrc
contains( styles, all ) {
styles = fusion mac windows windowsxp windowsvista
@@ -95,22 +91,6 @@ contains( styles, fusion ) {
DEFINES += QT_NO_STYLE_FUSION
}
-contains( styles, windowsce ) {
- HEADERS += styles/qwindowscestyle_p.h
- HEADERS += styles/qwindowscestyle_p_p.h
- SOURCES += styles/qwindowscestyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWSCE
-}
-
-contains( styles, windowsmobile ) {
- HEADERS += styles/qwindowsmobilestyle_p.h
- HEADERS += styles/qwindowsmobilestyle_p_p.h
- SOURCES += styles/qwindowsmobilestyle.cpp
-} else {
- DEFINES += QT_NO_STYLE_WINDOWSMOBILE
-}
-
contains( styles, android ) {
HEADERS += styles/qandroidstyle_p.h
SOURCES += styles/qandroidstyle.cpp
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 083a4a4f27..5425644b41 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -480,7 +480,7 @@ QMatchData QCompletionEngine::filterHistory()
for (int i = 0; i < source->rowCount(); i++) {
QString str = source->index(i, c->column).data().toString();
if (str.startsWith(c->prefix, c->cs)
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN)
&& ((!isFsModel && !isDirModel) || QDir::toNativeSeparators(str) != QDir::separator())
#endif
)
@@ -1051,7 +1051,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
delete oldModel;
#ifndef QT_NO_DIRMODEL
if (qobject_cast<QDirModel *>(model)) {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
setCaseSensitivity(Qt::CaseInsensitive);
#else
setCaseSensitivity(Qt::CaseSensitive);
@@ -1061,7 +1061,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
#ifndef QT_NO_FILESYSTEMMODEL
QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model);
if (fsModel) {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
setCaseSensitivity(Qt::CaseInsensitive);
#else
setCaseSensitivity(Qt::CaseSensitive);
@@ -1786,7 +1786,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
idx = parent.sibling(parent.row(), index.column());
} while (idx.isValid());
-#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
+#if !defined(Q_OS_WIN)
if (list.count() == 1) // only the separator or some other text
return list[0];
list[0].clear() ; // the join below will provide the separator
@@ -1826,7 +1826,7 @@ QStringList QCompleter::splitPath(const QString& path) const
return QStringList(completionPrefix());
QString pathCopy = QDir::toNativeSeparators(path);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\"))
return QStringList(pathCopy);
const bool startsWithDoubleSlash = pathCopy.startsWith(QLatin1String("\\\\"));
@@ -1837,7 +1837,7 @@ QStringList QCompleter::splitPath(const QString& path) const
const QChar sep = QDir::separator();
QStringList parts = pathCopy.split(sep);
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (startsWithDoubleSlash)
parts[0].prepend(QLatin1String("\\\\"));
#else
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 3606b7c773..7b0ecc6972 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -141,7 +141,7 @@ QSystemTrayIcon::QSystemTrayIcon(QObject *parent)
\sa visible
*/
QSystemTrayIcon::QSystemTrayIcon(const QIcon &icon, QObject *parent)
-: QObject(*new QSystemTrayIconPrivate(), parent)
+ : QSystemTrayIcon(parent)
{
setIcon(icon);
}
@@ -446,19 +446,11 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title
titleLabel->setText(title);
QFont f = titleLabel->font();
f.setBold(true);
-#ifdef Q_OS_WINCE
- f.setPointSize(f.pointSize() - 2);
-#endif
titleLabel->setFont(f);
titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows
-#ifdef Q_OS_WINCE
- const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
- const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2;
-#else
const int iconSize = 18;
const int closeButtonSize = 15;
-#endif
QPushButton *closeButton = new QPushButton;
closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
@@ -468,21 +460,13 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title
QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
QLabel *msgLabel = new QLabel;
-#ifdef Q_OS_WINCE
- f.setBold(false);
- msgLabel->setFont(f);
-#endif
msgLabel->installEventFilter(this);
msgLabel->setText(message);
msgLabel->setTextFormat(Qt::PlainText);
msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
// smart size for the message label
-#ifdef Q_OS_WINCE
- int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2;
-#else
int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3;
-#endif
if (msgLabel->sizeHint().width() > limit) {
msgLabel->setWordWrap(true);
if (msgLabel->sizeHint().width() > limit) {
@@ -493,15 +477,9 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title
control->document()->setDefaultTextOption(opt);
}
}
-#ifdef Q_OS_WINCE
- // Make sure that the text isn't wrapped "somewhere" in the balloon widget
- // in the case that we have a long title label.
- setMaximumWidth(limit);
-#else
// Here we allow the text being much smaller than the balloon widget
// to emulate the weird standard windows behavior.
msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
-#endif
}
QIcon si;
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index f34714c016..3acf1fa777 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -200,7 +200,7 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object)
MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated");
}
- // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
+ // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows 7 and higher
static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
(PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
@@ -208,13 +208,14 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object)
// Call the safer ChangeWindowMessageFilterEx API if available (Windows 7 onwards)
pChangeWindowMessageFilterEx(m_hwnd, MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
} else {
+ // Call the deprecated ChangeWindowMessageFilter API otherwise (Vista onwards)
+ // May 2016: Still resolved at runtime since the definition is not present in MinGW 4.9.
+ // TODO: Replace by direct invocation when upgrading MinGW.
static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
(PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
- if (pChangeWindowMessageFilter) {
- // Call the deprecated ChangeWindowMessageFilter API otherwise
+ if (pChangeWindowMessageFilter)
pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW);
- }
}
}
@@ -413,6 +414,7 @@ QRect QSystemTrayIconSys::findIconGeometry(UINT iconId)
UINT uID;
};
+ // Windows 7 onwards.
static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
(PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"),
"Shell_NotifyIconGetRect");
diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp
deleted file mode 100644
index fa876574f8..0000000000
--- a/src/widgets/util/qsystemtrayicon_wince.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsystemtrayicon_p.h"
-#ifndef QT_NO_SYSTEMTRAYICON
-#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE
-
-#include <qt_windows.h>
-#include <shlwapi.h>
-#include <QApplication>
-
-QT_BEGIN_NAMESPACE
-
-static const UINT q_uNOTIFYICONID = 13; // IDs from 0 to 12 are reserved on WinCE.
-#define MYWM_NOTIFYICON (WM_APP+101)
-
-struct Q_NOTIFYICONIDENTIFIER {
- DWORD cbSize;
- HWND hWnd;
- UINT uID;
- GUID guidItem;
-};
-
-class QSystemTrayIconSys : QWidget
-{
-public:
- QSystemTrayIconSys(QSystemTrayIcon *object);
- ~QSystemTrayIconSys();
- bool winEvent( MSG *m, long *result );
- bool trayMessage(DWORD msg);
- void setIconContents(NOTIFYICONDATA &data);
- void createIcon();
- QRect findTrayGeometry();
- HICON hIcon;
- QPoint globalPos;
- QSystemTrayIcon *q;
-private:
- uint notifyIconSize;
- int maxTipLength;
- bool ignoreNextMouseRelease;
-};
-
-QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
- : hIcon(0), q(object), ignoreNextMouseRelease(false)
-
-{
- notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE;
- maxTipLength = 64;
-}
-
-QSystemTrayIconSys::~QSystemTrayIconSys()
-{
- if (hIcon)
- DestroyIcon(hIcon);
-}
-
-QRect QSystemTrayIconSys::findTrayGeometry()
-{
- // Use lower right corner as fallback
- QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight();
- QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10);
- return ret;
-}
-
-void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd)
-{
- tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
- tnd.uCallbackMessage = MYWM_NOTIFYICON;
- tnd.hIcon = hIcon;
- QString tip = q->toolTip();
-
- if (!tip.isNull()) {
- tip = tip.left(maxTipLength - 1) + QChar();
- memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t));
- }
-}
-
-bool QSystemTrayIconSys::trayMessage(DWORD msg)
-{
- NOTIFYICONDATA tnd;
- memset(&tnd, 0, notifyIconSize);
- tnd.uID = q_uNOTIFYICONID;
- tnd.cbSize = notifyIconSize;
- tnd.hWnd = winId();
-
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
-
- if (msg != NIM_DELETE) {
- setIconContents(tnd);
- }
-
- return Shell_NotifyIcon(msg, &tnd);
-}
-
-void QSystemTrayIconSys::createIcon()
-{
- hIcon = 0;
- QIcon icon = q->icon();
- if (icon.isNull())
- return;
-
- //const QSize preferredSize(GetSystemMetrics(SM_CXSMICON) * 2, GetSystemMetrics(SM_CYSMICON) * 2);
- const QSize preferredSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
- QPixmap pm = icon.pixmap(preferredSize);
- if (pm.isNull())
- return;
-
- hIcon = pm.toWinHICON();
-}
-
-bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
-{
- switch(m->message) {
- case WM_CREATE:
- SetWindowLong(winId(), GWL_USERDATA, (LONG)((CREATESTRUCTW*)m->lParam)->lpCreateParams);
- break;
-
- case MYWM_NOTIFYICON:
- {
- QPoint gpos = QCursor::pos();
-
- switch (m->lParam) {
- case WM_LBUTTONUP:
- if (ignoreNextMouseRelease)
- ignoreNextMouseRelease = false;
- else
- emit q->activated(QSystemTrayIcon::Trigger);
- break;
-
- case WM_LBUTTONDBLCLK:
- ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
- // release we must ignore it
- emit q->activated(QSystemTrayIcon::DoubleClick);
- break;
-
- case WM_RBUTTONUP:
- if (q->contextMenu()) {
- q->contextMenu()->popup(gpos);
-
- // We must ensure that the popup menu doesn't show up behind the task bar.
- QRect desktopRect = qApp->desktop()->availableGeometry();
- int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height();
- if (gpos.y() > maxY) {
- gpos.ry() = maxY;
- q->contextMenu()->move(gpos);
- }
- }
- emit q->activated(QSystemTrayIcon::Context);
- break;
-
- case WM_MBUTTONUP:
- emit q->activated(QSystemTrayIcon::MiddleClick);
- break;
-
- default:
- break;
- }
- break;
- }
- default:
- return QWidget::winEvent(m, result);
- }
- return 0;
-}
-
-QSystemTrayIconPrivate::QSystemTrayIconPrivate()
- : sys(0),
- visible(false)
-{
-}
-
-QSystemTrayIconPrivate::~QSystemTrayIconPrivate()
-{
-}
-
-void QSystemTrayIconPrivate::install_sys()
-{
- Q_Q(QSystemTrayIcon);
- if (!sys) {
- sys = new QSystemTrayIconSys(q);
- sys->createIcon();
- sys->trayMessage(NIM_ADD);
- }
-}
-
-void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut)
-{
- if (!sys)
- return;
-
- uint uSecs = 0;
- if ( timeOut < 0)
- uSecs = 10000; //10 sec default
- else uSecs = (int)timeOut;
-
- //message is limited to 255 chars + NULL
- QString messageString;
- if (message.isEmpty() && !title.isEmpty())
- messageString = QLatin1Char(' '); //ensures that the message shows when only title is set
- else
- messageString = message.left(255) + QChar();
-
- //title is limited to 63 chars + NULL
- QString titleString = title.left(63) + QChar();
-
- //show QBalloonTip
- QRect trayRect = sys->findTrayGeometry();
- QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(),
- trayRect.center().y()), uSecs, false);
-}
-
-QRect QSystemTrayIconPrivate::geometry_sys() const
-{
- return QRect();
-}
-
-void QSystemTrayIconPrivate::remove_sys()
-{
- if (!sys)
- return;
-
- sys->trayMessage(NIM_DELETE);
- delete sys;
- sys = 0;
-}
-
-void QSystemTrayIconPrivate::updateIcon_sys()
-{
- if (!sys)
- return;
-
- HICON hIconToDestroy = sys->hIcon;
-
- sys->createIcon();
- sys->trayMessage(NIM_MODIFY);
-
- if (hIconToDestroy)
- DestroyIcon(hIconToDestroy);
-}
-
-void QSystemTrayIconPrivate::updateMenu_sys()
-{
-
-}
-
-void QSystemTrayIconPrivate::updateToolTip_sys()
-{
- // Calling sys->trayMessage(NIM_MODIFY) on an existing icon is broken on Windows CE.
- // So we need to call updateIcon_sys() which creates a new icon handle.
- updateIcon_sys();
-}
-
-bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
-{
- return true;
-}
-
-bool QSystemTrayIconPrivate::supportsMessages_sys()
-{
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 307debc03f..18f85ca505 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -110,10 +110,8 @@ QT_BEGIN_NAMESPACE
*/
QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent)
+ : QUndoCommand(parent)
{
- d = new QUndoCommandPrivate;
- if (parent != 0)
- parent->d->child_list.append(this);
setText(text);
}
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 9f43dc42f0..700831771d 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -27,7 +27,7 @@ SOURCES += \
util/qundostack.cpp \
util/qundoview.cpp
-win32:!wince:!winrt {
+win32:!winrt {
SOURCES += util/qsystemtrayicon_win.cpp
} else:contains(QT_CONFIG, xcb) {
SOURCES += util/qsystemtrayicon_x11.cpp
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index b609e4c434..e4f7640a10 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -1,5 +1,4 @@
TARGET = QtWidgets
-wince: ORIG_TARGET = $$TARGET
QT = core-private gui-private
MODULE_CONFIG = uic
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 1482b990a6..2587a7a03b 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -493,9 +493,6 @@ void QAbstractScrollAreaPrivate::layoutChildren()
horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0);
#endif
if (!hasCornerWidget && htransient)
-#ifdef Q_OS_MAC
- if (QSysInfo::macVersion() >= QSysInfo::MV_10_8)
-#endif
horizontalScrollBarRect.adjust(0, 0, cornerOffset.x(), 0);
scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect));
scrollBarContainers[Qt::Horizontal]->raise();
@@ -504,9 +501,6 @@ void QAbstractScrollAreaPrivate::layoutChildren()
if (needv) {
QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1));
if (!hasCornerWidget && vtransient)
-#ifdef Q_OS_MAC
- if (QSysInfo::macVersion() >= QSysInfo::MV_10_8)
-#endif
verticalScrollBarRect.adjust(0, 0, 0, cornerOffset.y());
scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect));
scrollBarContainers[Qt::Vertical]->raise();
@@ -1316,7 +1310,7 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e)
void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
{
Q_D(QAbstractScrollArea);
- if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal)
+ if (e->orientation() == Qt::Horizontal)
QApplication::sendEvent(d->hbar, e);
else
QApplication::sendEvent(d->vbar, e);
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index 19369d6cb1..d4ba17b08e 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -204,10 +204,8 @@ QCheckBox::QCheckBox(QWidget *parent)
*/
QCheckBox::QCheckBox(const QString &text, QWidget *parent)
- : QAbstractButton (*new QCheckBoxPrivate, parent)
+ : QCheckBox(parent)
{
- Q_D(QCheckBox);
- d->init();
setText(text);
}
diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp
index 2ec8b1c41a..b6ec2a8d31 100644
--- a/src/widgets/widgets/qcommandlinkbutton.cpp
+++ b/src/widgets/widgets/qcommandlinkbutton.cpp
@@ -281,23 +281,18 @@ QCommandLinkButton::QCommandLinkButton(QWidget *parent)
*/
QCommandLinkButton::QCommandLinkButton(const QString &text, QWidget *parent)
- : QPushButton(*new QCommandLinkButtonPrivate, parent)
+ : QCommandLinkButton(parent)
{
- Q_D(QCommandLinkButton);
setText(text);
- d->init();
}
/*!
Constructs a command link with a \a text, a \a description, and a \a parent.
*/
QCommandLinkButton::QCommandLinkButton(const QString &text, const QString &description, QWidget *parent)
- : QPushButton(*new QCommandLinkButtonPrivate, parent)
+ : QCommandLinkButton(text, parent)
{
- Q_D(QCommandLinkButton);
- setText(text);
setDescription(description);
- d->init();
}
/*!
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 2b68c308ec..0d369eb28c 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -462,9 +462,8 @@ void QDialogButtonBoxPrivate::retranslateStrings()
\sa orientation, addButton()
*/
QDialogButtonBox::QDialogButtonBox(QWidget *parent)
- : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0)
+ : QDialogButtonBox(Qt::Horizontal, parent)
{
- d_func()->initLayout();
}
/*!
@@ -487,10 +486,8 @@ QDialogButtonBox::QDialogButtonBox(Qt::Orientation orientation, QWidget *parent)
\sa orientation, addButton()
*/
QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent)
- : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0)
+ : QDialogButtonBox(buttons, Qt::Horizontal, parent)
{
- d_func()->initLayout();
- d_func()->createStandardButtons(buttons);
}
/*!
@@ -501,9 +498,8 @@ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent)
*/
QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,
QWidget *parent)
- : QWidget(*new QDialogButtonBoxPrivate(orientation), parent, 0)
+ : QDialogButtonBox(orientation, parent)
{
- d_func()->initLayout();
d_func()->createStandardButtons(buttons);
}
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 293a04ef88..2358568efe 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -230,7 +230,7 @@ bool QDockWidgetLayout::nativeWindowDeco() const
*/
bool QDockWidgetLayout::wmSupportsNativeWindowDeco()
{
-#if defined(Q_OS_WINCE) || defined(Q_OS_ANDROID)
+#if defined(Q_OS_ANDROID)
return false;
#else
static const bool xcb = !QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive);
@@ -1224,10 +1224,8 @@ QDockWidget::QDockWidget(QWidget *parent, Qt::WindowFlags flags)
\sa setWindowTitle()
*/
QDockWidget::QDockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QWidget(*new QDockWidgetPrivate, parent, flags)
+ : QDockWidget(parent, flags)
{
- Q_D(QDockWidget);
- d->init();
setWindowTitle(title);
}
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index a2ba50695a..b02651767c 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -110,7 +110,7 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f)
QAlphaWidget::~QAlphaWidget()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
// Restore user-defined opacity value
if (widget)
widget->setWindowOpacity(1);
@@ -144,7 +144,7 @@ void QAlphaWidget::run(int time)
checkTime.start();
showWidget = true;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
qApp->installEventFilter(this);
widget->setWindowOpacity(0.0);
widget->show();
@@ -251,7 +251,7 @@ void QAlphaWidget::render()
else
alpha = 1;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN)
if (alpha >= 1 || !showWidget) {
anim.stop();
qApp->removeEventFilter(this);
@@ -268,10 +268,6 @@ void QAlphaWidget::render()
if (widget) {
if (!showWidget) {
-#ifdef Q_OS_WIN
- setEnabled(true);
- setFocus();
-#endif // Q_OS_WIN
widget->hide();
} else {
//Since we are faking the visibility of the widget
@@ -288,7 +284,7 @@ void QAlphaWidget::render()
pm = QPixmap::fromImage(mixedImage);
repaint();
}
-#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#endif // defined(Q_OS_WIN)
}
/*
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index 5bdd6f20e6..a9b32ae065 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -194,10 +194,8 @@ QGroupBox::QGroupBox(QWidget *parent)
*/
QGroupBox::QGroupBox(const QString &title, QWidget *parent)
- : QWidget(*new QGroupBoxPrivate, parent, 0)
+ : QGroupBox(parent)
{
- Q_D(QGroupBox);
- d->init();
setTitle(title);
}
diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp
index f8a3be366e..2fbc42330d 100644
--- a/src/widgets/widgets/qkeysequenceedit.cpp
+++ b/src/widgets/widgets/qkeysequenceedit.cpp
@@ -138,21 +138,17 @@ void QKeySequenceEditPrivate::finishEditing()
/*!
Constructs a QKeySequenceEdit widget with the given \a parent.
*/
-QKeySequenceEdit::QKeySequenceEdit(QWidget *parent) :
- QWidget(*new QKeySequenceEditPrivate, parent, 0)
+QKeySequenceEdit::QKeySequenceEdit(QWidget *parent)
+ : QKeySequenceEdit(*new QKeySequenceEditPrivate, parent, 0)
{
- Q_D(QKeySequenceEdit);
- d->init();
}
/*!
Constructs a QKeySequenceEdit widget with the given \a keySequence and \a parent.
*/
-QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent) :
- QWidget(*new QKeySequenceEditPrivate, parent, 0)
+QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent)
+ : QKeySequenceEdit(parent)
{
- Q_D(QKeySequenceEdit);
- d->init();
setKeySequence(keySequence);
}
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 5db1013fd2..76713d9880 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -233,10 +233,8 @@ QLabel::QLabel(QWidget *parent, Qt::WindowFlags f)
\sa setText(), setAlignment(), setFrameStyle(), setIndent()
*/
QLabel::QLabel(const QString &text, QWidget *parent, Qt::WindowFlags f)
- : QFrame(*new QLabelPrivate(), parent, f)
+ : QLabel(parent, f)
{
- Q_D(QLabel);
- d->init();
setText(text);
}
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 543a7aee11..2703e5d8a3 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -338,11 +338,8 @@ static const char *getSegments(char ch) // gets list of segments f
*/
QLCDNumber::QLCDNumber(QWidget *parent)
- : QFrame(*new QLCDNumberPrivate, parent)
+ : QLCDNumber(5, parent)
{
- Q_D(QLCDNumber);
- d->ndigits = 5;
- d->init();
}
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 56965923b7..2bc715724d 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -260,10 +260,8 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const
\sa setText(), setMaxLength()
*/
QLineEdit::QLineEdit(QWidget* parent)
- : QWidget(*new QLineEditPrivate, parent,0)
+ : QLineEdit(QString(), parent)
{
- Q_D(QLineEdit);
- d->init(QString());
}
/*!
@@ -1911,13 +1909,19 @@ void QLineEdit::paintEvent(QPaintEvent *)
if (d->shouldShowPlaceholderText()) {
if (!d->placeholderText.isEmpty()) {
+ const Qt::LayoutDirection layoutDir = d->placeholderText.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
+ const Qt::Alignment alignPhText = QStyle::visualAlignment(layoutDir, QFlag(d->alignment));
QColor col = pal.text().color();
col.setAlpha(128);
QPen oldpen = p.pen();
p.setPen(col);
- QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width());
- p.drawText(lineRect, va, elidedText);
+ Qt::LayoutDirection oldLayoutDir = p.layoutDirection();
+ p.setLayoutDirection(layoutDir);
+
+ const QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width());
+ p.drawText(lineRect, alignPhText, elidedText);
p.setPen(oldpen);
+ p.setLayoutDirection(oldLayoutDir);
}
}
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 477bb92601..2d19780461 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -100,8 +100,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration(functionName);
if (Q_UNLIKELY(!function))
- qWarning() << "Qt could not resolve function" << functionName
- << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()";
+ qWarning("Qt could not resolve function %s from "
+ "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()",
+ functionName.constData());
return function;
}
} //namespsace
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index 6c113b556f..b6c5179989 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -89,8 +89,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration(functionName);
if (Q_UNLIKELY(!function))
- qWarning() << "Qt could not resolve function" << functionName
- << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()";
+ qWarning("Qt could not resolve function %s from "
+ "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()",
+ functionName.constData());
return function;
}
} //namespsace
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index b42ebe7e48..5f3aff5e10 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -2670,9 +2670,8 @@ void QMdiArea::paintEvent(QPaintEvent *paintEvent)
{
Q_D(QMdiArea);
QPainter painter(d->viewport);
- const QVector<QRect> &exposedRects = paintEvent->region().rects();
- for (int i = 0; i < exposedRects.size(); ++i)
- painter.fillRect(exposedRects.at(i), d->background);
+ for (const QRect &exposedRect : paintEvent->region())
+ painter.fillRect(exposedRect, d->background);
}
/*!
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 610cb1201f..afe87c6af9 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -412,6 +412,10 @@ bool ControlLabel::event(QEvent *event)
{
if (event->type() == QEvent::WindowIconChange)
updateWindowIcon();
+ else if (event->type() == QEvent::StyleChange) {
+ updateWindowIcon();
+ setFixedSize(label.size());
+ }
#ifndef QT_NO_TOOLTIP
else if (event->type() == QEvent::ToolTip) {
QStyleOptionTitleBar options;
@@ -480,7 +484,8 @@ void ControlLabel::updateWindowIcon()
QIcon menuIcon = windowIcon();
if (menuIcon.isNull())
menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget());
- label = menuIcon.pixmap(16, 16);
+ const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, 0, parentWidget());
+ label = menuIcon.pixmap(iconSize);
update();
}
@@ -556,7 +561,8 @@ QSize ControllerWidget::sizeHint() const
ensurePolished();
QStyleOptionComplex opt;
initStyleOption(&opt);
- QSize size(48, 16);
+ const int buttonSize = style()->pixelMetric(QStyle::PM_TitleBarButtonSize, &opt, mdiArea);
+ QSize size(3 * buttonSize, buttonSize);
return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea);
}
@@ -1769,7 +1775,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const
if (isChildOfTabbedQMdiArea(q))
return false;
-#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM)
+#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC)
Q_UNUSED(isChildOfQMdiSubWindow);
return true;
#else
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index e1c2b05909..cb99b58d97 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1481,10 +1481,9 @@ QMenu::QMenu(QWidget *parent)
\sa title
*/
QMenu::QMenu(const QString &title, QWidget *parent)
- : QWidget(*new QMenuPrivate, parent, Qt::Popup)
+ : QMenu(parent)
{
Q_D(QMenu);
- d->init();
d->menuAction->setText(title);
}
@@ -3358,17 +3357,6 @@ void QMenu::actionEvent(QActionEvent *e)
d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators);
}
-#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
- if (!d->wce_menu)
- d->wce_menu = new QMenuPrivate::QWceMenuPrivate;
- if (e->type() == QEvent::ActionAdded)
- d->wce_menu->addAction(e->action(), d->wce_menu->findAction(e->before()));
- else if (e->type() == QEvent::ActionRemoved)
- d->wce_menu->removeAction(e->action());
- else if (e->type() == QEvent::ActionChanged)
- d->wce_menu->syncAction(e->action());
-#endif
-
if (isVisible()) {
d->updateActionRects();
resize(sizeHint());
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 7dda38456a..fd931e3d5b 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -45,9 +45,6 @@
#include <QtGui/qicon.h>
#include <QtWidgets/qaction.h>
-#ifdef Q_OS_WINCE
-#include <windef.h> // for HMENU
-#endif
#ifdef Q_OS_OSX
Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu);
#endif
@@ -85,11 +82,17 @@ public:
QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0);
+ template<typename Functor>
QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0);
+ template<typename Functor>
QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0);
+ template<typename PointerToMemberFunction>
QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0);
+ template<typename Functor>
QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0);
+ template<typename Functor>
QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0);
#else
// addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
@@ -208,9 +211,6 @@ public:
QPlatformMenu *platformMenu();
void setPlatformMenu(QPlatformMenu *platformMenu);
-#ifdef Q_OS_WINCE
- HMENU wceMenu();
-#endif
#ifdef Q_OS_OSX
NSMenu* toNSMenu();
void setAsDockMenu();
@@ -249,10 +249,6 @@ protected:
bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const;
-#ifdef Q_OS_WINCE
- QAction* wceCommands(uint command);
-#endif
-
private Q_SLOTS:
void internalDelayedPopup();
diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm
index 29f5913b5d..d48041b385 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -62,8 +62,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration(functionName);
if (Q_UNLIKELY(!function))
- qWarning() << "Qt could not resolve function" << functionName
- << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()";
+ qWarning("Qt could not resolve function %s from "
+ "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()",
+ functionName.constData());
return function;
}
} //namespsace
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 0705cd12ea..3ad7c3c7c5 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -68,15 +68,6 @@ QT_BEGIN_NAMESPACE
class QTornOffMenu;
class QEventLoop;
-#ifdef Q_OS_WINCE
-struct QWceMenuAction {
- uint command;
- QPointer<QAction> action;
- HMENU menuHandle;
- QWceMenuAction() : menuHandle(0), command(0) {}
-};
-#endif
-
template <typename T>
class QSetValueOnDestroy
{
@@ -301,19 +292,13 @@ public:
#endif
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
hasCheckableItems(0), doChildEffects(false), platformMenu(0)
-
-#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
- ,wce_menu(0)
-#endif
{ }
+
~QMenuPrivate()
{
delete scroll;
if (!platformMenu.isNull() && !platformMenu->parent())
delete platformMenu.data();
-#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
- delete wce_menu;
-#endif
}
void init();
void setPlatformMenu(QPlatformMenu *menu);
@@ -473,31 +458,6 @@ public:
QPointer<QAction> actionAboutToTrigger;
-#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
- struct QWceMenuPrivate {
- QList<QWceMenuAction*> actionItems;
- HMENU menuHandle;
- QWceMenuPrivate();
- ~QWceMenuPrivate();
- void addAction(QAction *, QWceMenuAction* =0);
- void addAction(QWceMenuAction *, QWceMenuAction* =0);
- void syncAction(QWceMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QWceMenuAction *);
- void rebuild();
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QWceMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QWceMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *wce_menu;
- HMENU wceMenu();
- QAction* wceCommands(uint command);
-#endif
QPointer<QWidget> noReplayFor;
static QPointer<QMenu> previousMouseMenu;
};
diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp
deleted file mode 100644
index d7397746fc..0000000000
--- a/src/widgets/widgets/qmenu_wince.cpp
+++ /dev/null
@@ -1,666 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Native menubars are only supported for Windows Mobile not the standard SDK/generic WinCE
-#ifdef Q_OS_WINCE
-#include "qmenu.h"
-#include "qt_windows.h"
-#include "qapplication.h"
-#include "qmainwindow.h"
-#include "qtoolbar.h"
-#include "qevent.h"
-#include "qstyle.h"
-#include "qdebug.h"
-#include "qwidgetaction.h"
-#include <private/qapplication_p.h>
-#include <private/qmenu_p.h>
-#include <private/qmenubar_p.h>
-
-#include "qmenu_wince_resource_p.h"
-
-#include <QtCore/qlibrary.h>
-#include <commctrl.h>
-#if Q_OS_WINCE_WM
-# include <windowsm.h>
-#endif
-
-#ifndef QT_NO_MENUBAR
-
-#ifndef SHCMBF_EMPTYBAR
-#define SHCMBF_EMPTYBAR 0x0001
-#endif
-
-#ifndef SHCMBM_GETSUBMENU
-#define SHCMBM_GETSUBMENU (WM_USER + 401)
-#endif
-
-#ifdef Q_OS_WINCE_WM
-# define SHMBOF_NODEFAULT 0x00000001
-# define SHMBOF_NOTIFY 0x00000002
-# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193)
-#endif
-
-extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp
-extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp
-
-QT_BEGIN_NAMESPACE
-
-static uint qt_wce_menu_static_cmd_id = 200;
-static QList<QMenuBar*> nativeMenuBars;
-
-struct qt_SHMENUBARINFO
-{
- DWORD cbSize;
- HWND hwndParent;
- DWORD dwFlags;
- UINT nToolBarId;
- HINSTANCE hInstRes;
- int nBmpId;
- int cBmpImages;
- HWND hwndMB;
- COLORREF clrBk;
-};
-
-typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*);
-typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL);
-
-static bool aygResolved = false;
-static AygCreateMenuBar ptrCreateMenuBar = 0;
-static AygEnableSoftKey ptrEnableSoftKey = 0;
-
-static void resolveAygLibs()
-{
- if (!aygResolved) {
- aygResolved = true;
- QLibrary aygLib(QLatin1String("aygshell"));
- ptrCreateMenuBar = (AygCreateMenuBar) aygLib.resolve("SHCreateMenuBar");
- ptrEnableSoftKey = (AygEnableSoftKey) aygLib.resolve("SHEnableSoftkey");
- }
-}
-
-static void qt_wce_enable_soft_key(HWND handle, uint command)
-{
- resolveAygLibs();
- if (ptrEnableSoftKey)
- ptrEnableSoftKey(handle, command, false, true);
-}
-
-static void qt_wce_disable_soft_key(HWND handle, uint command)
-{
- resolveAygLibs();
- if (ptrEnableSoftKey)
- ptrEnableSoftKey(handle, command, false, false);
-}
-
-static void qt_wce_delete_action_list(QList<QWceMenuAction*> *list)
-{
- for(QList<QWceMenuAction*>::Iterator it = list->begin(); it != list->end(); ++it) {
- QWceMenuAction *action = (*it);
- delete action;
- action = 0;
- }
- list->clear();
-}
-
-//search for first QuitRole in QMenuBar
-static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems)
-{
- QAction *returnAction = 0;
- for (int i = 0; i < actionItems.size(); ++i) {
- QAction *action = actionItems.at(i);
- if (action->menuRole() == QAction::QuitRole)
- returnAction = action;
- else
- if (action->menu())
- returnAction = qt_wce_get_quit_action(action->menu()->actions());
- if (returnAction)
- return returnAction; //return first action found
- }
- return 0; //nothing found;
-}
-
-static QAction* qt_wce_get_quit_action(QList<QWceMenuAction*> actionItems)
-{
- for (int i = 0; i < actionItems.size(); ++i) {
- if (actionItems.at(i)->action->menuRole() == QAction::QuitRole)
- return actionItems.at(i)->action;
- else if (actionItems.at(i)->action->menu()) {
- QAction *returnAction = qt_wce_get_quit_action(actionItems.at(i)->action->menu()->actions());
- if (returnAction)
- return returnAction;
- }
- }
- return 0;
-}
-
-static HMODULE qt_wce_get_module_handle()
-{
- HMODULE module = 0; //handle to resources
- if (!(module = GetModuleHandle(L"QtGui4"))) //release dynamic
- if (!(module = GetModuleHandle(L"QtGuid4"))) //debug dynamic
- module = (HINSTANCE)qWinAppInst(); //static
- Q_ASSERT_X(module, "qt_wce_get_module_handle()", "cannot get handle to module?");
- return module;
-}
-
-static void qt_wce_change_command(HWND menuHandle, int item, int command)
-{
-TBBUTTONINFOA tbbi;
- memset(&tbbi,0,sizeof(tbbi));
- tbbi.cbSize = sizeof(tbbi);
- tbbi.dwMask = TBIF_COMMAND;
- tbbi.idCommand = command;
- SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi);
-}
-
-static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText)
-{
- TBBUTTONINFOA tbbi;
- memset(&tbbi,0,sizeof(tbbi));
- tbbi.cbSize = sizeof(tbbi);
- tbbi.dwMask = TBIF_TEXT;
- QString text = newText;
- text.remove(QChar::fromLatin1('&'));
- tbbi.pszText = (LPSTR) text.utf16();
- SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi);
-}
-
-static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0)
-{
- resolveAygLibs();
-
- if (ptrCreateMenuBar) {
- qt_SHMENUBARINFO mbi;
- memset(&mbi, 0, sizeof(qt_SHMENUBARINFO));
- mbi.cbSize = sizeof(qt_SHMENUBARINFO);
- mbi.hwndParent = parentHandle;
- mbi.hInstRes = resourceHandle;
- mbi.dwFlags = flags;
- mbi.nToolBarId = toolbarID;
-
- if (ptrCreateMenuBar(&mbi)) {
-#ifdef Q_OS_WINCE_WM
- // Tell the menu bar that we want to override hot key behaviour.
- LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
- SHMBOF_NODEFAULT | SHMBOF_NOTIFY);
- SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam);
-#endif
- return mbi.hwndMB;
- }
- }
- return 0;
-}
-
-static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action)
-{
- Q_ASSERT_X(menu, "AppendMenu", "menu is 0");
- if (action->action->isVisible()) {
- int flags;
- action->action->isEnabled() ? flags = MF_ENABLED : flags = MF_GRAYED;
-
- QString text = action->action->iconText();
- text.remove(QChar::fromLatin1('&'));
- if (action->action->isSeparator()) {
- AppendMenu (menu, MF_SEPARATOR , 0, 0);
- }
- else if (action->action->menu()) {
- text.remove(QChar::fromLatin1('&'));
- AppendMenu (menu, MF_STRING | flags | MF_POPUP,
- (UINT) action->action->menu()->wceMenu(), reinterpret_cast<const wchar_t *> (text.utf16()));
- }
- else {
- AppendMenu (menu, MF_STRING | flags, action->command, reinterpret_cast<const wchar_t *> (text.utf16()));
- }
- if (action->action->isCheckable())
- if (action->action->isChecked())
- CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_CHECKED);
- else
- CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_UNCHECKED);
- }
-}
-
-// Removes all items from the menu without destroying the handles.
-static void qt_wce_clear_menu(HMENU hMenu)
-{
- while (RemoveMenu(hMenu, 0, MF_BYPOSITION));
-}
-
-/*!
- \internal
-
- This function refreshes the native Windows CE menu.
-*/
-
-void QMenuBar::wceRefresh()
-{
- for (int i = 0; i < nativeMenuBars.size(); ++i)
- nativeMenuBars.at(i)->d_func()->wceRefresh();
-}
-
-void QMenuBarPrivate::wceRefresh()
-{
- DrawMenuBar(wce_menubar->menubarHandle);
-}
-
-/*!
- \internal
-
- This function sends native Windows CE commands to Qt menus.
-*/
-
-QAction* QMenu::wceCommands(uint command)
-{
- Q_D(QMenu);
- return d->wceCommands(command);
-}
-
-/*!
- \internal
-
- This function sends native Windows CE commands to Qt menu bars
- and all their child menus.
-*/
-
-void QMenuBar::wceCommands(uint command)
-{
- const HWND hwndActiveWindow = GetActiveWindow();
- for (int i = 0; i < nativeMenuBars.size(); ++i) {
- QMenuBarPrivate* nativeMenuBar = nativeMenuBars.at(i)->d_func();
- if (hwndActiveWindow == nativeMenuBar->wce_menubar->parentWindowHandle)
- nativeMenuBar->wceCommands(command);
- }
-}
-
-bool QMenuBarPrivate::wceEmitSignals(QList<QWceMenuAction*> actions, uint command)
-{
- QAction *foundAction = 0;
- for (int i = 0; i < actions.size(); ++i) {
- QWceMenuAction *action = actions.at(i);
- if (action->action->menu()) {
- foundAction = action->action->menu()->wceCommands(command);
- if (foundAction)
- break;
- }
- else if (action->command == command) {
- action->action->activate(QAction::Trigger);
- return true;
- }
- }
- if (foundAction) {
- emit q_func()->triggered(foundAction);
- return true;
- }
- return false;
-}
-
-void QMenuBarPrivate::wceCommands(uint command)
-{
- if (wceClassicMenu) {
- for (int i = 0; i < wce_menubar->actionItemsClassic.size(); ++i)
- wceEmitSignals(wce_menubar->actionItemsClassic.at(i), command);
- } else {
- if (wceEmitSignals(wce_menubar->actionItems, command)) {
- return;
- }
- else if (wce_menubar->leftButtonIsMenu) {//check if command is on the left quick button
- wceEmitSignals(wce_menubar->actionItemsLeftButton, command);
- }
- else if ((wce_menubar->leftButtonAction) && (command == wce_menubar->leftButtonCommand)) {
- emit q_func()->triggered(wce_menubar->leftButtonAction);
- wce_menubar->leftButtonAction->activate(QAction::Trigger);
- }
- }
-}
-
-QAction *QMenuPrivate::wceCommands(uint command)
-{
- QAction *foundAction = 0;
- for (int i = 0; i < wce_menu->actionItems.size(); ++i) {
- if (foundAction)
- break;
- QWceMenuAction *action = wce_menu->actionItems.at(i);
- if (action->action->menu()) {
- foundAction = action->action->menu()->d_func()->wceCommands(command);
- }
- else if (action->command == command) {
- activateAction(action->action, QAction::Trigger);
- return action->action;
- }
- }
- if (foundAction)
- emit q_func()->triggered(foundAction);
- return foundAction;
-}
-
-void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent)
-{
- Q_Q(QMenuBar);
- wce_menubar = new QWceMenuBarPrivate(this);
-
- wce_menubar->parentWindowHandle = parent ? QApplicationPrivate::getHWNDForWidget(parent) :
- QApplicationPrivate::getHWNDForWidget(q);
- wce_menubar->leftButtonAction = defaultAction;
-
- wce_menubar->menubarHandle = qt_wce_create_menubar(wce_menubar->parentWindowHandle, (HINSTANCE)qWinAppInst(), 0, SHCMBF_EMPTYBAR);
- Q_ASSERT_X(wce_menubar->menubarHandle, "wceCreateMenuBar", "cannot create empty menu bar");
- DrawMenuBar(wce_menubar->menubarHandle);
- nativeMenuBars.append(q);
- wceClassicMenu = (!qt_wince_is_smartphone() && !qt_wince_is_pocket_pc());
-}
-
-void QMenuBarPrivate::wceDestroyMenuBar()
-{
- Q_Q(QMenuBar);
- int index = nativeMenuBars.indexOf(q);
- nativeMenuBars.removeAt(index);
- if (wce_menubar) {
- delete wce_menubar;
- wce_menubar = 0;
- }
-}
-
-QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate(QMenuBarPrivate *menubar)
-: menubarHandle(0), menuHandle(0), leftButtonMenuHandle(0),
- leftButtonAction(0), leftButtonIsMenu(false), d(menubar)
-{
-}
-
-QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate()
-{
- if (menubarHandle)
- DestroyWindow(menubarHandle);
- qt_wce_delete_action_list(&actionItems);
- qt_wce_delete_action_list(&actionItemsLeftButton);
-
- for (int i=0; i<actionItemsClassic.size(); ++i)
- if (!actionItemsClassic.value(i).empty())
- qt_wce_delete_action_list(&actionItemsClassic[i]);
- actionItemsClassic.clear();
-
- menubarHandle = 0;
- menuHandle = 0;
- leftButtonMenuHandle = 0;
- leftButtonCommand = 0;
- QMenuBar::wceRefresh();
-}
-
-QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate()
-: menuHandle(0)
-{
-}
-
-QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate()
-{
- qt_wce_delete_action_list(&actionItems);
- if (menuHandle)
- DestroyMenu(menuHandle);
-}
-
-void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before)
-{
- QWceMenuAction *action = new QWceMenuAction;
- action->action = a;
- action->command = qt_wce_menu_static_cmd_id++;
- addAction(action, before);
-}
-
-void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)
-{
- if (!action)
- return;
- int before_index = actionItems.indexOf(before);
- if (before_index < 0) {
- before = 0;
- before_index = actionItems.size();
- }
- actionItems.insert(before_index, action);
- rebuild();
-}
-
-/*!
- \internal
-
- This function will return the HMENU used to create the native
- Windows CE menu bar bindings.
-*/
-
-HMENU QMenu::wceMenu()
-{
- return d_func()->wceMenu();
-}
-
-HMENU QMenuPrivate::wceMenu()
-{
- if (!wce_menu)
- wce_menu = new QWceMenuPrivate;
- if (!wce_menu->menuHandle)
- wce_menu->rebuild();
- return wce_menu->menuHandle;
-}
-
-void QMenuPrivate::QWceMenuPrivate::rebuild()
-{
- if (!menuHandle)
- menuHandle = CreatePopupMenu();
- else
- qt_wce_clear_menu(menuHandle);
-
- for (int i = 0; i < actionItems.size(); ++i) {
- QWceMenuAction *action = actionItems.at(i);
- action->menuHandle = menuHandle;
- qt_wce_insert_action(menuHandle, action);
- }
- QMenuBar::wceRefresh();
-}
-
-void QMenuPrivate::QWceMenuPrivate::syncAction(QWceMenuAction *)
-{
- rebuild();
-}
-
-void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action)
-{
- actionItems.removeAll(action);
- delete action;
- rebuild();
-}
-
-void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before)
-{
- QWceMenuAction *action = new QWceMenuAction;
- action->action = a;
- action->command = qt_wce_menu_static_cmd_id++;
- addAction(action, findAction(before));
-}
-
-void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before)
-{
- if (!action)
- return;
- int before_index = actionItems.indexOf(before);
- if (before_index < 0) {
- before = 0;
- before_index = actionItems.size();
- }
- actionItems.insert(before_index, action);
- rebuild();
-}
-
-void QMenuBarPrivate::QWceMenuBarPrivate::syncAction(QWceMenuAction*)
-{
- QMenuBar::wceRefresh();
- rebuild();
-}
-
-void QMenuBarPrivate::QWceMenuBarPrivate::removeAction(QWceMenuAction *action)
-{
- actionItems.removeAll(action);
- delete action;
- rebuild();
-}
-
-void QMenuBarPrivate::_q_updateDefaultAction()
-{
- if (wce_menubar)
- wce_menubar->rebuild();
-}
-
-void QMenuBarPrivate::QWceMenuBarPrivate::rebuild()
-{
- d->q_func()->resize(0,0);
- parentWindowHandle = d->q_func()->parentWidget() ? QApplicationPrivate::getHWNDForWidget(d->q_func()->parentWidget()) :
- QApplicationPrivate::getHWNDForWidget(d->q_func());
- if (d->wceClassicMenu) {
- QList<QAction*> actions = d->actions;
- int maxEntries;
- int resourceHandle;
- if (actions.size() < 5) {
- maxEntries = 4;
- resourceHandle = IDR_MAIN_MENU3;
- } else if (actions.size() < 7) {
- maxEntries = 6;
- resourceHandle = IDR_MAIN_MENU4;
- }
- else {
- maxEntries = 8;
- resourceHandle = IDR_MAIN_MENU5;
- }
- Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted");
- qt_wce_clear_menu(menuHandle);
- DestroyWindow(menubarHandle);
- menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle);
- Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource");
- DrawMenuBar(menubarHandle);
- QList<int> menu_ids;
- QList<int> item_ids;
- menu_ids << IDM_MENU1 << IDM_MENU2 << IDM_MENU3 << IDM_MENU4 << IDM_MENU5 << IDM_MENU6 << IDM_MENU7 << IDM_MENU8;
- item_ids << IDM_ITEM1 << IDM_ITEM2 << IDM_ITEM3 << IDM_ITEM4 << IDM_ITEM5 << IDM_ITEM6 << IDM_ITEM7 << IDM_ITEM8;
-
- for (int i = 0; i < actionItemsClassic.size(); ++i)
- if (!actionItemsClassic.value(i).empty())
- qt_wce_delete_action_list(&actionItemsClassic[i]);
- actionItemsClassic.clear();
-
- for (int i = 0; i < actions.size(); ++i) {
- qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), actions.at(i)->text());
- QList<QAction *> subActions = actions.at(i)->menu()->actions();
- HMENU subMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0 , menu_ids.at(i));
- DeleteMenu(subMenuHandle, item_ids.at(i), MF_BYCOMMAND);
- for (int c = 0; c < subActions.size(); ++c) {
- QList<QWceMenuAction*> list;
- actionItemsClassic.append(list);
- QWceMenuAction *action = new QWceMenuAction;
- action->action = subActions.at(c);
- action->command = qt_wce_menu_static_cmd_id++;
- action->menuHandle = subMenuHandle;
- actionItemsClassic.last().append(action);
- qt_wce_insert_action(subMenuHandle, action);
- }
- }
- for (int i = actions.size();i<maxEntries;++i) {
- qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), QString());
- qt_wce_disable_soft_key(menubarHandle, menu_ids.at(i));
- }
- } else {
- leftButtonAction = d->defaultAction;
- if (!leftButtonAction)
- leftButtonAction = qt_wce_get_quit_action(actionItems);
-
- leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu());
- Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted");
- qt_wce_clear_menu(menuHandle);
- DestroyWindow(menubarHandle);
- if (leftButtonIsMenu) {
- menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2);
- Q_ASSERT_X(menubarHandle, "rebuild !created left menubar", "cannot create menubar from resource");
- menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU);
- Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?");
- DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND);
- leftButtonMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_LEFTMENU);
- Q_ASSERT_X(leftButtonMenuHandle, "rebuild !created", "IDM_LEFTMENU not found - invalid resource?");
- DeleteMenu(leftButtonMenuHandle, IDM_VIEW, MF_BYCOMMAND);
- } else {
- menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU);
- Q_ASSERT_X(menubarHandle, "rebuild !created no left menubar", "cannot create menubar from resource");
- menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU);
- Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?");
- DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND);
- leftButtonMenuHandle = 0;
- leftButtonCommand = qt_wce_menu_static_cmd_id++;
- qt_wce_change_command(menubarHandle, IDM_EXIT, leftButtonCommand);
- }
-
- if (actionItems.size() == 0) {
- qt_wce_rename_menu_item(menubarHandle, IDM_MENU, QLatin1String(""));
- qt_wce_disable_soft_key(menubarHandle, IDM_MENU);
- }
- for (int i = 0; i < actionItems.size(); ++i) {
- QWceMenuAction *action = actionItems.at(i);
- action->menuHandle = menuHandle;
- qt_wce_insert_action(menuHandle, action);
- }
- if (!leftButtonIsMenu) {
- if (leftButtonAction) {
- qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, leftButtonAction->text());
- qt_wce_enable_soft_key(menubarHandle, leftButtonCommand);
- } else {
- qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String(""));
- qt_wce_disable_soft_key(menubarHandle, leftButtonCommand);
- }
- } else {
- qt_wce_rename_menu_item(menubarHandle, IDM_LEFTMENU, leftButtonAction->text());
- QList<QAction *> actions = leftButtonAction->menu()->actions();
- qt_wce_delete_action_list(&actionItemsLeftButton);
- for (int i=0; i<actions.size(); ++i) {
- QWceMenuAction *action = new QWceMenuAction;
- action->action = actions.at(i);
- action->command = qt_wce_menu_static_cmd_id++;
- action->menuHandle = leftButtonMenuHandle;
- actionItemsLeftButton.append(action);
- qt_wce_insert_action(leftButtonMenuHandle, action);
- }
- }
- }
- DrawMenuBar(menubarHandle);
-}
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_MENUBAR
-#endif //Q_OS_WINCE
diff --git a/src/widgets/widgets/qmenu_wince.rc b/src/widgets/widgets/qmenu_wince.rc
deleted file mode 100644
index 0bcd32c7e5..0000000000
--- a/src/widgets/widgets/qmenu_wince.rc
+++ /dev/null
@@ -1,231 +0,0 @@
-#include "qmenu_wince_resource_p.h"
-
-#include <commctrl.h>
-#include "winuser.h"
-
-#if defined (_DEBUG) && defined(QT_SHARED)
-#include "Qt5Widgetsd_resource.rc"
-#elif defined(QT_SHARED)
-#include "Qt5Widgets_resource.rc"
-#endif
-
-#define DIALOGEX DIALOG DISCARDABLE
-#define SHMENUBAR RCDATA
-#define I_IMAGENONE (-2)
-#define NOMENU 0xFFFF
-
-IDR_MAIN_MENU MENU DISCARDABLE
-BEGIN
- POPUP "Menu"
- BEGIN
- MENUITEM "About", IDM_ABOUT
- END
-END
-
-IDR_MAIN_MENU2 MENU DISCARDABLE
-BEGIN
- POPUP "Menu"
- BEGIN
- MENUITEM "About", IDM_ABOUT
- END
- POPUP "Display"
- BEGIN
- MENUITEM "View", IDM_VIEW
- END
-END
-
-
-IDR_MAIN_MENU3 MENU DISCARDABLE
-BEGIN
- POPUP "Menu1"
- BEGIN
- MENUITEM "Item1", IDM_ITEM1
- END
- POPUP "Menu2"
- BEGIN
- MENUITEM "Item2", IDM_ITEM2
- END
- POPUP "Menu3"
- BEGIN
- MENUITEM "Item3", IDM_ITEM3
- END
- POPUP "Menu4"
- BEGIN
- MENUITEM "Item4", IDM_ITEM4
- END
-END
-
-IDR_MAIN_MENU4 MENU DISCARDABLE
-BEGIN
- POPUP "Menu1"
- BEGIN
- MENUITEM "Item1", IDM_ITEM1
- END
- POPUP "Menu2"
- BEGIN
- MENUITEM "Item2", IDM_ITEM2
- END
- POPUP "Menu3"
- BEGIN
- MENUITEM "Item3", IDM_ITEM3
- END
- POPUP "Menu4"
- BEGIN
- MENUITEM "Item4", IDM_ITEM4
- END
- POPUP "Menu5"
- BEGIN
- MENUITEM "Item5", IDM_ITEM5
- END
- POPUP "Menu6"
- BEGIN
- MENUITEM "Item6", IDM_ITEM6
- END
-END
-
-IDR_MAIN_MENU5 MENU DISCARDABLE
-BEGIN
- POPUP "Menu1"
- BEGIN
- MENUITEM "Item1", IDM_ITEM1
- END
- POPUP "Menu2"
- BEGIN
- MENUITEM "Item2", IDM_ITEM2
- END
- POPUP "Menu3"
- BEGIN
- MENUITEM "Item3", IDM_ITEM3
- END
- POPUP "Menu4"
- BEGIN
- MENUITEM "Item4", IDM_ITEM4
- END
- POPUP "Menu5"
- BEGIN
- MENUITEM "Item5", IDM_ITEM5
- END
- POPUP "Menu6"
- BEGIN
- MENUITEM "Item6", IDM_ITEM6
- END
- POPUP "Menu7"
- BEGIN
- MENUITEM "Item7", IDM_ITEM7
- END
- POPUP "Menu8"
- BEGIN
- MENUITEM "Item8", IDM_ITEM8
- END
-END
-
-STRINGTABLE
-BEGIN
- IDS_EXIT "Exit"
- IDS_MENU "Menu"
- IDS_LEFTMENU "Display"
- IDS_MENU1 "Menu__1"
- IDS_MENU2 "Menu__2"
- IDS_MENU3 "Menu__3"
- IDS_MENU4 "Menu__4"
- IDS_MENU5 "Menu__5"
- IDS_MENU6 "Menu__6"
- IDS_MENU7 "Menu__7"
- IDS_MENU8 "Menu__8"
-END
-
-IDR_MAIN_MENU SHMENUBAR DISCARDABLE
-BEGIN
- IDR_MAIN_MENU,
- 2,
-
- I_IMAGENONE, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,
- IDS_EXIT, 0, NOMENU,
-
- I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU, 0, 0,
-END
-
-IDR_MAIN_MENU2 SHMENUBAR DISCARDABLE
-BEGIN
- IDR_MAIN_MENU2,
- 2,
-
- I_IMAGENONE, IDM_LEFTMENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_LEFTMENU, 0, 1,
-
- I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU, 0, 0,
-END
-
-IDR_MAIN_MENU3 SHMENUBAR DISCARDABLE
-BEGIN
- IDR_MAIN_MENU3,
- 4,
-
- I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU1, 0, 0,
-
- I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU2, 0, 1,
-
- I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU3, 0, 2,
-
- I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU4, 0, 3,
-END
-
-IDR_MAIN_MENU4 SHMENUBAR DISCARDABLE
-BEGIN
- IDR_MAIN_MENU4,
- 6,
-
- I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU1, 0, 0,
-
- I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU2, 0, 1,
-
- I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU3, 0, 2,
-
- I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU4, 0, 3,
-
- I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU5, 0, 4,
-
- I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU6, 0, 5,
-END
-
-IDR_MAIN_MENU5 SHMENUBAR DISCARDABLE
-BEGIN
- IDR_MAIN_MENU5,
- 8,
-
- I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU1, 0, 0,
-
- I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU2, 0, 1,
-
- I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU3, 0, 2,
-
- I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU4, 0, 3,
-
- I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU5, 0, 4,
-
- I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU6, 0, 5,
-
- I_IMAGENONE, IDM_MENU7, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU7, 0, 6,
-
- I_IMAGENONE, IDM_MENU8, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
- IDS_MENU8, 0, 7,
-END
diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h
deleted file mode 100644
index 3bd83d934f..0000000000
--- a/src/widgets/widgets/qmenu_wince_resource_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#define IDR_MAIN_MENU 102
-#define IDR_MAIN_MENU2 103
-#define IDR_MAIN_MENU3 104
-#define IDS_EXIT 105
-#define IDS_MENU 106
-#define IDS_LEFTMENU 107
-#define IDM_ABOUT 108
-#define IDM_VIEW 109
-#define IDM_ITEM1 108
-#define IDM_ITEM2 109
-#define IDM_ITEM3 110
-#define IDM_ITEM4 111
-#define IDM_ITEM5 112
-#define IDM_ITEM6 113
-#define IDM_ITEM7 114
-#define IDM_ITEM8 115
-#define IDS_MENU1 116
-#define IDS_MENU2 117
-#define IDS_MENU3 118
-#define IDS_MENU4 119
-#define IDS_MENU5 120
-#define IDS_MENU6 121
-#define IDS_MENU7 122
-#define IDS_MENU8 123
-#define IDR_MAIN_MENU4 124
-#define IDR_MAIN_MENU5 125
-#define IDM_EXIT 40000
-#define IDM_MENU 40001
-#define IDM_LEFTMENU 40002
-#define IDM_MENU1 40003
-#define IDM_MENU2 40004
-#define IDM_MENU3 40005
-#define IDM_MENU4 40006
-#define IDM_MENU5 40007
-#define IDM_MENU6 40008
-#define IDM_MENU7 40009
-#define IDM_MENU8 40010
-
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index bf523a3a70..3a90e14655 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -64,10 +64,6 @@
#include "qmenubar_p.h"
#include "qdebug.h"
-#ifdef Q_OS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
-#endif
-
QT_BEGIN_NAMESPACE
class QMenuBarExtension : public QToolButton
@@ -701,16 +697,6 @@ void QMenuBarPrivate::init()
if (platformMenuBar)
q->hide();
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile()) {
- wceCreateMenuBar(q->parentWidget());
- if(wce_menubar)
- q->hide();
- }
- else {
- QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
- }
-#endif
q->setBackgroundRole(QPalette::Button);
handleReparent();
q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q));
@@ -760,11 +746,6 @@ QMenuBar::~QMenuBar()
Q_D(QMenuBar);
delete d->platformMenuBar;
d->platformMenuBar = 0;
-
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile())
- d->wceDestroyMenuBar();
-#endif
}
/*!
@@ -1016,7 +997,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
*/
void QMenuBar::setVisible(bool visible)
{
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_DARWIN)
if (isNativeMenuBar()) {
if (!visible)
QWidget::setVisible(false);
@@ -1233,11 +1214,7 @@ void QMenuBar::actionEvent(QActionEvent *e)
d->itemsDirty = true;
if (d->platformMenuBar) {
-#if !defined(Q_OS_WINCE)
QPlatformMenuBar *nativeMenuBar = d->platformMenuBar;
-#else
- QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar;
-#endif
if (!nativeMenuBar)
return;
@@ -1389,11 +1366,6 @@ void QMenuBarPrivate::handleReparent()
platformMenuBar->handleReparent(0);
}
}
-
-#ifdef Q_OS_WINCE
- if (qt_wince_is_mobile() && wce_menubar)
- wce_menubar->rebuild();
-#endif
}
/*!
@@ -1572,7 +1544,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const
QSize QMenuBar::minimumSizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_DARWIN)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1628,7 +1600,7 @@ QSize QMenuBar::minimumSizeHint() const
QSize QMenuBar::sizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_DARWIN)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1686,7 +1658,7 @@ QSize QMenuBar::sizeHint() const
int QMenuBar::heightForWidth(int) const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_OS_DARWIN)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1871,55 +1843,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar()
}
/*!
- \since 4.4
-
- Sets the default action to \a act.
-
- The default action is assigned to the left soft key. The menu is assigned
- to the right soft key.
-
- Currently there is only support for the default action on Windows
- Mobile. On all other platforms this method is not available.
-
- \sa defaultAction()
-*/
-
-#ifdef Q_OS_WINCE
-void QMenuBar::setDefaultAction(QAction *act)
-{
- Q_D(QMenuBar);
- if (d->defaultAction == act)
- return;
- if (qt_wince_is_mobile())
- if (d->defaultAction) {
- disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction()));
- disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction()));
- }
- d->defaultAction = act;
- if (qt_wince_is_mobile())
- if (d->defaultAction) {
- connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction()));
- connect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction()));
- }
- if (d->wce_menubar) {
- d->wce_menubar->rebuild();
- }
-}
-
-/*!
- \since 4.4
-
- Returns the current default action.
-
- \sa setDefaultAction()
-*/
-QAction *QMenuBar::defaultAction() const
-{
- return d_func()->defaultAction;
-}
-#endif
-
-/*!
\fn void QMenuBar::triggered(QAction *action)
This signal is emitted when an action in a menu belonging to this menubar
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index d3f5e503ac..404bd13332 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -95,13 +95,6 @@ public:
void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner);
QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
-#ifdef Q_OS_WINCE
- void setDefaultAction(QAction *);
- QAction *defaultAction() const;
-
- static void wceCommands(uint command);
- static void wceRefresh();
-#endif
#ifdef Q_OS_OSX
NSMenu* toNSMenu();
#endif
@@ -141,10 +134,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int))
Q_PRIVATE_SLOT(d_func(), void _q_updateLayout())
-#ifdef Q_OS_WINCE
- Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction())
-#endif
-
friend class QMenu;
friend class QMenuPrivate;
friend class QWindowsStyle;
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index c88e4af836..0db986bac5 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -66,17 +66,11 @@ public:
QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0)
+ { }
-#ifdef Q_OS_WINCE
- , wce_menubar(0), wceClassicMenu(false)
-#endif
- { }
~QMenuBarPrivate()
{
delete platformMenuBar;
-#ifdef Q_OS_WINCE
- delete wce_menubar;
-#endif
}
void init();
@@ -118,10 +112,6 @@ public:
void _q_internalShortcutActivated(int);
void _q_updateLayout();
-#ifdef Q_OS_WINCE
- void _q_updateDefaultAction();
-#endif
-
//extra widgets in the menubar
QPointer<QWidget> leftWidget, rightWidget;
QMenuBarExtension *extension;
@@ -145,47 +135,6 @@ public:
QPlatformMenu *getPlatformMenu(QAction *action);
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
-
-#ifdef Q_OS_WINCE
- void wceCreateMenuBar(QWidget *);
- void wceDestroyMenuBar();
- struct QWceMenuBarPrivate {
- QList<QWceMenuAction*> actionItems;
- QList<QWceMenuAction*> actionItemsLeftButton;
- QList<QList<QWceMenuAction*>> actionItemsClassic;
- HMENU menuHandle;
- HMENU leftButtonMenuHandle;
- HWND menubarHandle;
- HWND parentWindowHandle;
- bool leftButtonIsMenu;
- QPointer<QAction> leftButtonAction;
- QMenuBarPrivate *d;
- int leftButtonCommand;
-
- QWceMenuBarPrivate(QMenuBarPrivate *menubar);
- ~QWceMenuBarPrivate();
- void addAction(QAction *, QAction *);
- void addAction(QAction *, QWceMenuAction* =0);
- void addAction(QWceMenuAction *, QWceMenuAction* =0);
- void syncAction(QWceMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QWceMenuAction *);
- void rebuild();
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QWceMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QWceMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *wce_menubar;
- bool wceClassicMenu;
- void wceCommands(uint command);
- void wceRefresh();
- bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
-#endif
};
#endif // QT_NO_MENUBAR
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index a3bb06c063..5608a4aff9 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -254,11 +254,9 @@ QPushButton::QPushButton(QWidget *parent)
*/
QPushButton::QPushButton(const QString &text, QWidget *parent)
- : QAbstractButton(*new QPushButtonPrivate, parent)
+ : QPushButton(parent)
{
- Q_D(QPushButton);
setText(text);
- d->init();
}
@@ -270,12 +268,10 @@ QPushButton::QPushButton(const QString &text, QWidget *parent)
*/
QPushButton::QPushButton(const QIcon& icon, const QString &text, QWidget *parent)
- : QAbstractButton(*new QPushButtonPrivate, parent)
+ : QPushButton(*new QPushButtonPrivate, parent)
{
- Q_D(QPushButton);
setText(text);
setIcon(icon);
- d->init();
}
/*! \internal
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index 55a584078a..284c5f56cf 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -155,10 +155,8 @@ QRadioButton::~QRadioButton()
*/
QRadioButton::QRadioButton(const QString &text, QWidget *parent)
- : QAbstractButton(*new QRadioButtonPrivate, parent)
+ : QRadioButton(parent)
{
- Q_D(QRadioButton);
- d->init();
setText(text);
}
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 7dd41f6a0c..79bfedb8c4 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -348,10 +348,8 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const
initial \l {QAbstractSlider::value} {value} of 0.
*/
QScrollBar::QScrollBar(QWidget *parent)
- : QAbstractSlider(*new QScrollBarPrivate, parent)
+ : QScrollBar(Qt::Vertical, parent)
{
- d_func()->orientation = Qt::Vertical;
- d_func()->init();
}
/*!
@@ -397,12 +395,6 @@ void QScrollBarPrivate::init()
q->setSizePolicy(sp);
q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
q->setAttribute(Qt::WA_OpaquePaintEvent);
-
-#if !defined(QT_NO_CONTEXTMENU) && defined(Q_OS_WINCE)
- if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) {
- q->setContextMenuPolicy(Qt::PreventContextMenu);
- }
-#endif
}
#ifndef QT_NO_CONTEXTMENU
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index 7b675fccbd..744a43253a 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -284,10 +284,8 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos)
Constructs a vertical slider with the given \a parent.
*/
QSlider::QSlider(QWidget *parent)
- : QAbstractSlider(*new QSliderPrivate, parent)
+ : QSlider(Qt::Vertical, parent)
{
- d_func()->orientation = Qt::Vertical;
- d_func()->init();
}
/*!
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index 17b7a9ebb3..910904e96e 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -941,11 +941,8 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w)
\sa setOrientation()
*/
QSplitter::QSplitter(QWidget *parent)
- : QFrame(*new QSplitterPrivate, parent)
+ : QSplitter(Qt::Horizontal, parent)
{
- Q_D(QSplitter);
- d->orient = Qt::Horizontal;
- d->init();
}
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 7de1d92acf..5f1c373bb1 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -749,9 +749,6 @@ bool QStatusBar::event(QEvent *e)
#ifndef Q_DEAD_CODE_FROM_QT4_MAC
return QWidget::event(e);
#else
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
- return QWidget::event(e);
-
// Enable drag-click only if the status bar is the status bar for a
// QMainWindow with a unifed toolbar.
if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 7a192193e4..8c808f98cb 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -2525,6 +2525,34 @@ QWidget *QTabBar::tabButton(int index, ButtonPosition position) const
return d->tabList.at(index).rightWidget;
}
+#ifndef QT_NO_ACCESSIBILITY
+/*!
+ Sets the accessibleName of the tab at position \a index to \a name.
+*/
+void QTabBar::setAccessibleTabName(int index, const QString &name)
+{
+ Q_D(QTabBar);
+ if (QTabBarPrivate::Tab *tab = d->at(index)) {
+ tab->accessibleName = name;
+ QAccessibleEvent event(this, QAccessible::NameChanged);
+ event.setChild(index);
+ QAccessible::updateAccessibility(&event);
+ }
+}
+
+/*!
+ Returns the accessibleName of the tab at position \a index, or an empty
+ string if \a index is out of range.
+*/
+QString QTabBar::accessibleTabName(int index) const
+{
+ Q_D(const QTabBar);
+ if (const QTabBarPrivate::Tab *tab = d->at(index))
+ return tab->accessibleName;
+ return QString();
+}
+#endif // QT_NO_ACCESSIBILITY
+
CloseButton::CloseButton(QWidget *parent)
: QAbstractButton(parent)
{
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index 138c5470c6..84b2d40aea 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -172,6 +172,11 @@ public:
bool changeCurrentOnDrag() const;
void setChangeCurrentOnDrag(bool change);
+#ifndef QT_NO_ACCESSIBILITY
+ QString accessibleTabName(int index) const;
+ void setAccessibleTabName(int index, const QString &name);
+#endif
+
public Q_SLOTS:
void setCurrentIndex(int index);
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 48f235f050..7c50ebd235 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -131,6 +131,9 @@ public:
QWidget *rightWidget;
int lastTab;
int dragOffset;
+#ifndef QT_NO_ACCESSIBILITY
+ QString accessibleName;
+#endif
#ifndef QT_NO_ANIMATION
~Tab() { delete animation; }
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index c74372cfa4..b93cefd867 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -520,10 +520,8 @@ QToolBar::QToolBar(QWidget *parent)
\sa setWindowTitle()
*/
QToolBar::QToolBar(const QString &title, QWidget *parent)
- : QWidget(*new QToolBarPrivate, parent, 0)
+ : QToolBar(parent)
{
- Q_D(QToolBar);
- d->init();
setWindowTitle(title);
}
@@ -1186,17 +1184,6 @@ bool QToolBar::event(QEvent *event)
if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
-#ifdef Q_OS_WINCE
- case QEvent::ContextMenu:
- {
- QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event);
- QWidget* child = childAt(contextMenuEvent->pos());
- QAbstractButton* button = qobject_cast<QAbstractButton*>(child);
- if (button)
- button->setDown(false);
- }
- break;
-#endif
case QEvent::Leave:
if (d->state != 0 && d->state->dragging) {
#ifdef Q_OS_WIN
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 774d47b913..c1d765598f 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -100,11 +100,17 @@ public:
QAction *addAction(const QIcon &icon, const QString &text,
const QObject *receiver, const char* member);
#ifdef Q_QDOC
+ template<typename PointerToMemberFunction>
QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method);
+ template<typename Functor>
QAction *addAction(const QString &text, Functor functor);
+ template<typename Functor>
QAction *addAction(const QString &text, const QObject *context, Functor functor);
+ template<typename PointerToMemberFunction>
QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method);
+ template<typename Functor>
QAction *addAction(const QIcon &icon, const QString &text, Functor functor);
+ template<typename Functor>
QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor);
#else
// addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 8b6b76c55e..66f17dbe33 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -441,7 +441,7 @@ QRect QWidgetLineControl::anchorRect() const
{
if (!hasSelectedText())
return cursorRect();
- return rectForPos(m_selstart < m_selend ? m_selstart : m_selend);
+ return rectForPos(m_cursor == m_selstart ? m_selend : m_selstart);
}
/*!
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 784055ed62..abba3e0472 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -155,19 +155,3 @@ macx {
widgets/qmacnativewidget_mac.mm \
widgets/qmaccocoaviewcontainer_mac.mm
}
-
-wince {
- SOURCES += widgets/qmenu_wince.cpp
- HEADERS += widgets/qmenu_wince_resource_p.h
- RC_FILE = widgets/qmenu_wince.rc
- !static: QMAKE_WRITE_DEFAULT_RC = 1
- !isEmpty(QT_LIBINFIX) {
- ORIG_RCFILE = $${TARGET}_resource.rc
- copyrcc.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
- copyrcc.input = ORIG_RCFILE
- CONFIG(debug, debug|release):copyrcc.output = $${ORIG_TARGET}d_resource.rc
- else:copyrcc.output = $${ORIG_TARGET}_resource.rc
- copyrcc.CONFIG = target_predeps no_link
- QMAKE_EXTRA_COMPILERS += copyrcc
- }
-}
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index bf416e11d3..7087176110 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -53,9 +53,7 @@
#include "qstring.h"
#include "qvector.h"
-#ifndef Q_OS_WINCE
-# include <shlobj.h>
-#endif
+#include <shlobj.h>
/*
This file contains the code in the qtmain library for Windows.
@@ -69,11 +67,7 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WINCE)
-extern void __cdecl qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &);
-#else
extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &);
-#endif
QT_END_NAMESPACE
@@ -84,12 +78,8 @@ QT_USE_NAMESPACE
int qMain(int, char **);
#define main qMain
#else
-#ifdef Q_OS_WINCE
-extern "C" int __cdecl main(int, char **);
-#else
extern "C" int main(int, char **);
#endif
-#endif
/*
WinMain() - Initializes Windows and calls user's startup function main().
@@ -97,8 +87,6 @@ extern "C" int main(int, char **);
application.
*/
-#ifndef Q_OS_WINCE
-
// Convert a wchar_t to char string, equivalent to QString::toLocal8Bit()
// when passed CP_ACP.
static inline char *wideToMulti(int codePage, const wchar_t *aw)
@@ -126,48 +114,3 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int
delete [] argv;
return exitCode;
}
-
-#else // !Q_OS_WINCE
-
-int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR /*wCmdParam*/, int cmdShow)
-{
- QByteArray cmdParam = QString::fromWCharArray(GetCommandLine()).toLocal8Bit();
-
- wchar_t appName[MAX_PATH];
- GetModuleFileName(0, appName, MAX_PATH);
- cmdParam.prepend(QString(QLatin1String("\"%1\" ")).arg(QString::fromWCharArray(appName)).toLocal8Bit());
-
- int argc = 0;
- QVector<char *> argv(8);
- qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv);
-
- wchar_t uniqueAppID[MAX_PATH];
- GetModuleFileName(0, uniqueAppID, MAX_PATH);
- QString uid = QString::fromWCharArray(uniqueAppID).toLower().replace(QLatin1String("\\"), QLatin1String("_"));
-
- // If there exists an other instance of this application
- // it will be the owner of a mutex with the unique ID.
- HANDLE mutex = CreateMutex(NULL, TRUE, (LPCWSTR)uid.utf16());
- if (mutex && ERROR_ALREADY_EXISTS == GetLastError()) {
- CloseHandle(mutex);
-
- // The app is already running, so we use the unique
- // ID to create a unique messageNo, which is used
- // as the registered class name for the windows
- // created. Set the first instance's window to the
- // foreground, else just terminate.
- // Use bitwise 0x01 OR to reactivate window state if
- // it was hidden
- UINT msgNo = RegisterWindowMessage((LPCWSTR)uid.utf16());
- HWND aHwnd = FindWindow((LPCWSTR)QString::number(msgNo).utf16(), 0);
- if (aHwnd)
- SetForegroundWindow((HWND)(((ULONG)aHwnd) | 0x01));
- return 0;
- }
-
- int result = main(argc, argv.data());
- CloseHandle(mutex);
- return result;
-}
-
-#endif // Q_OS_WINCE
diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index b4977653ce..2bb7529456 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -23,7 +23,7 @@ winrt {
} else {
SOURCES = qtmain_win.cpp
- !wince: LIBS += -lshell32
+ LIBS += -lshell32
}
load(qt_installs)
@@ -33,5 +33,3 @@ TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end
load(qt_targets)
load(qt_build_paths)
load(qt_common)
-
-wince: QMAKE_POST_LINK =